Module: wine Branch: oldstable Commit: 1f9d0114d704e80464f611cfeb8a6cde126536aa URL: https://source.winehq.org/git/wine.git/?a=commit;h=1f9d0114d704e80464f611cfe...
Author: Robert Wilhelm robert.wilhelm@gmx.net Date: Mon Sep 7 21:46:38 2020 +0200
vbscript: Colon used in for loop.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35782 Signed-off-by: Robert Wilhelm robert.wilhelm@gmx.net Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org (cherry picked from commit 5adbabe90c255f925738f8cec6c52d57a1feaeb4) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
dlls/vbscript/parser.y | 4 ++-- dlls/vbscript/tests/lang.vbs | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index e5f436bf6db..9a395f94961 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -176,8 +176,8 @@ StatementsNl_opt | StatementsNl { $$ = $1; }
StatementsNl - : StatementNl { $$ = $1; } - | StatementNl StatementsNl { $$ = link_statements($1, $2); } + : SimpleStatement StSep { $$ = $1; } + | SimpleStatement StSep StatementsNl { $$ = link_statements($1, $3); }
StatementNl : Statement tNL { $$ = $1; } diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index eeab0bc5787..570b5befeaa 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -337,6 +337,10 @@ while empty ok false, "while empty executed" wend
+x = 0 +WHILE x < 3 : x = x + 1 : Wend +Call ok(x = 3, "x not equal to 3") + x = 0 WHILE x < 3 : x = x + 1 Wend @@ -362,6 +366,8 @@ call ok((x and y), "x or y is false after while") do while false loop
+do while false : loop + do while true exit do ok false, "exit do didn't work" @@ -372,6 +378,10 @@ 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 = 2, "x not equal to 2") + x = 0 Do While x >= -2 : x = x - 1 @@ -401,6 +411,10 @@ Do: :: x = x + 2 Loop Until x = 4 Call ok(x = 4, "x not equal to 4")
+x = 0 +Do: :: x = x + 2 ::: : Loop Until x = 4 +Call ok(x = 4, "x not equal to 4") + x = 5 Do: :
@@ -534,6 +548,16 @@ for x = 1 to 5 : Call ok(false, "exit for not escaped the loop?") next
+dim a1(8) +a1(6)=8 +for x=1 to 8:a1(x)=x-1:next +Call ok(a1(6) = 5, "colon used in for loop") + +a1(6)=8 +for x=1 to 8:y=1 +a1(x)=x-2:next +Call ok(a1(6) = 4, "colon used in for loop") + do while true for x = 1 to 100 exit do @@ -566,6 +590,15 @@ 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() +y = 0 +x = 10 +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 collectionObj.reset() y = false for each x in collectionObj