summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--glcpp/glcpp-lex.l9
1 files changed, 9 insertions, 0 deletions
diff --git a/glcpp/glcpp-lex.l b/glcpp/glcpp-lex.l
index c28f2f6269..933d9f449a 100644
--- a/glcpp/glcpp-lex.l
+++ b/glcpp/glcpp-lex.l
@@ -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