diff options
author | Carl Worth <cworth@cworth.org> | 2010-05-26 09:35:34 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2010-05-26 09:37:14 -0700 |
commit | 16c1e980e2e3c8852ce9bea85afe094c24e420fa (patch) | |
tree | b358b1fb120a5d802b97b7d323514531054d1636 | |
parent | f6914fd37b2b66d7be1ba0c31450d89d1785ccce (diff) |
Fix lexing of "defined" as an operator, not an identifier.
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.
-rw-r--r-- | glcpp-lex.l | 11 | ||||
-rw-r--r-- | tests/053-if-divide-and-shift.c | 1 |
2 files changed, 5 insertions, 7 deletions
diff --git a/glcpp-lex.l b/glcpp-lex.l index 97f01d0..d6b7726 100644 --- a/glcpp-lex.l +++ b/glcpp-lex.l @@ -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]; } diff --git a/tests/053-if-divide-and-shift.c b/tests/053-if-divide-and-shift.c index ddc1573..d24c54a 100644 --- a/tests/053-if-divide-and-shift.c +++ b/tests/053-if-divide-and-shift.c @@ -13,4 +13,3 @@ failure_3 #else success_3 #endif - |