From f8b6a246efbd3658c6185d43054df118f6c69866 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 19 Jul 2022 15:17:00 +0100 Subject: [PATCH] Add in lexer.l capability to scan negative decimal integers or reals --- src/lexer.l | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/lexer.l b/src/lexer.l index e392324a..f2f4b2ce 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -57,12 +57,9 @@ SIGN [+-] %% -#{SIGN}*{DIGIT}+ { yylval = number(yytext); return TKN_NUMBER; } -#{SIGN}*{DIGIT}+"."{DIGIT}* { yylval = number_real(yytext); return TKN_NUMBER_REAL; } -#{SIGN}*"."{DIGIT}* { yylval = number_real(yytext); return TKN_NUMBER_REAL; } -{DIGIT}+ { yylval = number(yytext); return TKN_NUMBER; } -{DIGIT}+"."{DIGIT}* { yylval = number_real(yytext); return TKN_NUMBER_REAL; } -"."{DIGIT}+ { yylval = number_real(yytext); return TKN_NUMBER_REAL; } +{SIGN}?{DIGIT}+ { yylval = number(yytext); return TKN_NUMBER; } +{SIGN}?{DIGIT}+"."{DIGIT}* { yylval = number_real(yytext); return TKN_NUMBER_REAL; } +{SIGN}?"."{DIGIT}+ { yylval = number_real(yytext); return TKN_NUMBER_REAL; } "\"" { string_buf_ptr = string_buf; BEGIN(strng); }