1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vweb: ['/:arg1/:arg2/action'] attribute

This commit is contained in:
Alexander Medvednikov
2020-07-03 15:10:39 +02:00
parent f03688e443
commit b7175b54eb
13 changed files with 281 additions and 100 deletions

View File

@ -15,10 +15,10 @@ pub type Expr = AnonFn | ArrayInit | AsCast | Assoc | BoolLiteral | CallExpr | C
ParExpr | PostfixExpr | PrefixExpr | RangeExpr | SelectorExpr | SizeOf | SqlExpr | StringInterLiteral |
StringLiteral | StructInit | Type | TypeOf
pub type Stmt = AssertStmt | AssignStmt | Attr | Block | BranchStmt | Comment | CompIf |
ConstDecl | DeferStmt | EnumDecl | ExprStmt | FnDecl | ForCStmt | ForInStmt | ForStmt |
GlobalDecl | GoStmt | GotoLabel | GotoStmt | HashStmt | Import | InterfaceDecl | Module |
Return | SqlStmt | StructDecl | TypeDecl | UnsafeStmt
pub type Stmt = AssertStmt | AssignStmt | Attr | Block | BranchStmt | Comment | CompFor |
CompIf | ConstDecl | DeferStmt | EnumDecl | ExprStmt | FnDecl | ForCStmt | ForInStmt |
ForStmt | GlobalDecl | GoStmt | GotoLabel | GotoStmt | HashStmt | Import | InterfaceDecl |
Module | Return | SqlStmt | StructDecl | TypeDecl | UnsafeStmt
pub type ScopeObject = ConstField | GlobalDecl | Var
@ -457,11 +457,11 @@ pub mut:
pub struct MatchBranch {
pub:
exprs []Expr // left side
stmts []Stmt // right side
pos token.Position
comment Comment // comment above `xxx {`
is_else bool
exprs []Expr // left side
stmts []Stmt // right side
pos token.Position
comment Comment // comment above `xxx {`
is_else bool
post_comments []Comment
}
@ -486,6 +486,15 @@ pub mut:
else_stmts []Stmt
}
pub struct CompFor {
pub:
val_var string
stmts []Stmt
pub mut:
// expr Expr
typ table.Type
}
pub struct ForStmt {
pub:
cond Expr
@ -594,12 +603,12 @@ pub:
pub struct EnumDecl {
pub:
name string
is_pub bool
is_flag bool // true when the enum has [flag] tag
name string
is_pub bool
is_flag bool // true when the enum has [flag] tag
comments []Comment // enum Abc { /* comments */ ... }
fields []EnumField
pos token.Position
fields []EnumField
pos token.Position
}
pub struct AliasTypeDecl {
@ -799,6 +808,7 @@ pub:
left Expr
is_vweb bool
vweb_tmpl File
args_var string
pub mut:
sym table.TypeSymbol
}
@ -876,7 +886,7 @@ pub fn (expr Expr) position() token.Position {
AsCast {
return expr.pos
}
// ast.Ident { }
// ast.Ident { }
CastExpr {
return expr.pos
}
@ -904,7 +914,7 @@ pub fn (expr Expr) position() token.Position {
IfExpr {
return expr.pos
}
// ast.IfGuardExpr { }
// ast.IfGuardExpr { }
IndexExpr {
return expr.pos
}
@ -935,12 +945,11 @@ pub fn (expr Expr) position() token.Position {
PostfixExpr {
return expr.pos
}
// ast.None { }
// ast.None { }
PrefixExpr {
return expr.pos
}
// ast.ParExpr { }
// ast.ParExpr { }
SelectorExpr {
return expr.pos
}
@ -953,14 +962,14 @@ pub fn (expr Expr) position() token.Position {
StringInterLiteral {
return expr.pos
}
// ast.Type { }
// ast.Type { }
StructInit {
return expr.pos
}
Likely {
return expr.pos
}
// ast.TypeOf { }
// ast.TypeOf { }
else {
return token.Position{}
}
@ -971,29 +980,29 @@ pub fn (stmt Stmt) position() token.Position {
match stmt {
AssertStmt { return stmt.pos }
AssignStmt { return stmt.pos }
/*
// Attr {
/*
// Attr {
// }
// Block {
// }
// BranchStmt {
// }
*/
*/
Comment { return stmt.pos }
CompIf { return stmt.pos }
ConstDecl { return stmt.pos }
/*
// DeferStmt {
/*
// DeferStmt {
// }
*/
*/
EnumDecl { return stmt.pos }
ExprStmt { return stmt.pos }
FnDecl { return stmt.pos }
ForCStmt { return stmt.pos }
ForInStmt { return stmt.pos }
ForStmt { return stmt.pos }
/*
// GlobalDecl {
/*
// GlobalDecl {
// }
// GoStmt {
// }
@ -1003,23 +1012,23 @@ pub fn (stmt Stmt) position() token.Position {
// }
// HashStmt {
// }
*/
*/
Import { return stmt.pos }
/*
// InterfaceDecl {
/*
// InterfaceDecl {
// }
// Module {
// }
*/
*/
Return { return stmt.pos }
StructDecl { return stmt.pos }
/*
// TypeDecl {
/*
// TypeDecl {
// }
// UnsafeStmt {
// }
*/
//
*/
//
else { return token.Position{} }
}
}