From 13c0bc9b5a54b76930ce6a50157fbfe765832c87 Mon Sep 17 00:00:00 2001 From: Gavan Fantom Date: Sun, 29 Apr 2007 14:35:50 +0000 Subject: [PATCH] Support hexadecimal numbers --- src/lsc/lexer.l | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lsc/lexer.l b/src/lsc/lexer.l index 898288d..6322671 100644 --- a/src/lsc/lexer.l +++ b/src/lsc/lexer.l @@ -105,6 +105,8 @@ return return TOKRETURN; [0-9]+ yylval.Tinteger = atoi(yytext); return NUMBER; -[0-9]+ yylval.Tinteger = atoi(yytext); return NUMBER; +0x[0-9]+ yylval.Tinteger = strtol(yytext+2, (char **)NULL, 16); return NUMBER; +-0x[0-9]+ yylval.Tinteger = strtol(yytext+2, (char **)NULL, 16); return NUMBER; [0-9]+\.[0-9]+ yylval.Treal = atof(yytext); return REAL; -[0-9]+\.[0-9]+ yylval.Treal = atof(yytext); return REAL; [_a-zA-Z0-9]+ yylval.Tstring = strdup(yytext); return IDENTIFIER;