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

15
LINES

< > BotCompany Repo | #1022746 - tok_shortVisualize

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

Libraryless. Click here for Pure Java version (2243L/15K).

// visual bla(super); => visualize { ret bla(super.visualize()); }
svoid tok_shortVisualize(LS tok) {
  int i = -1;
  while ((i = jfind(tok, i+1, "visual <id>")) >= 0) {
    int j = tok_findEndOfStatement(tok, i);
    
    for (int k = i; k < j; k += 2)
      if (eqGet(tok, k, "super") && neqGet(tok, k+2, "."))
        tokSet(tok, k, "super.visualize()");
        
    tokSet(tok, j-1, "; }");
    tokSet(tok, i, "visualize { ret");
    reTok(tok, i, j);
  }
}

download  show line numbers  debug dex   

Travelled to 3 computer(s): cfunsshuasjs, mqqgnosmbjvj, tvejysmllsmz

No comments. add comment

Snippet ID: #1022746
Snippet name: tok_shortVisualize
Eternal ID of this version: #1022746/3
Text MD5: fcc39fa10cb0ab3257402ae73f1181cc
Transpilation MD5: 5d0af6d1fc77b3a5e177db810aca4f0d
Author: stefan
Category: javax / transpiling
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-08 13:57:21
Source code size: 476 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 124 / 144
Version history: 2 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1022746 & http://1022746.tinybrain.de