Jacek Caban : jscript: Added support for octal literals.

Alexandre Julliard julliard at winehq.org
Fri Jan 10 14:44:54 CST 2014


Module: wine
Branch: stable
Commit: 546b51c411c326ee932dbd7fdf6e3af8dbf7836f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=546b51c411c326ee932dbd7fdf6e3af8dbf7836f

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Nov  6 17:18:28 2013 +0100

jscript: Added support for octal literals.

(cherry picked from commit 4d9ea4b5635654cfcd65478a1cc47363ee1798ad)

---

 dlls/jscript/lex.c |   30 ++++++++++++++++++++++++++----
 1 file changed, 26 insertions(+), 4 deletions(-)

diff --git a/dlls/jscript/lex.c b/dlls/jscript/lex.c
index 54c8fcf..d6a0ba1 100644
--- a/dlls/jscript/lex.c
+++ b/dlls/jscript/lex.c
@@ -486,15 +486,37 @@ static int parse_numeric_literal(parser_ctx_t *ctx, literal_t **literal)
             return tNumericLiteral;
         }
 
+        if(isdigitW(*ctx->ptr)) {
+            unsigned base = 8;
+            const WCHAR *ptr;
+            double val = 0;
+
+            for(ptr = ctx->ptr; ptr < ctx->end && isdigitW(*ptr); ptr++) {
+                if(*ptr > '7') {
+                    base = 10;
+                    break;
+                }
+            }
+
+            do {
+                val = val*base + *ctx->ptr-'0';
+            }while(++ctx->ptr < ctx->end && isdigitW(*ctx->ptr));
+
+            /* FIXME: Do we need it here? */
+            if(ctx->ptr < ctx->end && (is_identifier_char(*ctx->ptr) || *ctx->ptr == '.')) {
+                WARN("wrong char after octal literal: '%c'\n", *ctx->ptr);
+                return lex_error(ctx, JS_E_MISSING_SEMICOLON);
+            }
+
+            *literal = new_double_literal(ctx, val);
+            return tNumericLiteral;
+        }
+
         if(is_identifier_char(*ctx->ptr)) {
             WARN("wrong char after zero\n");
             return lex_error(ctx, E_FAIL);
         }
 
-        if(isdigitW(*ctx->ptr)) {
-            FIXME("octal literals not implemented\n");
-            return lex_error(ctx, E_NOTIMPL);
-        }
     }
 
     return parse_double_literal(ctx, l, literal);




More information about the wine-cvs mailing list