summaryrefslogtreecommitdiff
path: root/glcpp-lex.l
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2010-05-27 14:36:29 -0700
committerCarl Worth <cworth@cworth.org>2010-05-27 14:38:20 -0700
commit050e3ded1ea05cfe336dd0cd20212d17d7960c9e (patch)
tree55a4e25d0c1c5eb3995e2efd9cbad1c6e7e496ec /glcpp-lex.l
parent85b50e840d969c4d9ebcfcc3df1df7a95e07e34e (diff)
Implement token pasting of integers.
To do this correctly, we change the lexer to lex integers as string values, (new token type of INTEGER_STRING), and only convert to integer values when evaluating an expression value. Add a new test case for this, (which does pass now).
Diffstat (limited to 'glcpp-lex.l')
-rw-r--r--glcpp-lex.l12
1 files changed, 6 insertions, 6 deletions
diff --git a/glcpp-lex.l b/glcpp-lex.l
index d6b7726d36..70d47d2497 100644
--- a/glcpp-lex.l
+++ b/glcpp-lex.l
@@ -88,18 +88,18 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
}
{DECIMAL_INTEGER} {
- yylval.ival = strtoll (yytext, NULL, 10);
- return INTEGER;
+ yylval.str = xtalloc_strdup (yyextra, yytext);
+ return INTEGER_STRING;
}
{OCTAL_INTEGER} {
- yylval.ival = strtoll (yytext + 1, NULL, 8);
- return INTEGER;
+ yylval.str = xtalloc_strdup (yyextra, yytext);
+ return INTEGER_STRING;
}
{HEXADECIMAL_INTEGER} {
- yylval.ival = strtoll (yytext + 2, NULL, 16);
- return INTEGER;
+ yylval.str = xtalloc_strdup (yyextra, yytext);
+ return INTEGER_STRING;
}
"<<" {