Bugfix (assembler): Add a quick hack to make camelCase =constant names less likely to fail

This commit is contained in:
n loewen 2023-08-15 16:55:08 +01:00
parent 9414d19fad
commit 4a2f3724d5
1 changed files with 4 additions and 2 deletions

View File

@ -86,7 +86,8 @@ function decodeInstructions(line) {
// Handle constant definitions
if (opName.startsWith('=')) {
// TODO: validate constant
let constantName = opName.substring(1); // strip '>'
// FIXME - a quick hack to get around problems caused by another use of lower-casing to sanitize input:
let constantName = opName.substring(1).toLowerCase(); // strip '>'
let constantValue = arg_str;
constants[constantName] = constantValue;
dbg(2, `constants:`);
@ -125,7 +126,8 @@ function decodeInstructions(line) {
// Handle references to constants
} else if (arg_str.startsWith('=')) {
arg_str = arg_str.substring(1) // strip '>'
// FIXME - a quick hack to get around problems caused by another use of lower-casing to sanitize input:
arg_str = arg_str.substring(1).toLowerCase(); // strip '>'
dbg(2, `operand references '${arg_str}'`);
arg_str = constants[arg_str];
dbg(2, `arg_str from '${arg_str}`);