diff options
author | sanine-a <sanine.not@pm.me> | 2023-05-22 15:09:10 -0500 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2023-05-22 15:09:10 -0500 |
commit | 9fa301a7cf8e8b5883521d1a966ee7b65ecf925e (patch) | |
tree | 38a87e7bc3b17dabd149c64f5d266f0589b717c5 /src/parser/parser.js | |
parent | 9e8703d07e2e49d14e3d2092d77f8f7e75ee7e04 (diff) |
fix comment parsing
Diffstat (limited to 'src/parser/parser.js')
-rw-r--r-- | src/parser/parser.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/parser/parser.js b/src/parser/parser.js index 7d3dd95..8672832 100644 --- a/src/parser/parser.js +++ b/src/parser/parser.js @@ -36,15 +36,16 @@ parser.yy = { //if (process.argv[1] === 'parser.js' && process.argv.length >= 3) { fs.readFile(process.argv[2], 'utf8', (err, data) => { if (err) throw err; - let program = parser.parse(data.toUpperCase()); - if (typeof(program.start) === "string") { - program.start = parser.yy.line[program.start]; + let result = parser.parse(data.toUpperCase()); + if (typeof(result.start) === "string") { + result.start = parser.yy.line[result.start]; } - for (let pc=0; pc<program.program.length; pc += 1) { - parser.yy.tidyAddress(pc, program.program[pc].a); - parser.yy.tidyAddress(pc, program.program[pc].b); + for (let pc=0; pc<result.program.length; pc += 1) { + parser.yy.tidyAddress(pc, result.program[pc].a); + parser.yy.tidyAddress(pc, result.program[pc].b); } - console.log(program); + console.log(result.start); + console.log(result.program); console.log(parser.yy); }); //} |