removed sign in number tokenizer

pass floats and integer as strings
This commit is contained in:
Felix Müller 2024-04-17 09:12:29 +02:00
parent 7e06e5ade7
commit e8bfc348be
2 changed files with 4 additions and 6 deletions

View File

@ -76,9 +76,9 @@
"extsupport" return(FunExtsupport);
[a-zA-Z_]+ { yylval.string = strdup(yytext); return(Ident); };
[-+]?[0-9]+ { yylval.num = atoi(yytext); return(ValInt); };
[0-9]+ { yylval.string = strdup(yytext); return(ValInt); };
\"([^\"\n])*\" {yylval.string = strdup(yytext); return(ValStr);};
\"\"\"([^\"\n]|\\\n)*\"\"\" {yylval.string = strdup(yytext); return(ValMultistr);};
[-+]?[0-9]*\.[0-9]+ {yylval.real = atof(yytext); return(ValFloat);};
[0-9]*\.[0-9]+ {yylval.string = strdup(yytext); return(ValFloat);};
.;
%%

View File

@ -8,16 +8,14 @@
%union {
char *string;
int num;
float real;
}
%token KeyInt
%token KeyFloat
%token KeyAs
%token <num> ValInt
%token <string> ValInt
%token <string> Ident
%token <real> ValFloat
%token <string> ValFloat
%token <string> ValStr
%token <string> ValMultistr
%token KeyShort