Commit a31023a6 authored by Robert Wilhelm's avatar Robert Wilhelm Committed by Alexandre Julliard

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

parent 4c99e3ef
......@@ -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);
......
......@@ -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")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment