scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 5a2d0834f265ffc02702612d45d5b54fbe305026
parent 8103e1e7a587d39c421d71d1b9e834d275389270
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 19 Dec 2017 08:40:11 +0000

[as-z80] Allow register names with '

Z80 has a register called AF', so we need this character. This
is a temporary patch, because the correct solution is to integrate
reg() and iden() and make % part of the register name.

Diffstat:
Mas/expr.c | 3++-
Mas/target/z80/proc.c | 2+-
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/as/expr.c b/as/expr.c @@ -189,6 +189,7 @@ iden(void) if (isalnum(c)) continue; switch (c) { + case '\'': case '_': case '-': case '.': @@ -271,7 +272,7 @@ reg(void) if (*textp == '%') ++textp, ++endp; - while (isalnum(c = *endp)) + while (isalnum(c = *endp) || c == '\'') ++endp; tok2str(); yylval.sym = lookup(yytext); diff --git a/as/target/z80/proc.c b/as/target/z80/proc.c @@ -39,7 +39,7 @@ iarch(void) "R", AREG_R, "I", AREG_I, - "AF_", AREG_AF_, + "AF'", AREG_AF_, NULL, }, *bp;