From: Francis De Brabandere <francisdb@gmail.com> Native VBScript treats a dot directly followed by a digit as the start of a numeric literal even right after an identifier or closing bracket, so obj.Method.5 parses as a call with argument 0.5. --- dlls/vbscript/lex.c | 8 +++++--- dlls/vbscript/tests/lang.vbs | 11 +++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dlls/vbscript/lex.c b/dlls/vbscript/lex.c index db1b8b7b355..ef20604c8db 100644 --- a/dlls/vbscript/lex.c +++ b/dlls/vbscript/lex.c @@ -534,7 +534,12 @@ static int parse_next_token(void *lval, unsigned *loc, parser_ctx_t *ctx) * We need to distinguish between '.' used as part of a member expression and * a beginning of a dot expression (a member expression accessing with statement * expression) and a floating point number like ".2" . + * + * A dot immediately followed by a digit is always a numeric literal, even + * right after an identifier: obj.method.5 parses as obj.method(0.5). */ + if('0' <= ctx->ptr[1] && ctx->ptr[1] <= '9') + return parse_numeric_literal(ctx, lval); c = ctx->ptr > ctx->code ? ctx->ptr[-1] : '\n'; if (is_identifier_char(c) || c == ')') { ctx->ptr++; @@ -548,9 +553,6 @@ static int parse_next_token(void *lval, unsigned *loc, parser_ctx_t *ctx) ctx->ptr++; return '.'; } - c = ctx->ptr[1]; - if('0' <= c && c <= '9') - return parse_numeric_literal(ctx, lval); ctx->ptr++; return tDOT; case '-': diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index acdd992cbcf..3c7dbdaa8e3 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -1907,6 +1907,17 @@ Set npObj = New NpCls CheckNpS "npObj.Check(10)+5", 15 CheckNpS "npObj.Check(10)*3", 30 +' A dot immediately followed by a digit is a numeric literal, not member access. +CheckNpS "NpS.5", 0.5 +CheckNpS "NpS.0", 0 +CheckNpS "NpS.5E1", 5 +CheckNpS "npObj.Check.5", 0.5 +CheckNpS "npObj.Check.0", 0 +CheckNpS "With npObj : .Check.5 : End With", 0.5 +CheckNpT "NpT.5,.25", 0.5, 0.25 +NpS.5 +Call ok(getVT(npArg) = "VT_R8*", "NpS.5: getVT(npArg) = " & getVT(npArg)) + Function ParenId(a) ParenId = a End Function -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11120