static LS tlftj_honoringBrackets(S s) { LS tok = javaTokWithBrackets(javaDropComments(s)); new LS out; int j = 1; for (int i = 2; i+1 < l(tok); i += 2) if (containsNewLine(tok.get(i))) { addIfNempty(out, joinSubList(tok, j, i)); j = i+1; } if (j < l(tok)-1) addIfNempty(out, joinSubList(tok, j, l(tok)-1)); ret out; }
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1024308 |
Snippet name: | tlftj_honoringBrackets - like tlfj, but keeps bracket-enclosed lines together |
Eternal ID of this version: | #1024308/7 |
Text MD5: | 5993b2f65d62c60567d9f9513b5952d6 |
Author: | stefan |
Category: | javax / parsing |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-07-31 01:32:37 |
Source code size: | 365 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 275 / 313 |
Version history: | 6 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1025609 - lines_honoringBrackets - like lines, but keeps bracket-enclosed lines together |