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 97f01d06368d5403d697795d07535a3c40b55f27..d6b7726d36dec9dbf7a768cfec1e2e54faa6d3c1 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];
 }
index ddc1573ab268348a6a2e9c7c420df30c6d04b23f..d24c54a88d147af62eca415193b2377cc84a1be6 100644 (file)
@@ -13,4 +13,3 @@ failure_3
 #else
 success_3
 #endif
-