vbscript: Fixed parsing if statements with empty body.
This commit is contained in:
parent
3b9a13e94c
commit
20b2d057d2
|
@ -228,7 +228,7 @@ Step_opt
|
|||
| tSTEP Expression { $$ = $2; }
|
||||
|
||||
IfStatement
|
||||
: tIF Expression tTHEN tNL StatementsNl ElseIfs_opt Else_opt tEND tIF
|
||||
: tIF Expression tTHEN tNL StatementsNl_opt ElseIfs_opt Else_opt tEND tIF
|
||||
{ $$ = new_if_statement(ctx, $2, $5, $6, $7); CHECK_ERROR; }
|
||||
| tIF Expression tTHEN Statement { $$ = new_if_statement(ctx, $2, $4, NULL, NULL); CHECK_ERROR; }
|
||||
| tIF Expression tTHEN Statement tELSE Statement EndIf_opt
|
||||
|
@ -247,12 +247,12 @@ ElseIfs
|
|||
| ElseIf ElseIfs { $1->next = $2; $$ = $1; }
|
||||
|
||||
ElseIf
|
||||
: tELSEIF Expression tTHEN tNL StatementsNl
|
||||
: tELSEIF Expression tTHEN tNL StatementsNl_opt
|
||||
{ $$ = new_elseif_decl(ctx, $2, $5); }
|
||||
|
||||
Else_opt
|
||||
: /* empty */ { $$ = NULL; }
|
||||
| tELSE tNL StatementsNl { $$ = $3; }
|
||||
| tELSE tNL StatementsNl_opt { $$ = $3; }
|
||||
|
||||
CaseClausules
|
||||
: /* empty */ { $$ = NULL; }
|
||||
|
|
|
@ -290,6 +290,22 @@ while not (x and y)
|
|||
wend
|
||||
call ok((x and y), "x or y is false after while")
|
||||
|
||||
if false then
|
||||
' empty body
|
||||
end if
|
||||
|
||||
if false then
|
||||
x = false
|
||||
elseif true then
|
||||
' empty body
|
||||
end if
|
||||
|
||||
if false then
|
||||
x = false
|
||||
else
|
||||
' empty body
|
||||
end if
|
||||
|
||||
while false
|
||||
wend
|
||||
|
||||
|
|
Loading…
Reference in New Issue