shithub: scc

Download patch

ref: 7b193c3dadbe36acdcf3e203f5bd36b95b4c57b6
parent: 531272addf291dc18b1b02a53e2fe8eea8774f64
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Dec 19 03:40:11 EST 2017

[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.

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