mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser/ast: Block
This commit is contained in:
parent
7aff0cb84f
commit
e012966291
@ -19,7 +19,7 @@ ConcatExpr | Type | AsCast | TypeOf | StringInterLiteral
|
||||
pub type Stmt = GlobalDecl | FnDecl | Return | Module | Import | ExprStmt |
|
||||
ForStmt | StructDecl | ForCStmt | ForInStmt | CompIf | ConstDecl | Attr | BranchStmt |
|
||||
HashStmt | AssignStmt | EnumDecl | TypeDecl | DeferStmt | GotoLabel | GotoStmt |
|
||||
LineComment | MultiLineComment | AssertStmt | UnsafeStmt | GoStmt
|
||||
LineComment | MultiLineComment | AssertStmt | UnsafeStmt | GoStmt | Block
|
||||
// pub type Type = StructType | ArrayType
|
||||
// pub struct StructType {
|
||||
// fields []Field
|
||||
@ -30,6 +30,11 @@ pub:
|
||||
typ table.Type
|
||||
}
|
||||
|
||||
pub struct Block {
|
||||
pub:
|
||||
stmts []Stmt
|
||||
}
|
||||
|
||||
// | IncDecStmt k
|
||||
// Stand-alone expression in a statement list.
|
||||
pub struct ExprStmt {
|
||||
|
@ -334,6 +334,12 @@ pub fn (p mut Parser) line_comment() ast.LineComment {
|
||||
|
||||
pub fn (p mut Parser) stmt() ast.Stmt {
|
||||
match p.tok.kind {
|
||||
.lcbr {
|
||||
stmts := p.parse_block()
|
||||
return ast.Block{
|
||||
stmts: stmts
|
||||
}
|
||||
}
|
||||
.key_assert {
|
||||
p.next()
|
||||
expr := p.expr(0)
|
||||
|
Loading…
Reference in New Issue
Block a user