// doesn't reTok static LS tok_javaCallsToLeftArrowStyle(LS tok, int recursionLevel default 0) { bigLoop: for (int i = 1; i < l(tok); i += 2) { printVars ifdef tok_javaCallsToLeftArrowStyle_debug(+i, n := l(tok), +recursionLevel); if (isIdentifier(tok.get(i)) && eqGet(tok, i+2, "(")) { // move opening bracket in front of function name tokPrepend(tok, i, "("); // replace opening bracket with space replaceTokenWithSpace(tok, i+2); int iArg = i+4; while true { int iArgEnd = tok_endOfExpression(tok, iArg)+1; i = iArgEnd; LS argTok = subList(tok, iArg-1, iArgEnd); printVars ifdef tok_javaCallsToLeftArrowStyle_debug(+iArg, +iArgEnd, +argTok, +recursionLevel); // recurse for argument tok_javaCallsToLeftArrowStyle(argTok, recursionLevel+1); if (!eqGet(tok, iArgEnd, ",")) break; else { // replace comma with space replaceTokenWithSpace(tok, iArgEnd); iArg = iArgEnd+2; } } continue bigLoop; } } ret tok; }