Got the scanner running again. Seems to be picking up punctuation, labels, identifiers and strings as expected.

This commit is contained in:
2022-09-29 21:32:08 -05:00
parent e94e486e18
commit 63438b551b
2 changed files with 74 additions and 15 deletions
+22 -1
View File
@@ -156,9 +156,30 @@ int IsRegister(const char* text, Registers* reg) {
if (!text) return 0;
int length = strlen(text);
Registers r = R8;
if (length != 2) return 0;
if (text[0] != 'r') return 0;
return text[1] >= '1' && text[1] <= '8';
switch(text[1]) {
case '1':
r--;
case '2':
r--;
case '3':
r--;
case '4':
r--;
case '5':
r--;
case '6':
r--;
case '7':
r--;
case '8':
if (reg) *reg = r;
return 1;
default:
return 0;
}
}