Piotr Caban : jscript: Fixed keywords handling.

Alexandre Julliard julliard at winehq.org
Mon Aug 24 10:08:25 CDT 2009


Module: wine
Branch: master
Commit: 7701acc26906efc81881373d35d4a955f28e375f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7701acc26906efc81881373d35d4a955f28e375f

Author: Piotr Caban <piotr.caban at gmail.com>
Date:   Sun Aug 23 23:38:06 2009 +0200

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 eb9b835..1b33737 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 8150d65..fa100ea 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();




More information about the wine-cvs mailing list