move addproblem into TokenList

This commit is contained in:
Dave Holoway
2020-06-29 16:24:01 +01:00
parent 31f3826971
commit 00da3cd2f1
2 changed files with 11 additions and 12 deletions

View File

@@ -3,6 +3,15 @@
*/
const ParseProblem = require('./parsetypes/parse-problem');
/**
*
* @param {TokenList} tokens
* @param {ParseProblem} problem
*/
function addproblem(tokens, problem) {
tokens.problems.push(problem);
}
class TokenList {
/**
* @param {Token[]} tokens
@@ -136,7 +145,6 @@ class TokenList {
return true;
}
const token = this.current || this.tokens[this.tokens.length - 1];
const addproblem = require("./body-parser").addproblem;
addproblem(this, ParseProblem.Error(token, `${value} expected`));
return false;
}
@@ -164,3 +172,4 @@ class TokenList {
}
exports.TokenList = TokenList;
exports.addproblem = addproblem;