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

11
LINES

< > BotCompany Repo | #1024901 // tok_maxEquals - conflicts with float max = ...

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

Libraryless. Click here for Pure Java version (2396L/15K).

1  
// x max= blub(); => x = max(x, blub());
2  
svoid tok_maxEquals(LS tok) {
3  
  int i;
4  
  while ((i = jfind(tok, "<id> max=")) >= 0) {
5  
    S var = tok.get(i);
6  
    int j = tok_findEndOfExpression(tok, i);
7  
    replaceTokens(tok, i+2, i+5, "= max(" + var + ",");
8  
    tokAppend(tok, j-1, ")");
9  
    reTok(tok, i+2, j);
10  
  }
11  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024901
Snippet name: tok_maxEquals - conflicts with float max = ...
Eternal ID of this version: #1024901/3
Text MD5: 2856f654bef0928d5349a1ef555406bc
Transpilation MD5: fe9a82d9cf7ad258b9d0ecf8d27def61
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-29 12:22:20
Source code size: 321 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 194 / 300
Version history: 2 change(s)
Referenced in: [show references]