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

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

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