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

33
LINES

< > BotCompany Repo | #1028004 // jfind_range(s, pattern) - returns TokenRange (CNC)

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

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

static TokenRange jfind_range(L<S> tok, S in) {
  ret jfind_range(tok, 1, in);
}

static TokenRange jfind_range(L<S> tok, int startIdx, S in) {
  ret jfind_range(tok, startIdx, in, null);
}

static TokenRange jfind_range(L<S> tok, S in, O condition) {
  ret jfind_range(tok, 1, in, condition);
}

static TokenRange jfind_range(L<S> tok, int startIdx, S in, O condition) {
  ret jfind_range(tok, startIdx, javaTokForJFind_array(in), condition);
}

// assumes you preprocessed tokin
static TokenRange jfind_range(L<S> tok, L<S> tokin) {
  ret jfind_range(tok, 1, tokin);
}

static TokenRange jfind_range(L<S> tok, int startIdx, L<S> tokin) {
  ret jfind_range(tok, startIdx, tokin, null);
}

static TokenRange jfind_range(LS tok, int startIdx, L<S> tokin, O condition) {
  ret jfind_range(tok, startIdx, codeTokensAsStringArray(tokin), condition);
}

static TokenRange jfind_range(LS tok, int startIdx, S[] tokinC, O condition) {
  int i = findCodeTokens(tok, startIdx, false, tokinC, condition);
  ret i < 0 ? null : TokenRange(i-1, i+l(tokinC)*2);
}

Author comment

Began life as a copy of #1002429

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: #1028004
Snippet name: jfind_range(s, pattern) - returns TokenRange (CNC)
Eternal ID of this version: #1028004/4
Text MD5: 0fc3de8939fe8c20d798ffcd1ae713ce
Transpilation MD5: fb26b645fe36ac1bc29775e9a252e232
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-27 12:44:54
Source code size: 1081 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 127 / 202
Version history: 3 change(s)
Referenced in: [show references]