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

15
LINES

< > BotCompany Repo | #1032850 // tok_findEndOfAngleBracketPart

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

Libraryless. Click here for Pure Java version (3804L/22K).

1  
// i must point at the opening bracket (<)
2  
// index returned is index of closing bracket (>)
3  
// If there is NO opening bracket at i, we return nothing
4  
static int tok_findEndOfAngleBracketPart(LS tok, int i) {
5  
  int level = 0, n = l(tok);
6  
  while ping (i < n) {
7  
    S t = tok.get(i);
8  
    if (eq(t, "<")) ++level;
9  
    if (level < 1) ret i-2;
10  
    if (eq(t, ">")) --level;
11  
    if (level < 1) ret i;
12  
    i += 2;
13  
  }
14  
  ret n;
15  
}

Author comment

Began life as a copy of #1017794

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1032850
Snippet name: tok_findEndOfAngleBracketPart
Eternal ID of this version: #1032850/9
Text MD5: f6522690c481f3c3834e4d4b0abcd2be
Transpilation MD5: 374942ab486a41c003ae37e15ee7ca5f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-06 21:09:50
Source code size: 435 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 102 / 141
Version history: 8 change(s)
Referenced in: [show references]