From 6a66b63680a963e67ea89ad1133dc196a51dffe3 Mon Sep 17 00:00:00 2001 From: bronku Date: Sat, 22 Nov 2025 00:33:48 +0100 Subject: [PATCH] changed equals to assign --- src/lexer.l | 4 ++-- src/parser.y | 2 +- test/lexer/1.out | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lexer.l b/src/lexer.l index b9209b6..259e23a 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -17,7 +17,7 @@ in { return yy::parser::token::TOK_KW_IF;} \( { return yy::parser::token::TOK_L_PAREN; } \) { return yy::parser::token::TOK_R_PAREN; } \: { return yy::parser::token::TOK_COLON; } -\= { return yy::parser::token::TOK_EQUALS; } +\= { return yy::parser::token::TOK_ASSIGN; } \+ { return yy::parser::token::TOK_PLUS; } \- { return yy::parser::token::TOK_MINUS; } \" { yymore(); BEGIN(STRING); } @@ -26,6 +26,6 @@ in { return yy::parser::token::TOK_KW_IF;} . { /* the last rule, ignore anything else (there should be nothing) */} \"\" { yymore(); } -\" { BEGIN(INITIAL); yylval->as() = yytext; return yy::parser::token::TOK_STRING; } +\" { BEGIN(INITIAL); yylval->as() = yytext; return yy::parser::token::TOK_STRING; } . { yymore(); } %% \ No newline at end of file diff --git a/src/parser.y b/src/parser.y index dcd994a..1087890 100644 --- a/src/parser.y +++ b/src/parser.y @@ -27,7 +27,7 @@ %token IDENTIFIER %token STRING %token NUMBER -%token EQUALS PLUS MINUS L_PAREN R_PAREN COLON +%token ASSIGN PLUS MINUS L_PAREN R_PAREN COLON %token KW_DEF KW_IF KW_RETURN KW_FOR KW_IN %token EOF NEWLINE INDENT_UP INDENT_DOWN diff --git a/test/lexer/1.out b/test/lexer/1.out index b3b5d8a..fb41d35 100644 --- a/test/lexer/1.out +++ b/test/lexer/1.out @@ -1,9 +1,9 @@ IDENTIFIER hello -EQUALS +ASSIGN NUMBER 42 NEWLINE IDENTIFIER name -EQUALS +ASSIGN STRING "world" NEWLINE IDENTIFIER x