Skip to content

Commit

Permalink
Ignore entire comment lines
Browse files Browse the repository at this point in the history
  • Loading branch information
darkzense committed Nov 19, 2023
1 parent 7867c33 commit 708c844
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions system/assembler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,19 @@ function decodeText(binaryInstruction: string) {
function makeObjectCode() {
const objCode: string[] = [];
const sourceCode = getSourceCode();

for (const [index, line] of sourceCode.entries()) {
if (index == sourceCode.length - 1 && !line.toLowerCase().includes("end")) {
throw new SyntaxError('Missing "END" instruction.');
}
const objSrc = encodeInstruction(line);
objCode.push(objSrc);
// Ignore entire comment lines
if (line.startsWith(";")) {
objCode.push("");
} else {
const objSrc = encodeInstruction(line);
objCode.push(objSrc);
}
}

return objCode;
}

Expand Down

0 comments on commit 708c844

Please sign in to comment.