From fa70beb1a439c959473a47edae64cb9322108876 Mon Sep 17 00:00:00 2001 From: Sam Hadow Date: Thu, 28 Mar 2024 12:06:08 +0100 Subject: [PATCH] yylval, strdup instead of pointer on str --- src/ram.l | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ram.l b/src/ram.l index c5c3892..345fa84 100644 --- a/src/ram.l +++ b/src/ram.l @@ -9,11 +9,11 @@ %% -[rio][0-9]* { yylval = yytext; return REGISTER;} -[rio]@[rio][0-9]* { yylval = yytext; return REGISTER_REF;} -[0-9]* { yylval = yytext; return VALUE;} -ADD|SUB|MULT|DIV { yylval = yytext; return OP;} -JUMP|JE|JL { yylval = yytext; return OP_CTRL;} +[rio][0-9]* { yylval = strdup(yytext); return REGISTER;} +[rio]@[rio][0-9]* { yylval = strdup(yytext); return REGISTER_REF;} +[0-9]* { yylval = strdup(yytext); return VALUE;} +ADD|SUB|MULT|DIV { yylval = strdup(yytext); return OP;} +JUMP|JE|JL { yylval = strdup(yytext); return OP_CTRL;} [ ]*,[ ]* {return COMMA;} \( {return PAR_O;} \) {return PAR_C;}