mirror of
https://github.com/tenrok/BBob.git
synced 2026-06-05 16:42:27 +03:00
chore: v2.5.1 (#21)
* fix(parser): fix issue with escaping backslashes when enableEscapeTags is set (#20) there is a bug in the lexer where when enableEscapeTags is set, backslashes are not always escaped (ie. \\[b] is treated as an escaped tag, rather than a literal backslash, and then a tag). * chore: v2.5.1
This commit is contained in:
committed by
GitHub
parent
3b46fbe23c
commit
c4a88e5036
@@ -53,7 +53,7 @@ function createLexer(buffer, options = {}) {
|
||||
const RESERVED_CHARS = [closeTag, openTag, QUOTEMARK, BACKSLASH, SPACE, TAB, EQ, N, EM];
|
||||
const NOT_CHAR_TOKENS = [
|
||||
...(options.enableEscapeTags ? [BACKSLASH] : []),
|
||||
openTag, SPACE, TAB, N, BACKSLASH,
|
||||
openTag, SPACE, TAB, N,
|
||||
];
|
||||
const WHITESPACES = [SPACE, TAB];
|
||||
const SPECIAL_CHARS = [EQ, SPACE, TAB];
|
||||
@@ -163,6 +163,10 @@ function createLexer(buffer, options = {}) {
|
||||
bufferGrabber.skip(); // skip the \ without emitting anything
|
||||
bufferGrabber.skip(); // skip past the [ or ] as well
|
||||
emitToken(createToken(TYPE_WORD, nextChar, row, col));
|
||||
} else if (options.enableEscapeTags && currChar === BACKSLASH && nextChar === BACKSLASH) {
|
||||
bufferGrabber.skip(); // skip the first \ without emitting anything
|
||||
bufferGrabber.skip(); // skip past the second \ and emit it
|
||||
emitToken(createToken(TYPE_WORD, nextChar, row, col));
|
||||
} else if (currChar === openTag) {
|
||||
bufferGrabber.skip(); // skip openTag
|
||||
|
||||
|
||||
Reference in New Issue
Block a user