summaryrefslogtreecommitdiff
path: root/glcpp-lex.l
diff options
context:
space:
mode:
Diffstat (limited to 'glcpp-lex.l')
-rw-r--r--glcpp-lex.l19
1 files changed, 18 insertions, 1 deletions
diff --git a/glcpp-lex.l b/glcpp-lex.l
index ec91538a73..9ec4deb718 100644
--- a/glcpp-lex.l
+++ b/glcpp-lex.l
@@ -33,7 +33,7 @@
%option extra-type="glcpp_parser_t *"
%x ST_DEFINE
-%x ST_DEFVAL
+%x ST_UNDEF
SPACE [[:space:]]
NONSPACE [^[:space:]]
@@ -67,6 +67,23 @@ TOKEN {NONSPACE}+
<ST_DEFINE>{SPACE}+
+{HASH}undef{HSPACE}* {
+ BEGIN ST_UNDEF;
+ return UNDEF;
+}
+
+<ST_UNDEF>{IDENTIFIER} {
+ yylval.str = xtalloc_strdup (yyextra, yytext);
+ return IDENTIFIER;
+}
+
+<ST_UNDEF>\n {
+ BEGIN INITIAL;
+ return NEWLINE;
+}
+
+<ST_UNDEF>{SPACE}+
+
/* Anything we don't specifically recognize is a stream of tokens */
{NONSPACE}+ {
yylval.str = xtalloc_strdup (yyextra, yytext);