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

10
LINES

< > BotCompany Repo | #1001809 // findBlock

JavaX fragment (include)

static L<S> findBlock(S pat, L<S> tok) {
  L<S> tokpat = javaTok(pat);
  int i = findCodeTokens(tok, toStringArray(codeTokensOnly(tokpat)));
  //print("index of block " + quote(pat) + ": " + i);
  if (i < 0) ret null;
  int bracketIdx = i+tokpat.size()-3;
  assertEquals("{", tok.get(bracketIdx));
  int endIdx = findEndOfBlock(tok, bracketIdx);
  ret subList(tok, i-1, endIdx+1); // make it actual CNC
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001809
Snippet name: findBlock
Eternal ID of this version: #1001809/2
Text MD5: 70151c1bd231ecd5639239089de3b5a0
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-08-01 02:32:15
Source code size: 413 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 738 / 2161
Version history: 1 change(s)
Referenced in: [show references]