Warning: session_start(): open(/var/lib/php/sessions/sess_r3f201rrnvhrndojntfdg40u8s, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
// e.g.
// void tailCall aka replace(Computable x) {...}
// to:
// void tailCall(Computable x) {...}
// void replace(Computable x) { tailCall(x); }
// (or the other way around)
svoid tok_akaFunctionNames(LS tok) {
int i;
while ((i = jfind(tok, " aka ")) >= 0) {
int iName1 = i, iLastName = i+4;
while (eqGet(tok, iLastName+2, "aka")
&& isIdentifier(tok, iLastName+4))
iLastName += 4;
// find arguments
int iOpening = indexOf(tok, iLastName, "(");
int iClosing = findEndOfBracketPart2(tok, iOpening)-1;
// find all names
new LS names;
for (int j = iName1; j <= iLastName; j += 4)
names.add(tok.get(j));
// find return type & modifiers
int iType = tok_leftScanType(tok, iName1);
int iStart = tok_leftScanTypeArgsOpt(tok, iType);
iStart = leftScanModifiers(tok, iStart);
// parse argument list
LS _args = subList(tok, iOpening+1, iClosing);
LS args = tok_parseArgsDeclList2(_args);
// analyze return type
LS type = subList(tok, iType-1, iName1); // return type
bool isVoid = containsOneOf(codeTokens(type), javaxVoidAliases());
// drop all but first name
clearTokens(tok, iName1+1, iLastName+1);
// add synonyms
tokAppend(tok, iClosing, joinMap(names, name ->
"\n" + joinSubList(tok, iStart, iName1)
+ name
+ joinSubList(tok, iLastName+1, iClosing+1)
+ " { " + stringIf(!isVoid, "return ")
+ name1 + "(" + joinWithComma(lmap tok_lastIdentifier(args)) + "); }"));
}
}