2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-14 18:42:24 +03:00

feat(parse): allow tags to be escaped with backslash (#17)

* feat(parse): allow tags to be escaped with backslash

adds additional option `enableEscapeTags` to `parse` and `createLexer` that
when true will parse openTag and closeTag as WORD (rather than TAG) when
proceeded with backslash
This commit is contained in:
David Ferguson
2019-06-17 20:29:10 +01:00
committed by Nikolay Kostyurin
parent 7e25c45c83
commit c4f78c1230
4 changed files with 46 additions and 2 deletions
+16
View File
@@ -183,5 +183,21 @@ describe('Parser', () => {
}
]);
});
test('parse escaped tags tags', () => {
const ast = parse('\\[b\\]test\\[/b\\]', {
enableEscapeTags: true
});
expectOutput(ast, [
'[',
'b',
']',
'test',
'[',
'/b',
']',
]);
});
});
});