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

11
LINES

< > BotCompany Repo | #1028005 // tok_parseRepeatSymbols1 - find "||: ... :||" sections (including incomplete ones)

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

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

1  
// handles only one repeat section so far
2  
// returns pre, repeat section, post
3  
static T3S tok_parseRepeatSymbols1(LS tok) {
4  
  IntRange r1 = jfind_range(tok, "||:"), r2 = jfind_range(tok, ":||");
5  
  if (r1 == null && r2 == null) null;
6  
  if (r1 == null) r1 = IntRange(0, 0);
7  
  if (r2 == null) r2 = IntRange(l(tok), l(tok));
8  
  ret t3(joinSubList(tok, 1, r1.start),
9  
    joinSubList(tok, r1.end, r2.start),
10  
    joinSubList(tok, r2.end, l(tok)-1));
11  
}

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: #1028005
Snippet name: tok_parseRepeatSymbols1 - find "||: ... :||" sections (including incomplete ones)
Eternal ID of this version: #1028005/2
Text MD5: 357e6dac48ea3e16225134acde5d08a3
Transpilation MD5: bda5db3882e5dc66752297861a0408e2
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:49:55
Source code size: 453 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 188 / 275
Version history: 1 change(s)
Referenced in: [show references]