vbscript: Parse decimal literals between -1 and 1 without 0 in front.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49820
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>
This commit is contained in:
Robert Wilhelm 2020-09-15 13:33:38 +02:00 committed by Alexandre Julliard
parent 4c99e3ef34
commit a31023a678
2 changed files with 12 additions and 2 deletions

View file

@ -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);

View file

@ -47,6 +47,8 @@ Call ok(56.789e-2 = 0.56789, "56.789e-2 <> 0.56789")
Call ok(1e-94938484 = 0, "1e-... <> 0")
Call ok(34e0 = 34, "34e0 <> 34")
Call ok(34E1 = 340, "34E0 <> 340")
Call ok(.5 = 0.5, ".5 <> 0.5")
Call ok(.5e1 = 5, ".5e1 <> 5")
Call ok(--1 = 1, "--1 = " & --1)
Call ok(-empty = 0, "-empty = " & (-empty))
Call ok(true = -1, "! true = -1")
@ -86,6 +88,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")