allows for arbitrary pushing of values onto stack
This commit is contained in:
parent
2b2b88f970
commit
0f100bba3d
@ -34,6 +34,7 @@ export class TTCQueryResolver {
|
|||||||
private parseResolver(resolver: string) {
|
private parseResolver(resolver: string) {
|
||||||
if (this.isArithmetic(resolver)) return this.solveArithmetic(resolver);
|
if (this.isArithmetic(resolver)) return this.solveArithmetic(resolver);
|
||||||
if (this.isQuery(resolver)) return this.runQuery(resolver);
|
if (this.isQuery(resolver)) return this.runQuery(resolver);
|
||||||
|
return resolver;
|
||||||
}
|
}
|
||||||
private isQuery(resolver: string) {
|
private isQuery(resolver: string) {
|
||||||
return (
|
return (
|
||||||
@ -44,7 +45,6 @@ export class TTCQueryResolver {
|
|||||||
}
|
}
|
||||||
private runQuery(query: string) {
|
private runQuery(query: string) {
|
||||||
if (!this.parser) throw "Parser not defined in query resolver";
|
if (!this.parser) throw "Parser not defined in query resolver";
|
||||||
|
|
||||||
if (query.startsWith("$")) {
|
if (query.startsWith("$")) {
|
||||||
const [_, idx, q] = query.match(/^(\$\d+)\.(.*)/) || [];
|
const [_, idx, q] = query.match(/^(\$\d+)\.(.*)/) || [];
|
||||||
if (!_) throw "Detected stack query but did not match the regex";
|
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.handleDice(stackItem, q);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.parser.search(q);
|
return this.parser.search(q, stackItem as QueryableObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (query.startsWith("?") || query.startsWith("_"))
|
// if (query.startsWith("?") || query.startsWith("_"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user