Transpiled version (10949L) is out of date.
1 | sbool jmatchStart(S pat, S s) { |
2 | ret jmatchStart(pat, s, null); |
3 | } |
4 | |
5 | // matches are as you expect, plus an extra item for the rest string |
6 | sbool jmatchStart(S pat, S s, Matches matches) { |
7 | if (s == null) false; |
8 | LS tokpat = javaTok(pat), toks = javaTok(s); |
9 | ret jmatchStart(tokpat, toks, matches); |
10 | } |
11 | |
12 | sbool jmatchStart(S pat, LS toks, Matches matches default null) { |
13 | if (toks == null) false; |
14 | LS tokpat = javaTok(pat); |
15 | ret jmatchStart(tokpat, toks, matches); |
16 | } |
17 | |
18 | sbool jmatchStart(LS tokpat, LS toks, Matches matches) { |
19 | if (tokpat == null || toks == null || toks.size() < tokpat.size()) ret false; |
20 | S[] m = match2(tokpat, toks.subList(0, tokpat.size())); |
21 | //print(structure(tokpat) + " on " + structure(toks) + " => " + structure(m)); |
22 | if (m == null) |
23 | return false; |
24 | else { |
25 | if (matches != null) { |
26 | matches.m = new S[m.length+1]; |
27 | arraycopy(m, matches.m); |
28 | matches.m[m.length] = join(toks.subList(tokpat.size(), toks.size())); // for Matches.rest() |
29 | } |
30 | return true; |
31 | } |
32 | } |
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, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1002594 |
Snippet name: | jmatchStart function - don't use. use jMatchStart instead, it supports <quoted> etc |
Eternal ID of this version: | #1002594/7 |
Text MD5: | 956c292d9be6b3b3c2e261a721ec93d7 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2023-10-25 17:40:19 |
Source code size: | 1042 bytes / 32 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 735 / 788 |
Version history: | 6 change(s) |
Referenced in: | [show references] |