ref: eac365aef0d6971c83da5b9a57a7b472eb70c663
parent: 4de6266442a2ef8e2291d245cfb53e278b90c21d
author: ISSOtm <eldredhabert0@gmail.com>
date: Wed Dec 9 04:30:15 EST 2020
Allow argument to `rb`, `rw` and `rl` to be optional Fixes #617
--- a/src/asm/parser.y
+++ b/src/asm/parser.y
@@ -182,6 +182,7 @@
%type <sVal> relocexpr_no_str
%type <nConstValue> const
%type <nConstValue> uconst
+%type <nConstValue> rs_uconst
%type <nConstValue> const_3bit
%type <sVal> reloc_8bit
%type <sVal> reloc_8bit_no_str
@@ -616,19 +617,27 @@
rsreset : T_POP_RSRESET { sym_AddSet("_RS", 0); };
-rl : T_LABEL T_POP_RL uconst {+rs_uconst : /* empty */ {+ $$ = 1;
+ }
+ | uconst {+ $$ = $1;
+ }
+;
+
+rl : T_LABEL T_POP_RL rs_uconst { sym_AddEqu($1, sym_GetConstantValue("_RS")); sym_AddSet("_RS", sym_GetConstantValue("_RS") + 4 * $3);}
;
-rw : T_LABEL T_POP_RW uconst {+rw : T_LABEL T_POP_RW rs_uconst { sym_AddEqu($1, sym_GetConstantValue("_RS")); sym_AddSet("_RS", sym_GetConstantValue("_RS") + 2 * $3);}
;
-rb : T_LABEL T_POP_RB uconst {+rb : T_LABEL T_POP_RB rs_uconst { sym_AddEqu($1, sym_GetConstantValue("_RS")); sym_AddSet("_RS", sym_GetConstantValue("_RS") + $3);}
--
⑨