[PATCH] vbscript: parse decimal literals between -1 and 1 without 0 in front.

Robert Wilhelm robert.wilhelm at gmx.net
Tue Sep 15 00:33:20 CDT 2020


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49820
Signed-off-by: Robert Wilhelm <robert.wilhelm at gmx.net>
---
 dlls/vbscript/lex.c          | 11 +++++++++--
 dlls/vbscript/tests/lang.vbs |  1 +
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/dlls/vbscript/lex.c b/dlls/vbscript/lex.c
index 5b93739d02..251374d90e 100644
--- a/dlls/vbscript/lex.c
+++ b/dlls/vbscript/lex.c
@@ -393,11 +393,18 @@ 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).
+         * expression) and a floating point number like ".2" .
          */
         c = ctx->ptr > ctx->code ? ctx->ptr[-1] : '\n';
+        if (is_identifier_char(c) || c == ')') {
+            ctx->ptr++;
+            return '.';
+        }
+        c = ctx->ptr[1];
+        if('0' <= c && c <= '9')
+            return parse_numeric_literal(ctx, lval);
         ctx->ptr++;
-        return is_identifier_char(c) || c == ')' ? '.' : tDOT;
+        return tDOT;
     case '-':
         if(ctx->is_html && ctx->ptr[1] == '-' && ctx->ptr[2] == '>')
             return comment_line(ctx);
diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs
index 0d752121b2..85931152cb 100644
--- a/dlls/vbscript/tests/lang.vbs
+++ b/dlls/vbscript/tests/lang.vbs
@@ -86,6 +86,7 @@ Call ok(getVT(null) = "VT_NULL", "getVT(null) is not VT_NULL")
 Call ok(getVT(0) = "VT_I2", "getVT(0) is not VT_I2")
 Call ok(getVT(1) = "VT_I2", "getVT(1) is not VT_I2")
 Call ok(getVT(0.5) = "VT_R8", "getVT(0.5) is not VT_R8")
+Call ok(getVT(.5) = "VT_R8", "getVT(.5) is not VT_R8")
 Call ok(getVT(0.0) = "VT_R8", "getVT(0.0) is not VT_R8")
 Call ok(getVT(2147483647) = "VT_I4", "getVT(2147483647) is not VT_I4")
 Call ok(getVT(2147483648) = "VT_R8", "getVT(2147483648) is not VT_R8")
--
2.26.2





More information about the wine-devel mailing list