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).

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

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: 142 / 209
Referenced in: [show references]