ref: 8d18b39eeed5188216483e21675911c046586b72
parent: ae77893021c9c728d1ded0eda78aa13ab419dd1f
author: ISSOtm <eldredhabert0@gmail.com>
date: Sun Aug 16 19:11:12 EDT 2020
Support missing register tokens Made possible by #491
--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -115,6 +115,8 @@
{"DE", T_MODE_DE}, {"HL", T_MODE_HL}, {"SP", T_MODE_SP},+ {"HLD", T_MODE_HL_DEC},+ {"HLI", T_MODE_HL_INC}, {"A", T_TOKEN_A}, {"B", T_TOKEN_B},@@ -429,7 +431,7 @@
uint16_t children[0x60 - ' '];
struct KeywordMapping const *keyword;
/* Since the keyword structure is invariant, the min number of nodes is known at compile time */
-} keywordDict[336] = {0}; /* Make sure to keep this correct when adding keywords! */+} keywordDict[338] = {0}; /* Make sure to keep this correct when adding keywords! *//* Convert a char into its index into the dict */
static inline uint8_t dictIndex(char c)
@@ -1476,6 +1478,25 @@
case '$':
yylval.nConstValue = 0;
readHexNumber();
+ /* Attempt to match `$ff00+c` */
+ if (yylval.nConstValue == 0xff00) {+ /* Whitespace is ignored anyways */
+ while (isWhitespace(c = peek(0)))
+ shiftChars(1);
+ if (c == '+') {+ /* FIXME: not great due to large lookahead */
+ uint8_t distance = 1;
+
+ do {+ c = peek(distance++);
+ } while (isWhitespace(c));
+
+ if (c == 'c' || c == 'C') {+ shiftChars(distance);
+ return T_MODE_HW_C;
+ }
+ }
+ }
return T_NUMBER;
case '0': /* Decimal number */
--
⑨