static S ctxFindRuleForInput() { CtxContext ctx = ctxContext(); WoodyRule activeRule = woodyBot().getRule(ctx.activeRule); WoodyBot bot = woodyBot(); print("ctxFindRuleForInput analyzer: " + ctx.activeAnalyzer); if (ctx.activeAnalyzer != null) { bool x = ctxProcessRule(ctx.activeAnalyzer); print(" -> " + (x ? ctx.nextRule : "no match")); if (x) ret ctx.nextRule; } if (activeRule != null) { print("Active rule: " + activeRule.fullName); /*WoodyRule analyzer = bot.getRule(activeRule.properties.get("ANALYZER")); print("Analyzer: " + getOpt(analyzer, "fullName")); if (analyzer != null) { // TODO }*/ try answer ctxFindRuleForInput_default(); ret activeRule.fullName; } ret ctxFindRuleForInput_default(); } sS ctxFindRuleForInput_default() { new L matchingRules; for (WoodyRule rule : woodyOnRules(woodyBot())) if (rule.parsedCondition != null && rule.parsedCondition.get()) { //print("Matching: " + rule.fullName); matchingRules.add(rule); } if (empty(matchingRules)) null; matchingRules = sortByCalculatedFieldDesc(matchingRules, func(WoodyRule rule) { toInt(or(rule.properties.get("PRIORITY"), "100")) }); if (l(matchingRules) > 1) print("Have multiple matching rules, picking " + first(matchingRules).fullName + " over " + collect('fullName, dropFirst(matchingRules))); ret first(matchingRules).fullName; }