Libraryless. Click here for Pure Java version (2189L/14K).
static bool matchStart(S pat, S s) { ret matchStart(pat, s, null); } // matches are as you expect, plus an extra item for the rest string static bool matchStart(S pat, S s, Matches matches) { if (s == null) false; ret matchStart(pat, parse3_cachedInput(s), matches); } static bool matchStart(S pat, LS toks, Matches matches) { if (toks == null) false; L<S> tokpat = parse3_cachedPattern(pat); if (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) false; if (matches != null) { matches.m = new S[m.length+1]; arraycopy(m, matches.m); matches.m[m.length] = joinSubList(toks, tokpat.size(), toks.size()); // for Matches.rest() } true; }
Began life as a copy of #1001104
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1001793 |
Snippet name: | matchStart function - match first tokens, return rest |
Eternal ID of this version: | #1001793/4 |
Text MD5: | b425b30c55222f560445f16f17c57adc |
Transpilation MD5: | 36d1849096cfe1dbb09f1ef2982bd09d |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-05-18 23:40:51 |
Source code size: | 836 bytes / 24 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 773 / 1933 |
Version history: | 3 change(s) |
Referenced in: | [show references] |