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

20
LINES

< > BotCompany Repo | #1001897 // "twice {" (JavaX translator, runs a code fragment twice)

JavaX translator [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (292L/3K/8K).

1  
// Syntax: twice { doFunnyStuff(); }
2  
// Replaced with: for (i = 0 to 2, you get the drift) { doFunnyStuff(); }
3  
4  
!752
5  
6  
p {
7  
  L<S> tok = tokMainJava();
8  
  
9  
  tok = replaceKeywordBlock(tok,
10  
    // keyword to match
11  
    "twice",
12  
    
13  
    // beginning of replacement block
14  
    "for (int __twice = 0; __twice < 2; __twice++) {",
15  
    
16  
    // end of replacement block
17  
    "}"); 
18  
    
19  
  saveMainJava(tok);
20  
}

Author comment

Began life as a copy of #1001886

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001897
Snippet name: "twice {" (JavaX translator, runs a code fragment twice)
Eternal ID of this version: #1001897/1
Text MD5: 2ae632ad637a59c43a8890fd0a5d0641
Transpilation MD5: 32af800ef05bd8c0f2d3f173c9b0fabf
Author: stefan
Category:
Type: JavaX translator
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-12-06 17:29:15
Source code size: 417 bytes / 20 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 548 / 1197
Referenced in: [show references]