Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35782 Signed-off-by: Robert Wilhelm robert.wilhelm@gmx.net --- dlls/vbscript/parser.y | 2 ++ dlls/vbscript/tests/lang.vbs | 6 ++++++ 2 files changed, 8 insertions(+)
diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index 71bea72b1b..ad606c1b26 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -221,6 +221,8 @@ 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 ':' SimpleStatement ':' tNEXT + { $$ = new_forto_statement(ctx, @$, $2, $4, $6, $7, $9); CHECK_ERROR; } | 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 StSep StatementsNl_opt tNEXT diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 94e2bbd436..5754292079 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -542,6 +542,12 @@ 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") + + do while true for x = 1 to 100 exit do -- 2.26.2
Hi Robert,
On 23.08.2020 08:59, Robert Wilhelm wrote:
- | tFOR Identifier '=' Expression tTO Expression Step_opt ':' SimpleStatement ':' tNEXT
{ $$ = new_forto_statement(ctx, @$, $2, $4, $6, $7, $9); CHECK_ERROR; }
I think that the root of the problem is deeper in how we handle statement separators. See the attached test for an example.
Thanks,
Jacek
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=77490
Your paranoid android.
=== build (build log) ===
error: patch failed: dlls/vbscript/tests/lang.vbs:547 Task: Patch failed to apply
=== debiant (build log) ===
error: patch failed: dlls/vbscript/tests/lang.vbs:547 Task: Patch failed to apply
=== debiant (build log) ===
error: patch failed: dlls/vbscript/tests/lang.vbs:547 Task: Patch failed to apply
Hi Jacek,
Thanks for reviewing my patch. I have attached new version which works with your testcase, too.
Robert
On Mon, 2020-08-24 at 12:04 +0200, Jacek Caban wrote:
Hi Robert,
On 23.08.2020 08:59, Robert Wilhelm wrote:
- | tFOR Identifier '=' Expression tTO Expression Step_opt ':'
SimpleStatement ':' tNEXT
{ $$ =
new_forto_statement(ctx, @$, $2, $4, $6, $7, $9); CHECK_ERROR; }
I think that the root of the problem is deeper in how we handle statement separators. See the attached test for an example.
Thanks,
Jacek
Hi Robert,
On 02.09.2020 22:26, Robert Wilhelm wrote:
Hi Jacek,
Thanks for reviewing my patch. I have attached new version which works with your testcase, too.
I think it may go in the right direction, but note that StatementNl is used in quite a few places. It would be good to test other cases as well. The patch also introduces a number of new shift/reduce and reduce/reduce warnings, which would be good to avoid.
Thanks,
Jacek
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35782 Signed-off-by: Robert Wilhelm robert.wilhelm@gmx.net --- v2: works with Jacek's testcase now. v3: no additional bison conflicts added testcases for different loops --- 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 71bea72b1b..80f8699bd8 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -178,8 +178,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 94e2bbd436..0d752121b2 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -345,6 +345,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 @@ -370,6 +374,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" @@ -380,6 +386,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 @@ -409,6 +419,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: :
@@ -542,6 +556,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 @@ -574,6 +598,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 -- 2.26.2
Signed-off-by: Jacek Caban jacek@codeweavers.com