2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-17 19:21:20 +03:00

fix(parser): tokenizer error with quotemark strings

This commit is contained in:
Nikolay Kostyurin
2018-07-11 23:37:51 +02:00
parent 3119314b07
commit 7f400506d4
6 changed files with 64 additions and 6 deletions
+5 -1
View File
@@ -219,7 +219,11 @@ class Tokenizer {
!isPrevBackslash) {
this.flushAttrNames();
} else if (!this.inTag()) {
this.wordToken[Token.VALUE_ID] += getChar(charCode);
if (!this.wordToken) {
this.wordToken = this.createWordToken(getChar(charCode));
} else {
this.wordToken[Token.VALUE_ID] += getChar(charCode);
}
}
this.nextCol();
+10 -4
View File
@@ -167,9 +167,15 @@ const handleTagEnd = (token) => {
if (lastNestedNode) {
appendNode(lastNestedNode);
} else {
// eslint-disable-next-line no-console
console.warn(`Inconsistent tag '${getTokenValue(token)}' on line ${getTokenLine(token)} and column ${getTokenColumn(token)}`);
} else if (options.onError) {
const tag = getTokenValue(token);
const line = getTokenLine(token);
const column = getTokenColumn(token);
options.onError({
message: `Inconsistent tag '${tag}' on line ${line} and column ${column}`,
lineNumber: line,
columnNumber: column,
});
}
}
};
@@ -228,8 +234,8 @@ const parseToken = (token) => {
* @return {Array}
*/
const parse = (input, opts = {}) => {
tokenizer = createTokenizer(input, parseToken);
options = opts;
tokenizer = createTokenizer(input, parseToken);
nodes = [];
nestedNodes = [];