vbscript: Improve parsing of separators in loops and switches.

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-10-06 16:27:44 -05:00 committed by Alexandre Julliard
parent adda5aa635
commit 56b31ba2e1
2 changed files with 54 additions and 2 deletions

View File

@ -164,7 +164,7 @@ StatementsNl
| StatementNl StatementsNl { $$ = link_statements($1, $2); }
StatementNl
: Statement tNL { $$ = $1; }
: Statement tNL { $$ = $1; }
Statement
: ':' { $$ = NULL; }
@ -448,10 +448,12 @@ Identifier
: tIdentifier { $$ = $1; }
| tPROPERTY { $$ = propertyW; }
/* Some statements accept both new line and ':' as a separator */
/* Most statements accept both new line and ':' as separators */
StSep
: tNL
| ':'
| tNL StSep
| ':' StSep
%%

View File

@ -330,6 +330,13 @@ WHILE x < 3 : x = x + 1
Wend
Call ok(x = 3, "x not equal to 3")
z = 2
while z > -4 :
z = z -2
wend
x = false
y = false
do while not (x and y)
@ -353,6 +360,12 @@ Do While x < 2 : x = x + 1
Loop
Call ok(x = 2, "x not equal to 2")
x = 0
Do While x >= -2 :
x = x - 1
Loop
Call ok(x = -3, "x not equal to -3")
x = false
y = false
do until x and y
@ -376,6 +389,14 @@ Do: :: x = x + 2
Loop Until x = 4
Call ok(x = 4, "x not equal to 4")
x = 5
Do: :
: x = x * 2
Loop Until x = 40
Call ok(x = 40, "x not equal to 40")
x = false
do
if x then exit do
@ -495,6 +516,12 @@ for x = 1 to 100
Call ok(false, "exit for not escaped the loop?")
next
for x = 1 to 5 :
:
: :exit for
Call ok(false, "exit for not escaped the loop?")
next
do while true
for x = 1 to 100
exit do
@ -507,6 +534,14 @@ while null
call ok(false, "while null evaluated")
wend
Call collectionObj.reset()
y = 0
for each x in collectionObj :
:y = y + 3
next
Call ok(y = 9, "y = " & y)
Call collectionObj.reset()
y = 0
x = 10
@ -611,6 +646,21 @@ select case 2: case 5,6,7: Call ok(false, "unexpected case")
end select
Call ok(x, "wrong case")
x = False
select case 1 :
:case 3, 4 :
case 5
:
Call ok(false, "unexpected case") :
Case Else:
x = True
end select
Call ok(x, "wrong case")
if false then
Sub testsub
x = true