yylval, strdup instead of pointer on str

This commit is contained in:
Sam Hadow 2024-03-28 12:06:08 +01:00
parent 8f722d7896
commit fa70beb1a4

View File

@ -9,11 +9,11 @@
%% %%
[rio][0-9]* { yylval = yytext; return REGISTER;} [rio][0-9]* { yylval = strdup(yytext); return REGISTER;}
[rio]@[rio][0-9]* { yylval = yytext; return REGISTER_REF;} [rio]@[rio][0-9]* { yylval = strdup(yytext); return REGISTER_REF;}
[0-9]* { yylval = yytext; return VALUE;} [0-9]* { yylval = strdup(yytext); return VALUE;}
ADD|SUB|MULT|DIV { yylval = yytext; return OP;} ADD|SUB|MULT|DIV { yylval = strdup(yytext); return OP;}
JUMP|JE|JL { yylval = yytext; return OP_CTRL;} JUMP|JE|JL { yylval = strdup(yytext); return OP_CTRL;}
[ ]*,[ ]* {return COMMA;} [ ]*,[ ]* {return COMMA;}
\( {return PAR_O;} \( {return PAR_O;}
\) {return PAR_C;} \) {return PAR_C;}