vbscript: Allow colons at the end of first line of loops.

Signed-off-by: Dmitry Kislyuk <dimaki@rocketmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Kislyuk 2017-05-03 12:36:25 +02:00 committed by Alexandre Julliard
parent d23815827d
commit 4ecc00f6ff
2 changed files with 37 additions and 7 deletions

View File

@ -180,15 +180,15 @@ SimpleStatement
{ $1->args = $2; $$ = new_assign_statement(ctx, $1, $4); CHECK_ERROR; }
| tDIM DimDeclList { $$ = new_dim_statement(ctx, $2); CHECK_ERROR; }
| IfStatement { $$ = $1; }
| tWHILE Expression tNL StatementsNl_opt tWEND
| tWHILE Expression StSep StatementsNl_opt tWEND
{ $$ = new_while_statement(ctx, STAT_WHILE, $2, $4); CHECK_ERROR; }
| tDO DoType Expression tNL StatementsNl_opt tLOOP
| tDO DoType Expression StSep StatementsNl_opt tLOOP
{ $$ = new_while_statement(ctx, $2 ? STAT_WHILELOOP : STAT_UNTIL, $3, $5);
CHECK_ERROR; }
| tDO tNL StatementsNl_opt tLOOP DoType Expression
| tDO StSep StatementsNl_opt tLOOP DoType Expression
{ $$ = new_while_statement(ctx, $5 ? STAT_DOWHILE : STAT_DOUNTIL, $6, $3);
CHECK_ERROR; }
| tDO tNL StatementsNl_opt tLOOP { $$ = new_while_statement(ctx, STAT_DOWHILE, NULL, $3); CHECK_ERROR; }
| tDO StSep StatementsNl_opt tLOOP { $$ = new_while_statement(ctx, STAT_DOWHILE, NULL, $3); CHECK_ERROR; }
| FunctionDecl { $$ = new_function_statement(ctx, $1); CHECK_ERROR; }
| tEXIT tDO { $$ = new_statement(ctx, STAT_EXITDO, 0); CHECK_ERROR; }
| tEXIT tFOR { $$ = new_statement(ctx, STAT_EXITFOR, 0); CHECK_ERROR; }
@ -201,9 +201,9 @@ SimpleStatement
| tON tERROR tRESUME tNEXT { $$ = new_onerror_statement(ctx, TRUE); CHECK_ERROR; }
| tON tERROR tGOTO '0' { $$ = new_onerror_statement(ctx, FALSE); CHECK_ERROR; }
| tCONST ConstDeclList { $$ = new_const_statement(ctx, $2); CHECK_ERROR; }
| tFOR Identifier '=' Expression tTO Expression Step_opt tNL StatementsNl_opt tNEXT
| tFOR Identifier '=' Expression tTO Expression Step_opt StSep StatementsNl_opt tNEXT
{ $$ = new_forto_statement(ctx, $2, $4, $6, $7, $9); CHECK_ERROR; }
| tFOR tEACH Identifier tIN Expression tNL StatementsNl_opt tNEXT
| tFOR tEACH Identifier tIN Expression StSep StatementsNl_opt tNEXT
{ $$ = new_foreach_statement(ctx, $3, $5, $7); }
| tSELECT tCASE Expression StSep CaseClausules tEND tSELECT
{ $$ = new_select_statement(ctx, $3, $5); }

View File

@ -325,6 +325,11 @@ end if
while false
wend
x = 0
WHILE x < 3 : x = x + 1
Wend
Call ok(x = 3, "x not equal to 3")
x = false
y = false
do while not (x and y)
@ -343,6 +348,11 @@ do while true
ok false, "exit do didn't work"
loop
x = 0
Do While x < 2 : x = x + 1
Loop
Call ok(x = 2, "x not equal to 2")
x = false
y = false
do until x and y
@ -361,6 +371,11 @@ do until false
ok false, "exit do didn't work"
loop
x = 0
Do: :: x = x + 2
Loop Until x = 4
Call ok(x = 4, "x not equal to 4")
x = false
do
if x then exit do
@ -368,6 +383,14 @@ do
loop
call ok(x, "x is false after do..loop?")
x = 0
Do :If x = 6 Then
Exit Do
End If
x = x + 3
Loop
Call ok(x = 6, "x not equal to 6")
x = false
y = false
do
@ -451,6 +474,11 @@ for x = 5 to 8 step z
next
Call ok(y = "for7: 5 6 7 8", "y = " & y)
z = 0
For x = 10 To 18 Step 2 : : z = z + 1
Next
Call ok(z = 5, "z not equal to 5")
y = "for8:"
for x = 5 to 8
y = y & " " & x
@ -482,11 +510,13 @@ wend
Call collectionObj.reset()
y = 0
x = 10
for each x in collectionObj
z = 0
for each x in collectionObj : z = z + 2
y = y+1
Call ok(x = y, "x <> y")
next
Call ok(y = 3, "y = " & y)
Call ok(z = 6, "z = " & z)
Call ok(getVT(x) = "VT_EMPTY*", "getVT(x) = " & getVT(x))
Call collectionObj.reset()