Adds line number

This commit is contained in:
Thomas Forgione 2020-12-15 15:40:15 +01:00
parent d766e1c879
commit d9a198079b
1 changed files with 4 additions and 4 deletions

View File

@ -27,7 +27,7 @@ function fetchData(path, start, end, callback) {
xhr.send(); xhr.send();
} }
function parseLine(line) { function parseLine(line, number) {
let element = {}; let element = {};
let split = line.split(/[ \t]+/); let split = line.split(/[ \t]+/);
@ -125,7 +125,7 @@ function parseLine(line) {
return; return;
default: default:
throw new Error(split[0] + " is not a defined macro"); throw new Error(split[0] + " is not a defined macro in line " + number);
} }
} }
@ -187,8 +187,8 @@ class Loader {
split[0] = this.remainder + split[0]; split[0] = this.remainder + split[0];
this.remainder = split.pop(); this.remainder = split.pop();
for (let line of split) { for (let i = 0; i < split.length; i++) {
elements.push(parseLine(line)); elements.push(parseLine(split[i], i));
} }
callback(elements); callback(elements);