// This function supports all the special stuff like <int>
static bool jMatchStart(S pat, S s) {
return jMatchStart(pat, s, null);
}
// matches are as you expect, plus an extra item for the rest string
static bool jMatchStart(S pat, S s, Matches matches) {
if (s == null) false;
ret jMatchStart(pat, javaTok(s), matches);
}
sbool jMatchStart(S pat, LS toks) {
ret jMatchStart(pat, toks, null);
}
sbool jMatchStart(S pat, LS toks, Matches matches) {
L<S> tokpat = jfind_preprocess(javaTok(pat));
if (toks.size() < tokpat.size()) ret false;
S[] m = match2x(tokpat, toks.subList(0, tokpat.size()));
if (m == null) false;
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()
}
true;
}Began life as a copy of #1001793
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1017131 |
| Snippet name: | jMatchStart function - match first tokens, return rest |
| Eternal ID of this version: | #1017131/6 |
| Text MD5: | 51d1cb2ece23650d4c9e33003897abb3 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-06-23 20:07:14 |
| Source code size: | 863 bytes / 28 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1074 / 1129 |
| Version history: | 5 change(s) |
| Referenced in: | [show references] |