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

14
LINES

< > BotCompany Repo | #1035525 // tok_identifierSemicolonAsFunctionCall

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

Libraryless. Click here for Pure Java version (9833L/55K).

svoid tok_identifierSemicolonAsFunctionCall(LS tok) {
  // "myFunction;" instead of "myFunction();" - quite rough
  // (isolated identifier as function call)
  var cond = new TokCondition {
    public bool get(L<S> tok, int i) {
      S word = tok.get(i+3);
      //print("single word: " + word);
      ret !eqOneOf(word, "break", "continue", "return", "else", "endifdef", "endif");
    }
  };
  
  for (S pre : litlist("}", ";"))
    jreplace(tok, pre + " <id>;", "$1 $2();", cond);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035525
Snippet name: tok_identifierSemicolonAsFunctionCall
Eternal ID of this version: #1035525/1
Text MD5: 3deec3691fe9484d026257701a90f5f0
Transpilation MD5: e5808d0695f754967aed692a7ac23be6
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-06-04 04:56:30
Source code size: 498 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 146 / 185
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1035526 - Tok_IdentifierSemicolonToReturnStatement