sbool jmatchStart(S pat, S s) { ret jmatchStart(pat, s, null); } // matches are as you expect, plus an extra item for the rest string sbool jmatchStart(S pat, S s, Matches matches) { if (s == null) false; LS tokpat = javaTok(pat), toks = javaTok(s); ret jmatchStart(tokpat, toks, matches); } sbool jmatchStart(S pat, LS toks, Matches matches default null) { if (toks == null) false; LS tokpat = javaTok(pat); ret jmatchStart(tokpat, toks, matches); } sbool jmatchStart(LS tokpat, LS toks, Matches matches) { if (tokpat == null || toks == null || toks.size() < tokpat.size()) ret false; S[] m = match2(tokpat, toks.subList(0, tokpat.size())); //print(structure(tokpat) + " on " + structure(toks) + " => " + structure(m)); if (m == null) return false; else { if (matches != null) { matches.m = new S[m.length+1]; arraycopy(m, matches.m); matches.m[m.length] = join(toks.subList(tokpat.size(), toks.size())); // for Matches.rest() } return true; } }