static S jreplaceStart(S s, S in, S out) { ret jreplaceStart(s, in, out, null); } static S jreplaceStart(S s, S in, S out, O condition) { L<S> tok = javaTok(s); jreplaceStart(tok, in, out, condition); ret join(tok); } // leaves tok properly tokenized // returns true iff anything was replaced static boolean jreplaceStart(L<S> tok, S in, S out) { ret jreplaceStart(tok, in, out, false, false, null); } static boolean jreplaceStart(L<S> tok, S in, S out, O condition) { ret jreplaceStart(tok, in, out, false, false, condition); } static boolean jreplaceStart(L<S> tok, S in, S out, boolean ignoreCase, boolean reTok, O condition) { L<S> tokin = javaTok(in); jfind_preprocess(tokin); int i = findCodeTokens(tok, 1, ignoreCase, toStringArray(codeTokensOnly(tokin)), condition); // TODO: opt if (i != 1) false; L<S> subList = tok.subList(i-1, i+l(tokin)-1); // N to N S expansion = jreplaceExpandRefs(out, subList); int end = i+l(tokin)-2; clearAllTokens(tok, i, end); // C to C tok.set(i, expansion); if (reTok) reTok(tok, i, end); true; }
Began life as a copy of #1002133
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: | #1008358 |
Snippet name: | jreplaceStart - replace first tokens only |
Eternal ID of this version: | #1008358/1 |
Text MD5: | 706d97441481fc814a1fcd6b7112563f |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-05-09 17:03:55 |
Source code size: | 1113 bytes / 35 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 455 / 475 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |