Commit 56b31ba2 authored by Dmitry Kislyuk's avatar Dmitry Kislyuk Committed by Alexandre Julliard

vbscript: Improve parsing of separators in loops and switches.

parent adda5aa6
......@@ -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
%%
......
......@@ -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
......@@ -509,6 +536,14 @@ 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
z = 0
for each x in collectionObj : z = z + 2
......@@ -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
......
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