scan real numbers

This commit is contained in:
Yuichi Nishiwaki 2013-10-15 23:25:31 +09:00
parent 0515b8ba2a
commit 7f04cad34d
1 changed files with 5 additions and 3 deletions

View File

@ -19,7 +19,9 @@ struct parser_control {
[ \t\n\r] /* skip whitespace */
"(" return tLPAREN;
")" return tRPAREN;
[1-9][0-9]* { yylval.datum = pic_float_value(atoi(yytext)); return tNUMBER; }
[0-9]+ { yylval.datum = pic_float_value(atoi(yytext)); return tNUMBER; }
\.[0-9]+ { yylval.datum = pic_float_value(atof(yytext)); return tNUMBER; }
[0-9]+\.[0-9]* { yylval.datum = pic_float_value(atof(yytext)); return tNUMBER; }
[a-z0-9A-Z+-/*]+ { yylval.datum = pic_intern_cstr(p->pic, yytext); return tSYMBOL; }
%%