Transpiled version (2501L) is out of date.
1 | // rtrims each item |
2 | static LS tok_splitAtEmptyLines(S s) { |
3 | new L<Int> indices; |
4 | LS tok = javaTokWithAllBrackets_cached(s); |
5 | new LS out; |
6 | int start = 0; |
7 | S spacing = ""; |
8 | for (int i = 2; i+1 < l(tok); i += 2) { |
9 | int idx = indexOf_regexp(tok.get(i), "\r?\n\\s*\r?\n"); |
10 | if (idx < 0) continue; |
11 | int idx2 = idx+1; |
12 | if (tok.get(i).charAt(idx) == '\r') ++idx2; |
13 | out.add(dropPrefix("\n", spacing + joinSubList(tok, start, i))); |
14 | start = i+1; |
15 | spacing = substring(tok.get(i), idx2); // TODO: not exact |
16 | } |
17 | if (start < l(tok)) |
18 | out.add(dropPrefix("\n", spacing + joinSubList(tok, start))); |
19 | ret out; |
20 | } |
Began life as a copy of #1024054
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1025618 |
Snippet name: | tok_splitAtEmptyLines - token-aware split at empty lines |
Eternal ID of this version: | #1025618/7 |
Text MD5: | ac509bde230a3e3e776a6570460e5e7c |
Author: | stefan |
Category: | javax / parsing |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-05-17 14:46:55 |
Source code size: | 645 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 308 / 436 |
Version history: | 6 change(s) |
Referenced in: | [show references] |