parser: fix dollar (closes #14292) (#14378)

Daniel Däschle 2022-05-13 07:30:10 +02:00 committed by Jef Roosens
parent 1e750041ee
commit efd1597d84
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
3 changed files with 7 additions and 0 deletions

View File

@ -663,6 +663,9 @@ pub fn (mut p Parser) top_stmt() ast.Stmt {
return p.struct_decl()
}
.dollar {
if p.peek_tok.kind == .eof {
return p.error('unexpected eof')
}
if_expr := p.if_expr(true)
return ast.ExprStmt{
expr: if_expr

View File

@ -0,0 +1,3 @@
vlib/v/parser/tests/dollar_err.vv:1:1: error: unexpected eof, expecting `if`
1 | $
| ^

View File

@ -0,0 +1 @@
$