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

20
LINES

< > BotCompany Repo | #1036486 // tok_script_findEndOfType

JavaX fragment (include)

1  
static int tok_script_findEndOfType(LS tok) {
2  
  ret tok_script_findEndOfType(tok, 1);
3  
}
4  
5  
// i = beginning of type (identifier)
6  
// index returned C index after type
7  
// now does packages/inner classes too
8  
static int tok_script_findEndOfType(LS tok, int i) {
9  
  while licensed {
10  
    if (eqGet(tok, i+2, ".") && isIdentifier(get(tok, i+4)))
11  
      continue with i += 4;
12  
    if (eqGet(tok, i+2, "<")
13  
      && isIdentifier(get(tok, i+4))) // check for left-arrow script assignment
14  
      continue with i = findEndOfTypeArgs(tok, i+2)-1;
15  
    if (eqGet(tok, i+2, "["))
16  
      continue with i = findEndOfBracketPart2(tok, i+2)-1;
17  
    break;
18  
  }
19  
  ret i+2;
20  
}

Author comment

Began life as a copy of #1023407

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036486
Snippet name: tok_script_findEndOfType
Eternal ID of this version: #1036486/1
Text MD5: c06b3ea89fc6cb2d353fbdd1851bf1ae
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-12-18 02:10:20
Source code size: 663 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 144 / 161
Referenced in: [show references]