jscript: Fixed keywords handling.

This commit is contained in:
Piotr Caban 2009-08-23 23:38:06 +02:00 committed by Alexandre Julliard
parent 03a3207cc7
commit 7701acc269
2 changed files with 9 additions and 6 deletions

View File

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

View File

@ -898,4 +898,6 @@ ok((function (){return 1;})() === 1, "(function (){return 1;})() = " + (function
ok(createNullBSTR() === '', "createNullBSTR() !== ''");
function do_test() {}
reportSuccess();