// matches first condition, leaves rest in MatchedRule static L ai_ruleEngine2_rulesForInput_5(RuleEngine2 engine, SS inputsByType, O... _) { bool debug = boolPar debug(_); new L l; for (RuleEngine2.Rule rule : engine.rules) { if (rule cast RuleEngine2.SimplifyWithRule) { if (rule.isSplitRule) continue; // run simplifier S in = inputsByType.get('standard); O f = rule.function(); if (debug) print("Running simplifier " + rule.globalID + ": " + f); O arg = rule.callOnTree ? optPar tree(_) : in; if (arg == null) continue; O result = f instanceof S ? arg instanceof S ? callF(engine.callFunctionOnString, (S) f, arg) : callAndMake((S) f, arg) : callF(f, arg); if (result == null) continue; LS list = result instanceof Collection ? allToString((Collection) result) : ll(str(result)); if (debug) print("Simplifier returned: " + list); theLoop: for (S x : list) { if (nempty(x) && neq(x, in)) { final new RuleEngine2_MatchedRule matched; matched.rule = rule; matched.out = x; matched.inputsByType = inputsByType; // call massagers in some dummy way // (e.g. for humanOnly test) for (O massager : unnull(matched.rule.mapMassagers)) if (callF(massager, new HashMap, null, null, matched) == null) { if (debug) print("mapMassager returned null: " + massager); continue theLoop; } l.add(matched); } } continue; } // run normal rule final new RuleEngine2_MatchedRule matched; matched.rule = rule; matched.inputsByType = inputsByType; matched.map = ciMap(); matched.tokenizationFunction = or(matchAny_firstGroup("tokenize with *", rule.comments), f javaTokNPunctuationWithBrackets); matched.outTokenizer = matchAny_firstGroup("tokenize out with *", rule.comments); if (!ai_ruleEngine2_matchStep(matched, inputsByType, true, _)) continue; l.add(matched); } ret l; }