ref: f15cd0379a5d9b4a8702315d4bb2de4792238d7d
parent: bf30308c5a79d7e15d662a35490a4ab92b85fb89
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Jan 25 07:33:03 EST 2018
[as] Define regmode When we are in regmode % can initiate a symbol name, but when we aren't it cannot. This is done to allow % to be the modulo operation at the same time that it is part of register names.
--- a/as/expr.c
+++ b/as/expr.c
@@ -21,6 +21,7 @@
static char yytext[INTIDENTSIZ+1], *textp, *endp;
static size_t yylen;
static union yylval yylval;
+static int regmode;
#define accept(t) (yytoken == (t) ? next() : 0)
@@ -318,6 +319,9 @@
case '\'':
c = character();
break;
+ case '%':
+ c = (regmode ? iden : operator)();
+ break;
case '_':
c = iden();
break;
@@ -515,6 +519,7 @@
int op;
Node *np;
+ regmode = 0;
np = and();
for (;;) {
switch (op = yytoken) {
@@ -535,6 +540,7 @@
int imm = 0;
Node *np;
+ regmode = 1;
textp = *strp;
switch (next()) {
case EOS: