sbool flexMatchIC_iterate_debug; svoid flexMatchIC_iterate(S pat, S input, VF1 onMatch) { if (flexMatchIC_iterate_debug) print("flexMatchIC_iterate " + pat + " / " + input); flexMatchIC_iterate(pat, javaTokNPunctuation_plusAsterisk(pat), javaTokNPunctuation_plusAsterisk(input), onMatch); } svoid flexMatchIC_iterate(S pat, LS tokPat, LS tokInput, VF1 onMatch) { // 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 (eq(t, "*")) varIndices.add(i); else if (isIdentifier(t) && !cicAtOddPosition(tokInput, t)) { if (flexMatchIC_iterate_debug) print("Crucial word fail (" + t + "): " + pat + " / " + join(tokInput)); ret; } } if (flexMatchIC_iterate_debug) printStructs(+varIndices, +tokPat, +tokInput); LL spreadInputs = ai_spreadCertainIndices_2(tokPat, tokInput, varIndices); for (L tok : spreadInputs) { if (flexMatchIC_iterate_debug) print("Testing spread input: " + sfu(tok)); new Matches m; if (match(pat, tok, m)) callF(onMatch, m); } }