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

15
LINES

< > BotCompany Repo | #1025434 // tok_equalsOptCast

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

Libraryless. Click here for Pure Java version (2779L/18K).

// S s = opt cast ...;
static LS tok_equalsOptCast(LS tok) {
  if (!tok.contains("cast")) ret tok;
  int iVar = -1;
  while ((iVar = jfind(tok, iVar+1, "<id> = opt cast")) >= 0) {
    int iTypeStart = tok_scanTypeBackwards(tok, iVar-2);
    int iCast = iVar+6;
    int j = scanToEndOfInitializer2(tok, iCast);
    S type = joinSubList(tok, iTypeStart, iVar-1);
    replaceTokens(tok, iCast-2, iCast+2, "optCast " + type + "(");
    tokPrepend(tok, j+1, ")");
    reTok(tok, iCast-2, j+2);
  }
  ret tok;
}

Author comment

Began life as a copy of #1021796

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1025434
Snippet name: tok_equalsOptCast
Eternal ID of this version: #1025434/3
Text MD5: 3084b94ef9202813fb130890bd045a96
Transpilation MD5: 14e48fefcb6f9de85c31b8517fc0f2fe
Author: stefan
Category: javax / transpiling
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-29 00:07:02
Source code size: 519 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 279 / 382
Version history: 2 change(s)
Referenced in: [show references]