allows for arbitrary pushing of values onto stack

This commit is contained in:
Emmaline Autumn 2024-08-05 06:31:58 -06:00
parent 2b2b88f970
commit 0f100bba3d

View File

@ -34,6 +34,7 @@ export class TTCQueryResolver {
private parseResolver(resolver: string) {
if (this.isArithmetic(resolver)) return this.solveArithmetic(resolver);
if (this.isQuery(resolver)) return this.runQuery(resolver);
return resolver;
}
private isQuery(resolver: string) {
return (
@ -44,7 +45,6 @@ export class TTCQueryResolver {
}
private runQuery(query: string) {
if (!this.parser) throw "Parser not defined in query resolver";
if (query.startsWith("$")) {
const [_, idx, q] = query.match(/^(\$\d+)\.(.*)/) || [];
if (!_) throw "Detected stack query but did not match the regex";
@ -53,7 +53,7 @@ export class TTCQueryResolver {
return this.handleDice(stackItem, q);
}
return this.parser.search(q);
return this.parser.search(q, stackItem as QueryableObject);
}
// if (query.startsWith("?") || query.startsWith("_"))