sbool nlLogic_flexMatch_iterate_debug; svoid nlLogic_flexMatch_iterate(S pat, S input, NLLogicChecker_v2.Matching m, Runnable onMatch, VarMatches oldMatches) { if (nlLogic_flexMatch_iterate_debug) print("nlLogic_flexMatch_iterate " + pat + " / " + input); L tokPat = parse3_cachedPattern(pat), tokInput = parse3_cachedInput(input); // fail if crucial words not found (could be optimized more) new L varIndices; for (int i = 1; i < l(tokPat); i += 2) { S t = tokPat.get(i); if (isDollarVar(t)) varIndices.add(i); else if (isIdentifier(t) && !cicAtOddPosition(tokInput, t)) { if (nlLogic_flexMatch_iterate_debug) print("Crucial word fail (" + t + "): " + pat + " / " + input); ret; } } if (nlLogic_flexMatch_iterate_debug) printStructs(+varIndices, +tokPat, +tokInput); LL spreadInputs = ai_spreadCertainIndices(tokPat, tokInput, varIndices); for (L tok : spreadInputs) { if (nlLogic_flexMatch_iterate_debug) print("Testing spread input: " + sfu(tok)); SS newMatches = matchDollarVarsIC(pat, tok); if (newMatches != null && addMapToMapWithoutOverwritingIC(m.matches, newMatches)) try { callF(onMatch); } finally { m.matches = oldMatches; } } }