glcpp: Handle missing newline at EOF.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 16 Jun 2010 19:53:19 +0000 (12:53 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 21 Jun 2010 18:31:55 +0000 (11:31 -0700)
Fixes CorrectFuncOverload.vert.

glcpp/glcpp-lex.l

index c28f2f6..933d9f4 100644 (file)
@@ -33,6 +33,8 @@
 %option extra-type="glcpp_parser_t *"
 %option prefix="glcpp_"
 
+%x DONE
+
 SPACE          [[:space:]]
 NONSPACE       [^[:space:]]
 NEWLINE                [\n]
@@ -207,6 +209,13 @@ NON_STARS_THEN_STARS       [^*]*[*]+
        return NEWLINE;
 }
 
+       /* Handle missing newline at EOF. */
+<INITIAL><<EOF>> {
+       BEGIN DONE; /* Don't keep matching this rule forever. */
+       yyextra->lexing_if = 0;
+       return NEWLINE;
+}
+
 %%
 
 void