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

11
LINES

< > BotCompany Repo | #1034382 // tok_retShortForReturn

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

Libraryless. Click here for Pure Java version (5779L/33K).

1  
svoid tok_retShortForReturn(LS tok) {
2  
  jreplace(tok, "ret", "return", tokCondition {
3  
    // haphazard attempts to find out if we are actually dealing
4  
    // with a variable called "ret"
5  
    
6  
    if (eqGetOneOf(tok, i-1, "int", "return", "(", "&")) false;
7  
    S next = _get(tok, i+3);
8  
    if (eq(next, ".")) ret isInteger(_get(tok, i+5)); // e.g. "ret .1", but not "ret.bla"
9  
    ret !eqOneOf(next, "=", ")");
10  
  });
11  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034382
Snippet name: tok_retShortForReturn
Eternal ID of this version: #1034382/1
Text MD5: a0f14bed76422f2936aafa0cef535936
Transpilation MD5: 559b9bc06d82e1740f1cb9ae62b8f54d
Author: stefan
Category: javax / transpiling
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-04 21:04:19
Source code size: 426 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 80 / 122
Referenced in: [show references]