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

14
LINES

< > BotCompany Repo | #1023509 // groupTokenPredicateSequence

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

Libraryless. Click here for Pure Java version (1836L/12K).

1  
// predicates: L<F1<S, Bool>>
2  
// doesn't modify original tok
3  
static LS groupTokenPredicateSequence(LS tok, L predicates) {
4  
  int min = 0;
5  
  bool cloned = false;
6  
  for (int i : indicesOfTokenPredicateSequence(tok, predicates)) {
7  
    continue if i <= min;
8  
    if (!cloned) { cloned = true; tok = cloneList(tok); }
9  
    int j = i+l(predicates)*2-2;
10  
    tok_addCurlyBracketsAroundPart(tok, i, j);
11  
    min = j;
12  
  }
13  
  ret tok;
14  
}

Author comment

Began life as a copy of #1023507

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023509
Snippet name: groupTokenPredicateSequence
Eternal ID of this version: #1023509/6
Text MD5: 832d012b14d9c9e261ad10b0fa6f8862
Transpilation MD5: 36c7ab950c2479212eb23adc7a74e24b
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-06-27 13:05:24
Source code size: 434 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 271 / 355
Version history: 5 change(s)
Referenced in: [show references]