Commit 39058487 authored by Robert Wilhelm's avatar Robert Wilhelm Committed by Alexandre Julliard

vbscript: Handle "case" statements without separators.

parent 4979ae5a
......@@ -323,10 +323,9 @@ Else_opt
| tELSE StatementsNl_opt { $$ = $2; }
CaseClausules
: /* empty */ { $$ = NULL; }
| tCASE tELSE StSep StatementsNl_opt { $$ = new_case_clausule(ctx, NULL, $4, NULL); }
| tCASE ExpressionList StSep StatementsNl_opt CaseClausules
{ $$ = new_case_clausule(ctx, $2, $4, $5); }
: /* empty */ { $$ = NULL; }
| tCASE tELSE StSep_opt StatementsNl_opt { $$ = new_case_clausule(ctx, NULL, $4, NULL); }
| tCASE ExpressionList StSep_opt StatementsNl_opt CaseClausules { $$ = new_case_clausule(ctx, $2, $4, $5); }
Arguments
: tEMPTYBRACKETS { $$ = NULL; }
......@@ -513,6 +512,10 @@ Identifier
| tPROPERTY { ctx->last_token = tIdentifier; $$ = $1; }
| tSTEP { ctx->last_token = tIdentifier; $$ = $1; }
StSep_opt
: /* empty */
| StSep
/* Most statements accept both new line and ':' as separators */
StSep
: tNL
......
......@@ -766,6 +766,26 @@ end select
select case 0 : case 1 : case else : end select
' Case without separator
function SelectCaseTest(x)
select case x
case 0: SelectCaseTest = 100
case 1 SelectCaseTest = 200
case 2
SelectCaseTest = 300
case 3
case 4 SelectCaseTest = 400
case else SelectCaseTest = 500
end select
end function
call ok(SelectCaseTest(0) = 100, "Unexpected case " & SelectCaseTest(0))
call ok(SelectCaseTest(1) = 200, "Unexpected case " & SelectCaseTest(1))
call ok(SelectCaseTest(2) = 300, "Unexpected case " & SelectCaseTest(2))
call ok(SelectCaseTest(3) = vbEmpty, "Unexpected case " & SelectCaseTest(3))
call ok(SelectCaseTest(4) = 400, "Unexpected case " & SelectCaseTest(4))
call ok(SelectCaseTest(5) = 500, "Unexpected case " & SelectCaseTest(5))
if false then
Sub testsub
x = true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment