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).

static LLS jextractAllIC_any_returnCNC(S s, S... patterns) {
  ret jextractAllIC_any_returnCNC(javaTok(s), patterns);
}

static LLS jextractAllIC_any_returnCNC(LS tok, S... patterns) {
  new TreeSet<Pair<Int>> set; // pair(startIndex, endIndex)
  for (S pat : patterns) {
    LS tokPat = javaTok(pat);
    jfind_preprocess(tokPat);
    set.addAll(map(jfindAllIC(tok, tokPat), i -> pair(i, i+l(tokPat)-2)));
  }
  ret mapPairsToList(set, (start, end) -> subList(tok, start-1, end+1));
}

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: 77 / 128
Referenced in: [show references]