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

1  
static TokenRange jfind_range(L<S> tok, S in) {
2  
  ret jfind_range(tok, 1, in);
3  
}
4  
5  
static TokenRange jfind_range(L<S> tok, int startIdx, S in) {
6  
  ret jfind_range(tok, startIdx, in, null);
7  
}
8  
9  
static TokenRange jfind_range(L<S> tok, S in, O condition) {
10  
  ret jfind_range(tok, 1, in, condition);
11  
}
12  
13  
static TokenRange jfind_range(L<S> tok, int startIdx, S in, O condition) {
14  
  ret jfind_range(tok, startIdx, javaTokForJFind_array(in), condition);
15  
}
16  
17  
// assumes you preprocessed tokin
18  
static TokenRange jfind_range(L<S> tok, L<S> tokin) {
19  
  ret jfind_range(tok, 1, tokin);
20  
}
21  
22  
static TokenRange jfind_range(L<S> tok, int startIdx, L<S> tokin) {
23  
  ret jfind_range(tok, startIdx, tokin, null);
24  
}
25  
26  
static TokenRange jfind_range(LS tok, int startIdx, L<S> tokin, O condition) {
27  
  ret jfind_range(tok, startIdx, codeTokensAsStringArray(tokin), condition);
28  
}
29  
30  
static TokenRange jfind_range(LS tok, int startIdx, S[] tokinC, O condition) {
31  
  int i = findCodeTokens(tok, startIdx, false, tokinC, condition);
32  
  ret i < 0 ? null : TokenRange(i-1, i+l(tokinC)*2);
33  
}

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: 131 / 206
Version history: 3 change(s)
Referenced in: [show references]