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)

static int tok_script_findEndOfType(LS tok) {
  ret tok_script_findEndOfType(tok, 1);
}

// i = beginning of type (identifier)
// index returned C index after type
// now does packages/inner classes too
static int tok_script_findEndOfType(LS tok, int i) {
  while licensed {
    if (eqGet(tok, i+2, ".") && isIdentifier(get(tok, i+4)))
      continue with i += 4;
    if (eqGet(tok, i+2, "<")
      && isIdentifier(get(tok, i+4))) // check for left-arrow script assignment
      continue with i = findEndOfTypeArgs(tok, i+2)-1;
    if (eqGet(tok, i+2, "["))
      continue with i = findEndOfBracketPart2(tok, i+2)-1;
    break;
  }
  ret i+2;
}

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: 143 / 159
Referenced in: [show references]