summaryrefslogtreecommitdiff
path: root/glcpp-lex.l
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2010-05-26 09:32:12 -0700
committerCarl Worth <cworth@cworth.org>2010-05-26 09:32:12 -0700
commit8fed1cddae8b024972d0c08f120bfd0292cb9cca (patch)
treef4e4fdca40c20c3aa78bad3d3913c8bd4806b264 /glcpp-lex.l
parentad0dee6bb0f197b9addb45f38e8843d6a504723c (diff)
stash
Diffstat (limited to 'glcpp-lex.l')
-rw-r--r--glcpp-lex.l40
1 files changed, 40 insertions, 0 deletions
diff --git a/glcpp-lex.l b/glcpp-lex.l
index 516f42d..97f01d0 100644
--- a/glcpp-lex.l
+++ b/glcpp-lex.l
@@ -62,11 +62,47 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
return HASH_UNDEF;
}
+{HASH}if {
+ yyextra->space_tokens = 0;
+ return HASH_IF;
+}
+
+{HASH}elif {
+ yyextra->space_tokens = 0;
+ return HASH_ELIF;
+}
+
+{HASH}else {
+ yyextra->space_tokens = 0;
+ return HASH_ELSE;
+}
+
+{HASH}endif {
+ yyextra->space_tokens = 0;
+ return HASH_ENDIF;
+}
+
{HASH} {
yyextra->space_tokens = 0;
return HASH;
}
+{DECIMAL_INTEGER} {
+ yylval.ival = strtoll (yytext, NULL, 10);
+ return INTEGER;
+}
+
+{OCTAL_INTEGER} {
+ yylval.ival = strtoll (yytext + 1, NULL, 8);
+ return INTEGER;
+}
+
+{HEXADECIMAL_INTEGER} {
+ yylval.ival = strtoll (yytext + 2, NULL, 16);
+ return INTEGER;
+}
+
+
{IDENTIFIER} {
yylval.str = xtalloc_strdup (yyextra, yytext);
return IDENTIFIER;
@@ -108,6 +144,10 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
return PASTE;
}
+"defined" {
+ return DEFINED;
+}
+
{PUNCTUATION} {
return yytext[0];
}