From 811c06ca22c2260f3777e210f07dd8d011a09080 Mon Sep 17 00:00:00 2001 From: anon Date: Fri, 5 Jul 2024 19:32:43 +0200 Subject: [PATCH] labels --- source/eaxhla.l | 5 +++-- source/eaxhla.y | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/source/eaxhla.l b/source/eaxhla.l index c31150c..d86bd49 100644 --- a/source/eaxhla.l +++ b/source/eaxhla.l @@ -102,7 +102,7 @@ fastcall{wsnl}+ { return FASTCALL; } \[ { return '['; } \] { return ']'; } -\+|\-|\*|\/|\%|\^ { return yytext[0]; } +\+|\-|\*|\/|\%|\^|\: { return yytext[0]; } { program { BEGIN INITIAL; return END_PROGRAM; } @@ -165,7 +165,8 @@ machine { BEGIN INITIAL; return END_MACHINE; } } } -{identifier} { yylval.strval = strdup(yytext); return IDENTIFIER; } +{identifier} { yylval.strval = strdup(yytext); return IDENTIFIER; } +{identifier}: { yylval.strval = strdup(yytext); return LABEL; } . { yyerror(); } diff --git a/source/eaxhla.y b/source/eaxhla.y index 64719f8..e56b5ce 100644 --- a/source/eaxhla.y +++ b/source/eaxhla.y @@ -60,7 +60,7 @@ %token EXIT BREAK -%token IDENTIFIER +%token IDENTIFIER LABEL %type immediate %type artimetric_block artimetric_expression artimetric_operand @@ -146,9 +146,10 @@ code: %empty | loop code | if code | call code + | LABEL code | machine code - | BREAK code - | exit code + | BREAK code + | exit code | TXOR register register code { /* assemble_xor(size_64b, type_register_register, $2, $3); */ } | TXOR register immediate code { /* assemble_xor(size_64b, type_register_register, $2, $3); */ } | TXOR IDENTIFIER register code { /* assemble_xor(size_64b, type_register_register, $2, $3); */ free($2); }