diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index 3004c3b7ba1..cd69f5dc217 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -205,7 +205,7 @@ SimpleStatement { $$ = new_forto_statement(ctx, $2, $4, $6, $7, $9); CHECK_ERROR; } | tFOR tEACH Identifier tIN Expression tNL StatementsNl_opt tNEXT { $$ = new_foreach_statement(ctx, $3, $5, $7); } - | tSELECT tCASE Expression tNL CaseClausules tEND tSELECT + | tSELECT tCASE Expression StSep CaseClausules tEND tSELECT { $$ = new_select_statement(ctx, $3, $5); } MemberExpression @@ -273,8 +273,8 @@ Else_opt CaseClausules : /* empty */ { $$ = NULL; } - | tCASE tELSE tNL StatementsNl { $$ = new_case_clausule(ctx, NULL, $4, NULL); } - | tCASE ExpressionList tNL StatementsNl_opt CaseClausules + | tCASE tELSE StSep StatementsNl { $$ = new_case_clausule(ctx, NULL, $4, NULL); } + | tCASE ExpressionList StSep StatementsNl_opt CaseClausules { $$ = new_case_clausule(ctx, $2, $4, $5); } Arguments_opt @@ -442,6 +442,12 @@ ArgumentDecl Identifier : tIdentifier { $$ = $1; } | tPROPERTY { $$ = propertyW; } + +/* Some statements accept both new line and ':' as a separator */ +StSep + : tNL + | ':' + %% static int parser_error(parser_ctx_t *ctx, const char *str) diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 46b34c4f00b..374a9863cc2 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -224,6 +224,10 @@ if false then x = y : if true then call ok(false, "embedded if called") if false then x=1 else x=2 end if +x = false +if false then x = true : x = true +Call ok(x = false, "x <> false") + if false then ok false, "if false called" end if @@ -538,6 +542,22 @@ end select select case 0 end select +x = false +select case 2 + case 3,1,2,4: x = true + case 5,6,7 + Call ok(false, "unexpected case") +end select +Call ok(x, "wrong case") + +x = false +select case 2: case 5,6,7: Call ok(false, "unexpected case") + case 2,1,2,4 + x = true + case else: Call ok(false, "unexpected case else") +end select +Call ok(x, "wrong case") + if false then Sub testsub x = true