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

13
LINES

< > BotCompany Repo | #1027861 // jextractAllIC_any_returnCNC - find multiple patterns, return sub-tokenizations

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

Libraryless. Click here for Pure Java version (3115L/20K).

1  
static LLS jextractAllIC_any_returnCNC(S s, S... patterns) {
2  
  ret jextractAllIC_any_returnCNC(javaTok(s), patterns);
3  
}
4  
5  
static LLS jextractAllIC_any_returnCNC(LS tok, S... patterns) {
6  
  new TreeSet<Pair<Int>> set; // pair(startIndex, endIndex)
7  
  for (S pat : patterns) {
8  
    LS tokPat = javaTok(pat);
9  
    jfind_preprocess(tokPat);
10  
    set.addAll(map(jfindAllIC(tok, tokPat), i -> pair(i, i+l(tokPat)-2)));
11  
  }
12  
  ret mapPairsToList(set, (start, end) -> subList(tok, start-1, end+1));
13  
}

Author comment

Began life as a copy of #1027860

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: #1027861
Snippet name: jextractAllIC_any_returnCNC - find multiple patterns, return sub-tokenizations
Eternal ID of this version: #1027861/1
Text MD5: 4fb999175c63e9487221d46b9965d9cd
Transpilation MD5: 8f5513d9aa8b4e3771a53d3629d5e51a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-16 12:46:41
Source code size: 499 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 179 / 229
Referenced in: [show references]