Isolate all parsers in a local self-executing function

This commit is contained in:
DominikDoom
2025-07-12 18:54:56 +02:00
parent 8a574ec5e1
commit 87fa3851ca
10 changed files with 904 additions and 729 deletions

View File

@@ -1,21 +1,21 @@
class FunctionNotOverriddenError extends Error {
TAC.FunctionNotOverriddenError = class FunctionNotOverriddenError extends Error {
constructor(message = "", ...args) {
super(message, ...args);
this.message = message + " is an abstract base function and must be overwritten.";
}
}
class BaseTagParser {
TAC.BaseTagParser = class BaseTagParser {
triggerCondition = null;
constructor (triggerCondition) {
if (new.target === BaseTagParser) {
if (new.target === TAC.BaseTagParser) {
throw new TypeError("Cannot construct abstract BaseCompletionParser directly");
}
this.triggerCondition = triggerCondition;
}
parse() {
throw new FunctionNotOverriddenError("parse()");
throw new TAC.FunctionNotOverriddenError("parse()");
}
}