glcpp: Actually support #ifdef and #ifndef.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 17 Jun 2010 21:36:34 +0000 (14:36 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 21 Jun 2010 18:31:55 +0000 (11:31 -0700)
Strangely, the lexer never created these tokens, even though the parser
already had code to handle them.

glcpp/glcpp-lex.l

index 06bde3f1957e003ca6c995dc63fdcc8d351db095..a04e0fabdf8772b359376381acb491f3586da1f7 100644 (file)
@@ -70,6 +70,16 @@ NON_STARS_THEN_STARS [^*]*[*]+
        return OTHER;
 }
 
+{HASH}ifdef/.*\n {
+       yyextra->space_tokens = 0;
+       return HASH_IFDEF;
+}
+
+{HASH}ifndef/.*\n {
+       yyextra->space_tokens = 0;
+       return HASH_IFNDEF;
+}
+
 {HASH}if/.*\n {
        yyextra->lexing_if = 1;
        yyextra->space_tokens = 0;