changed equals to assign

This commit is contained in:
bronku 2025-11-22 00:33:48 +01:00
parent 87695ebb20
commit 6a66b63680
3 changed files with 5 additions and 5 deletions

View file

@ -17,7 +17,7 @@ in { return yy::parser::token::TOK_KW_IF;}
\( { return yy::parser::token::TOK_L_PAREN; } \( { return yy::parser::token::TOK_L_PAREN; }
\) { return yy::parser::token::TOK_R_PAREN; } \) { return yy::parser::token::TOK_R_PAREN; }
\: { return yy::parser::token::TOK_COLON; } \: { 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_PLUS; }
\- { return yy::parser::token::TOK_MINUS; } \- { return yy::parser::token::TOK_MINUS; }
\" { yymore(); BEGIN(STRING); } \" { 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) */} . { /* the last rule, ignore anything else (there should be nothing) */}
<STRING>\"\" { yymore(); } <STRING>\"\" { yymore(); }
<STRING>\" { BEGIN(INITIAL); yylval->as<std::string>() = yytext; return yy::parser::token::TOK_STRING; } <STRING>\" { BEGIN(INITIAL); yylval->as<std::string>() = yytext; return yy::parser::token::TOK_STRING; }
<STRING>. { yymore(); } <STRING>. { yymore(); }
%% %%

View file

@ -27,7 +27,7 @@
%token <std::string> IDENTIFIER %token <std::string> IDENTIFIER
%token <std::string> STRING %token <std::string> STRING
%token <int> NUMBER %token <int> 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 KW_DEF KW_IF KW_RETURN KW_FOR KW_IN
%token EOF NEWLINE INDENT_UP INDENT_DOWN %token EOF NEWLINE INDENT_UP INDENT_DOWN

View file

@ -1,9 +1,9 @@
IDENTIFIER hello IDENTIFIER hello
EQUALS ASSIGN
NUMBER 42 NUMBER 42
NEWLINE NEWLINE
IDENTIFIER name IDENTIFIER name
EQUALS ASSIGN
STRING "world" STRING "world"
NEWLINE NEWLINE
IDENTIFIER x IDENTIFIER x