Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

14
LINES

< > BotCompany Repo | #1025839 // tlft_honoringTokens - token-aware tlft

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2384L/15K).

1  
static LS tlft_honoringTokens(S s) {
2  
  new L<Int> indices;
3  
  LS tok = javaTok(s);
4  
  new LS out;
5  
  int start = 0;
6  
  for (int i = 2; i+1 < l(tok); i += 2) {
7  
    continue unless containsNewLine(tok.get(i));
8  
    addIfNempty(out, trimJoinSubList(tok, start, i));
9  
    start = i+1;
10  
  }
11  
  if (start < l(tok))
12  
    addIfNempty(out, trimJoinSubList(tok, start));
13  
  ret out;
14  
}

Author comment

Began life as a copy of #1025618

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: #1025839
Snippet name: tlft_honoringTokens - token-aware tlft
Eternal ID of this version: #1025839/3
Text MD5: 8d8951a42a1b0fd68bd6fa24e282056c
Transpilation MD5: f316e7bce0acd1735aee84eda5dc4b9e
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-26 03:15:20
Source code size: 377 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 197 / 296
Version history: 2 change(s)
Referenced in: [show references]