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

parser: minor cleanup of stmt() (#7573)

This commit is contained in:
yuyi 2020-12-26 14:54:13 +08:00 committed by GitHub
parent 13f16b4a82
commit d66ed46486
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -679,20 +679,26 @@ pub fn (mut p Parser) stmt(is_top_level bool) ast.Stmt {
return p.return_stmt()
}
.dollar {
if p.peek_tok.kind == .key_if {
match p.peek_tok.kind {
.key_if {
return ast.ExprStmt{
expr: p.if_expr(true)
}
} else if p.peek_tok.kind == .key_for {
}
.key_for {
return p.comp_for()
} else if p.peek_tok.kind == .name {
}
.name {
return ast.ExprStmt{
expr: p.vweb()
}
}
else {
p.error_with_pos('unexpected \$', p.tok.position())
return ast.Stmt{}
}
}
}
.key_continue, .key_break {
tok := p.tok
line := p.tok.line_nr