Module: wine Branch: master Commit: 56b31ba2e11ccc46584b0a1d96c27dd310d18eeb URL: http://source.winehq.org/git/wine.git/?a=commit;h=56b31ba2e11ccc46584b0a1d96...
Author: Dmitry Kislyuk dimaki@rocketmail.com Date: Fri Oct 6 16:27:44 2017 -0500
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
---
dlls/vbscript/parser.y | 6 ++++-- dlls/vbscript/tests/lang.vbs | 50 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-)
diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index 6b303ee..beb4e4c 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -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
%%
diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 23402cd..7f7c835 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -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