Parser consumes basic macros

- Fix lexer mode names
- Add basic macro parsing (identifier, and arguments)
- Tests: basic macro parsing tests
- Tests: simplifyCstNode supports ignoring nodes, or flattening nodes to just plaintext
This commit is contained in:
Wolfsblvt
2025-03-17 00:12:04 +01:00
parent 6a72369327
commit efa367541a
3 changed files with 167 additions and 33 deletions

View File

@@ -6,10 +6,10 @@ import { createToken, Lexer } from '../../lib/chevrotain.js';
const modes = {
plaintext: 'plaintext_mode',
macro_def: 'macro_def_mode',
macro_identifier_end: 'macro_identifier_end',
macro_identifier_end: 'macro_identifier_end_mode',
macro_args: 'macro_args_mode',
macro_filter_modifer: 'macro_filter_modifer_mode',
macro_filter_modifier_end: 'macro_filter_modifier_end',
macro_filter_modifier_end: 'macro_filter_modifier_end_mode',
};
/** @readonly */
@@ -146,7 +146,9 @@ class MacroLexer extends Lexer {
/** @private */
constructor() {
super(MacroLexer.def);
super(MacroLexer.def, {
traceInitPerf: true,
});
}
test(input) {