From 76eeca22552aa35b3c09b0c3dafb5a6d01abed14 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 18 Oct 2011 12:36:03 +0200 Subject: [PATCH] vbscript: Added support for hex literals not ending with '&'. --- dlls/vbscript/lex.c | 6 ++++-- dlls/vbscript/tests/lang.vbs | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/vbscript/lex.c b/dlls/vbscript/lex.c index 08ab375f73d..81d451752bb 100644 --- a/dlls/vbscript/lex.c +++ b/dlls/vbscript/lex.c @@ -294,12 +294,14 @@ static int parse_hex_literal(parser_ctx_t *ctx, LONG *ret) while((d = hex_to_int(*++ctx->ptr)) != -1) l = l*16 + d; - if(begin + 9 /* max digits+1 */ < ctx->ptr || *ctx->ptr != '&') { + if(begin + 9 /* max digits+1 */ < ctx->ptr || (*ctx->ptr != '&' && is_identifier_char(*ctx->ptr))) { FIXME("invalid literal\n"); return 0; } - ctx->ptr++; + if(*ctx->ptr == '&') + ctx->ptr++; + *ret = l; return (short)l == l ? tShort : tLong; } diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index de72338968e..ec552b1943a 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -43,6 +43,8 @@ Call ok(--1 = 1, "--1 = " & --1) Call ok(-empty = 0, "-empty = " & (-empty)) Call ok(true = -1, "! true = -1") Call ok(false = 0, "false <> 0") +Call ok(&hff = 255, "&hff <> 255") +Call ok(&Hff = 255, "&Hff <> 255") x = "xx" Call ok(x = "xx", "x = " & x & " expected ""xx""")