summaryrefslogtreecommitdiff
path: root/glcpp-lex.l
diff options
context:
space:
mode:
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 516f42dee3..97f01d0636 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];
}