static boolean matchEnd(S pat, S s) {
return matchEnd(pat, s, null);
}
// matches are as you expect, plus an extra item for the rest string
static boolean matchEnd(S pat, S s, Matches matches) {
if (s == null) false;
L<S> tokpat = parse3(pat), toks = parse3(s);
if (toks.size() < tokpat.size()) false;
S[] m = match2(tokpat, takeLast(l(tokpat), toks));
if (m == null) false;
if (matches != null) {
matches.m = new S[m.length+1];
arraycopy(m, matches.m);
matches.m[m.length] = join(dropLast(l(tokpat), toks)); // for Matches.rest()
}
true;
}Began life as a copy of #1001793
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1018415 |
| Snippet name: | matchEnd function - match last tokens, return rest |
| Eternal ID of this version: | #1018415/3 |
| Text MD5: | affcdfed33cf940dc7d13366051a851a |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-12-13 00:05:16 |
| Source code size: | 588 bytes / 18 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 791 / 814 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |