mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 14:44:57 +00:00
vbscript: Handle "case" statements without separators.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53678 Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
4979ae5a94
commit
39058487ec
|
@ -324,9 +324,8 @@ Else_opt
|
||||||
|
|
||||||
CaseClausules
|
CaseClausules
|
||||||
: /* empty */ { $$ = NULL; }
|
: /* empty */ { $$ = NULL; }
|
||||||
| tCASE tELSE StSep StatementsNl_opt { $$ = new_case_clausule(ctx, NULL, $4, NULL); }
|
| tCASE tELSE StSep_opt StatementsNl_opt { $$ = new_case_clausule(ctx, NULL, $4, NULL); }
|
||||||
| tCASE ExpressionList StSep StatementsNl_opt CaseClausules
|
| tCASE ExpressionList StSep_opt StatementsNl_opt CaseClausules { $$ = new_case_clausule(ctx, $2, $4, $5); }
|
||||||
{ $$ = new_case_clausule(ctx, $2, $4, $5); }
|
|
||||||
|
|
||||||
Arguments
|
Arguments
|
||||||
: tEMPTYBRACKETS { $$ = NULL; }
|
: tEMPTYBRACKETS { $$ = NULL; }
|
||||||
|
@ -513,6 +512,10 @@ Identifier
|
||||||
| tPROPERTY { ctx->last_token = tIdentifier; $$ = $1; }
|
| tPROPERTY { ctx->last_token = tIdentifier; $$ = $1; }
|
||||||
| tSTEP { ctx->last_token = tIdentifier; $$ = $1; }
|
| tSTEP { ctx->last_token = tIdentifier; $$ = $1; }
|
||||||
|
|
||||||
|
StSep_opt
|
||||||
|
: /* empty */
|
||||||
|
| StSep
|
||||||
|
|
||||||
/* Most statements accept both new line and ':' as separators */
|
/* Most statements accept both new line and ':' as separators */
|
||||||
StSep
|
StSep
|
||||||
: tNL
|
: tNL
|
||||||
|
|
|
@ -766,6 +766,26 @@ end select
|
||||||
|
|
||||||
select case 0 : case 1 : case else : 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
|
if false then
|
||||||
Sub testsub
|
Sub testsub
|
||||||
x = true
|
x = true
|
||||||
|
|
Loading…
Reference in a new issue