From 7701acc26906efc81881373d35d4a955f28e375f Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Sun, 23 Aug 2009 23:38:06 +0200 Subject: [PATCH] jscript: Fixed keywords handling. --- dlls/jscript/lex.c | 13 +++++++------ dlls/jscript/tests/lang.js | 2 ++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dlls/jscript/lex.c b/dlls/jscript/lex.c index eb9b83536be..1b33737eeba 100644 --- a/dlls/jscript/lex.c +++ b/dlls/jscript/lex.c @@ -105,6 +105,12 @@ static int lex_error(parser_ctx_t *ctx, HRESULT hres) return -1; } +/* ECMA-262 3rd Edition 7.6 */ +static BOOL is_identifier_char(WCHAR c) +{ + return isalnumW(c) || c == '$' || c == '_' || c == '\\'; +} + static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lval) { const WCHAR *p1 = ctx->ptr; @@ -117,7 +123,7 @@ static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lva p2++; } - if(*p2 || (p1 < ctx->end && isalnumW(*p1))) + if(*p2 || (p1 < ctx->end && is_identifier_char(*p1))) return 1; *lval = ctx->ptr; @@ -131,11 +137,6 @@ static BOOL is_endline(WCHAR c) return c == '\n' || c == '\r' || c == 0x2028 || c == 0x2029; } -static BOOL is_identifier_char(WCHAR c) -{ - return isalnumW(c) || c == '$' || c == '_' || c == '\\'; -} - static int hex_to_int(WCHAR c) { if('0' <= c && c <= '9') diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js index 8150d65da86..fa100ea6d55 100644 --- a/dlls/jscript/tests/lang.js +++ b/dlls/jscript/tests/lang.js @@ -898,4 +898,6 @@ ok((function (){return 1;})() === 1, "(function (){return 1;})() = " + (function ok(createNullBSTR() === '', "createNullBSTR() !== ''"); +function do_test() {} + reportSuccess();