Allowed function calls to have multiple arguments passed to them

parser_exception_before
Tristan B. Kildaire 2021-03-30 16:25:26 +02:00
parent 4610a2ba7b
commit f693d71a8a
2 changed files with 27 additions and 4 deletions

View File

@ -914,10 +914,31 @@ public final class Parser
/* If not expect arguments */
else
{
/* TODO: SHould be allowing , seperated arguments */
/* Parse an expression AND end on closing brace (expect) */
arguments ~= parseExpression();
expect(SymbolType.RBRACE, getCurrentToken());
while(true)
{
/* Get the Expression */
Expression exp = parseExpression();
/* Add it to list */
arguments ~= exp;
/* Check if we exiting */
if(getSymbolType(getCurrentToken()) == SymbolType.RBRACE)
{
break;
}
/* If comma expect more */
else if(getSymbolType(getCurrentToken()) == SymbolType.COMMA)
{
nextToken();
/* TODO: If rbrace after then error, so save boolean */
}
/* TODO: Add else, could have exited on `;` which is invalid closing */
else
{
expect("Function call closed on ;, invalid");
}
}
}

View File

@ -15,6 +15,8 @@ int o = myModule.l;
int f = f.L(f(1+f.d.d.d()));
int p = f2p.j2.p;
int ll = f(1,1);
public ubyte k = 1;
private ubyte k2 = 1;
protected ubyte k3 = 1-1;