mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: fix v test-parser examples/cli.v (#7243)
This commit is contained in:
@@ -162,7 +162,7 @@ fn (mut p Parser) match_expr() ast.MatchExpr {
|
||||
p.check(.lcbr)
|
||||
}
|
||||
mut branches := []ast.MatchBranch{}
|
||||
for {
|
||||
for p.tok.kind != .eof {
|
||||
branch_first_pos := p.tok.position()
|
||||
comments := p.eat_comments() // comments before {}
|
||||
mut exprs := []ast.Expr{}
|
||||
|
||||
@@ -352,12 +352,8 @@ pub fn (mut p Parser) parse_block_no_scope(is_top_level bool) []ast.Stmt {
|
||||
mut stmts := []ast.Stmt{}
|
||||
if p.tok.kind != .rcbr {
|
||||
mut c := 0
|
||||
for {
|
||||
for p.tok.kind !in [.eof, .rcbr] {
|
||||
stmts << p.stmt(is_top_level)
|
||||
// p.warn('after stmt(): tok=$p.tok.str()')
|
||||
if p.tok.kind in [.eof, .rcbr] {
|
||||
break
|
||||
}
|
||||
c++
|
||||
if c % 100000 == 0 {
|
||||
eprintln('parsed $c statements so far from fn $p.cur_fn_name ...')
|
||||
|
||||
@@ -319,7 +319,7 @@ fn (mut p Parser) struct_init(short_syntax bool) ast.StructInit {
|
||||
// p.warn(is_short_syntax.str())
|
||||
saved_is_amp := p.is_amp
|
||||
p.is_amp = false
|
||||
for p.tok.kind != .rcbr && p.tok.kind != .rpar {
|
||||
for p.tok.kind !in [.rcbr, .rpar, .eof] {
|
||||
mut field_name := ''
|
||||
mut expr := ast.Expr{}
|
||||
mut field_pos := token.Position{}
|
||||
|
||||
Reference in New Issue
Block a user