Fix lexing of "defined" as an operator, not an identifier.
authorCarl Worth <cworth@cworth.org>
Wed, 26 May 2010 16:35:34 +0000 (09:35 -0700)
committerCarl Worth <cworth@cworth.org>
Wed, 26 May 2010 16:37:14 +0000 (09:37 -0700)
Simply need to move the rule for IDENTIFIER to be after "defined" and
everything is happy.

With this change, tests 50 through 53 all pass now.

glcpp-lex.l
tests/053-if-divide-and-shift.c

index 97f01d0..d6b7726 100644 (file)
@@ -102,12 +102,6 @@ HEXADECIMAL_INTEGER        0[xX][0-9a-fA-F]+[uU]?
        return INTEGER;
 }
 
-
-{IDENTIFIER} {
-       yylval.str = xtalloc_strdup (yyextra, yytext);
-       return IDENTIFIER;
-}
-
 "<<"  {
        return LEFT_SHIFT;
 }
@@ -148,6 +142,11 @@ HEXADECIMAL_INTEGER        0[xX][0-9a-fA-F]+[uU]?
        return DEFINED;
 }
 
+{IDENTIFIER} {
+       yylval.str = xtalloc_strdup (yyextra, yytext);
+       return IDENTIFIER;
+}
+
 {PUNCTUATION} {
        return yytext[0];
 }