]> git.mxchange.org Git - simgear.git/blobdiff - simgear/nasal/lex.c
cppbind.Ghost: clean up a bit
[simgear.git] / simgear / nasal / lex.c
index a3c1ffc699aa39e6001cbf7185b894f6725a145b..b0dcf5f32f738fbec6089442fcccbd540fb889d6 100644 (file)
@@ -134,7 +134,8 @@ static void newToken(struct Parser* p, int pos, int type,
     tok->prev = last;
     tok->children = 0;
     tok->lastChild = 0;
-
+    tok->rule = 0;
+    
     // Context sensitivity hack: a "-" following a binary operator of
     // equal or higher precedence must be a unary negation.  Needed to
     // get precedence right in the parser for expressiong like "a * -2"
@@ -257,6 +258,7 @@ static int lexHexLiteral(struct Parser* p, int index)
 }
 
 #define ISNUM(c) ((c) >= '0' && (c) <= '9')
+#define ISHEX(c) (ISNUM(c) || ((c)>='a' && (c)<='f') || ((c)>='A' && (c)<='F'))
 #define NUMSTART(c) (ISNUM(c) || (c) == '+' || (c) == '-')
 static int lexNumLiteral(struct Parser* p, int index)
 {
@@ -264,7 +266,7 @@ static int lexNumLiteral(struct Parser* p, int index)
     unsigned char* buf = (unsigned char*)p->buf;
     double d;
 
-    if(buf[i] == '0' && i+2<len && buf[i+1] == 'x' && ISNUM(buf[i+2]))
+    if(buf[i] == '0' && i+2<len && buf[i+1] == 'x' && ISHEX(buf[i+2]))
        return lexHexLiteral(p, index+2);
 
     while(i<len && ISNUM(buf[i])) i++;