Function calls implemented
This commit is contained in:
parent
da79f7f1d5
commit
0abfbf0b9e
|
@ -106,6 +106,12 @@ public final class Parser
|
|||
nextToken();
|
||||
parseIf();
|
||||
}
|
||||
/* If it is a function call */
|
||||
else if(symbol == SymbolType.IDENTIFIER)
|
||||
{
|
||||
parseFuncCall();
|
||||
}
|
||||
/* If it is closing the body `}` */
|
||||
else if(symbol == SymbolType.CCURLY)
|
||||
{
|
||||
// gprintln("Error");
|
||||
|
@ -262,6 +268,28 @@ public final class Parser
|
|||
gprintln("ParseTypedDec: Je suis fini");
|
||||
}
|
||||
|
||||
private void parseFuncCall()
|
||||
{
|
||||
gprintln("parseFuncCall(): Doing function call parsing");
|
||||
|
||||
nextToken();
|
||||
|
||||
|
||||
/* Expect an opening brace `(` */
|
||||
expect(SymbolType.LBRACE, getCurrentToken());
|
||||
nextToken();
|
||||
|
||||
/* Parse an expression AND end on closing brace (expect) */
|
||||
parseExpression();
|
||||
expect(SymbolType.RBRACE, getCurrentToken());
|
||||
nextToken();
|
||||
|
||||
/* Expect a semi-colon */
|
||||
expect(SymbolType.SEMICOLON, getCurrentToken());
|
||||
nextToken();
|
||||
|
||||
}
|
||||
|
||||
/* Almost like parseBody but has more */
|
||||
public void parse()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue