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

17
LINES

< > BotCompany Repo | #1031294 // tok_pingify - add ping calls to for and while loops (so they are interruptible)

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

Libraryless. Click here for Pure Java version (3603L/22K).

1  
// Almost complete for Java code
2  
// but we should also cover function calls to be really complete
3  
// Incomplete for JavaX code
4  
svoid tok_pingify(LS tok) {
5  
  // Java
6  
  
7  
  jreplace(tok, "for (", "for ping (");
8  
  jreplace(tok, "while (", "while ping (");
9  
  jreplace(tok, "do {", "do { ping();");
10  
  
11  
  // JavaX - TODO: make sure we have all the constructs
12  
  
13  
  //jreplace(tok, "for $id to *:", "for $2 to $4: "... // TODO
14  
  
15  
  jreplace(tok, "while <id> {", "while $2 { ping();");
16  
  jreplace(tok, "repeat * {", "repeat $2 { ping();");
17  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031294
Snippet name: tok_pingify - add ping calls to for and while loops (so they are interruptible)
Eternal ID of this version: #1031294/3
Text MD5: eb3580624383f79304a944105fd63e7e
Transpilation MD5: de51b84aa7029cd07e4bc2980e2ee139
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-26 19:49:17
Source code size: 547 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 205 / 289
Version history: 2 change(s)
Referenced in: [show references]