mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
First draft of the macro lexer
This commit is contained in:
26
public/scripts/macros/MacroParser.js
Normal file
26
public/scripts/macros/MacroParser.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { CstParser } from './lib.js';
|
||||
import { MacroLexer } from './MacroLexer.js';
|
||||
|
||||
/**
|
||||
* The singleton instance of the MacroParser.
|
||||
*
|
||||
* @type {MacroParser}
|
||||
*/
|
||||
let instance;
|
||||
export { instance as MacroParser };
|
||||
|
||||
class MacroParser extends CstParser {
|
||||
/** @type {MacroParser} */ static #instance;
|
||||
/** @type {MacroParser} */ static get instance() { return MacroParser.#instance ?? (MacroParser.#instance = new MacroParser()); }
|
||||
|
||||
/** @private */
|
||||
constructor() {
|
||||
super(MacroLexer.def);
|
||||
|
||||
// const $ = this;
|
||||
|
||||
this.performSelfAnalysis();
|
||||
}
|
||||
}
|
||||
|
||||
instance = MacroParser.instance;
|
Reference in New Issue
Block a user