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

37
LINES

< > BotCompany Repo | #1034877 // tok_javaCallsToLeftArrowStyle

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

Transpiled version (5184L) is out of date.

1  
// doesn't reTok
2  
static LS tok_javaCallsToLeftArrowStyle(LS tok, int recursionLevel default 0) {
3  
  bigLoop: for (int i = 1; i < l(tok); i += 2) {
4  
    printVars ifdef tok_javaCallsToLeftArrowStyle_debug(+i, n := l(tok), +recursionLevel);
5  
    if (isIdentifier(tok.get(i)) && eqGet(tok, i+2, "(")) {
6  
      // move opening bracket in front of function name
7  
      tokPrepend(tok, i, "(");
8  
      
9  
      // replace opening bracket with space
10  
      replaceTokenWithSpace(tok, i+2);
11  
      
12  
      int iArg = i+4;
13  
      while true {
14  
        int iArgEnd = tok_endOfExpression(tok, iArg)+1;
15  
        i = iArgEnd;
16  
        
17  
        LS argTok = subList(tok, iArg-1, iArgEnd);
18  
        printVars ifdef tok_javaCallsToLeftArrowStyle_debug(+iArg, +iArgEnd, +argTok, +recursionLevel);
19  
        
20  
        // recurse for argument
21  
        tok_javaCallsToLeftArrowStyle(argTok, recursionLevel+1);
22  
        
23  
        if (!eqGet(tok, iArgEnd, ","))
24  
          break;
25  
        else {
26  
          // replace comma with space
27  
          replaceTokenWithSpace(tok, iArgEnd);
28  
29  
          iArg = iArgEnd+2;
30  
        }
31  
      }
32  
      
33  
      continue bigLoop;
34  
    }
35  
  }
36  
  ret tok;
37  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1034877
Snippet name: tok_javaCallsToLeftArrowStyle
Eternal ID of this version: #1034877/12
Text MD5: 2b12f04f1f7c20bc00b359c3da3ee846
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-13 00:00:19
Source code size: 1170 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 90 / 169
Version history: 11 change(s)
Referenced in: [show references]