I ran into some scripts with the following code:
``` DMD CL(0, "HIGHSCORES"), "1> " &HighScoreName(0) & " " &FormatScore(HighScore(0)), "", eNone, eScrollLeft, eNone, 2000, False, "" ```
When there is no space after `&` the `H` in the `HighScoreName` variable is making the parser think it's a hex value.
In real vbscript I tried the following:
``` Dim hescore hescore = "WOW" WScript.echo "" &hescore & &h02 ``` Syntax error
``` Dim h1score h1score = "WOW" WScript.echo "" &h1score & &h02 ``` Syntax error
``` Dim hiscore hiscore = "WOW" WScript.echo "" &hiscore & &h02 ``` WOW2
So it looks like it's checking the next character after the `h` to see if it's a valid hex character.
I believe this MR fixes this case and continues to support the test case:
``` Call ok((&h01or&h02)=3,"&h01or&h02 <> 3") ```
From: Jason Millard jsm174@gmail.com
--- dlls/vbscript/lex.c | 2 +- dlls/vbscript/tests/lang.vbs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/vbscript/lex.c b/dlls/vbscript/lex.c index 38ee4a5fd4b..8c5c69ea429 100644 --- a/dlls/vbscript/lex.c +++ b/dlls/vbscript/lex.c @@ -473,7 +473,7 @@ static int parse_next_token(void *lval, unsigned *loc, parser_ctx_t *ctx) case '#': return parse_date_literal(ctx, lval); case '&': - if(*++ctx->ptr == 'h' || *ctx->ptr == 'H') + if((*++ctx->ptr == 'h' || *ctx->ptr == 'H') && hex_to_int(ctx->ptr[1]) != -1) return parse_hex_literal(ctx, lval); return '&'; case '=': diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 1707cc9a92b..e28d82360d9 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -18,7 +18,7 @@
OPTION EXPLICIT : : DIM W
-dim x, y, z, e +dim x, y, z, e, hi Dim obj
call ok(true, "true is not true?") @@ -62,6 +62,11 @@ Call ok(&hfffe& = 65534, "&hfffe& <> -2") Call ok(&hffffffff& = -1, "&hffffffff& <> -1") Call ok((&h01or&h02)=3,"&h01or&h02 <> 3")
+' Test concat when no space and var begins with h +hi = "x" +x = "y" &hi +Call ok(x = "xy", "x = " & x & " expected ""xy""") + W = 5 Call ok(W = 5, "W = " & W & " expected " & 5)
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=129460
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== w7u_adm (32 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== w7u_el (32 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== w8 (32 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== w8adm (32 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== w864 (32 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== w1064v1507 (32 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== w1064v1809 (32 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== w1064_tsign (32 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== w10pro64 (32 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== w864 (64 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== w1064v1507 (64 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== w1064v1809 (64 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== w1064_2qxl (64 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== w1064_adm (64 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== w1064_tsign (64 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== w10pro64 (64 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== w10pro64_en_AE_u8 (64 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== w10pro64_ar (64 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== w10pro64_ja (64 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== w10pro64_zh_CN (64 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== debian11 (32 bit report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== debian11 (32 bit ar:MA report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== debian11 (32 bit de report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== debian11 (32 bit fr report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== debian11 (32 bit he:IL report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== debian11 (32 bit hi:IN report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== debian11 (32 bit ja:JP report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== debian11 (32 bit zh:CN report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== debian11b (32 bit WoW report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""
=== debian11b (64 bit WoW report) ===
vbscript: run.c:1214: Test failed: lang.vbs: L"x = yx expected "xy""