svoid gazelle_gatherFulfillments(L lines, L list_out, O... _) { Int maxEntries = cast optPar maxEntries(_); Flag cancel = cast optPar cancel(_); bool debug = boolPar debug(_); GazelleEvalContext ctx = cast optPar ctx(_); if (ctx == null) ctx = dm_gazelle_stdEvalContext(dm_gazelle_rulesOnFacts()); else { ctx = gazelle_cloneCtx(ctx); ctx.engine.dropRulesWhere(r -> !gazelle_isRuleOnFacts(r.text, r.comments)); } if (debug) print("Rules: " + l(ctx.engine.rules)); for (GazelleLine line : lines) pcall { L children = gazelle_getChildren(GazelleTree(ctx, line.text), _); if (debug) print("line " + line + ": children: " + children); for (GazelleTree t : gazelle_dropUnsatisfiedEntries(children)) pcall { if (flagIsUp(cancel) || maxEntries != null && l(list_out) >= maxEntries) ret with print("Cancel"); GazelleFulfillment f = nu GazelleFulfillment( line := t.parent.line, varMap := struct(t.varMap()), rule := t.ruleID(), matchedRuleStruct := struct(t.mr), context := "discord msg " + line.msgID); if (debug) printStruct(f); list_out.add(f); } } }