From 4a2f3724d5cbfb7fc94750bd4738eee284304fba Mon Sep 17 00:00:00 2001 From: n loewen Date: Tue, 15 Aug 2023 16:55:08 +0100 Subject: [PATCH] Bugfix (assembler): Add a quick hack to make camelCase =constant names less likely to fail --- assembler.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/assembler.js b/assembler.js index de50abe..be49a6c 100644 --- a/assembler.js +++ b/assembler.js @@ -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}`);