Multiple function declarations can now be parsed, previous error was due to exiting only when we were out of tokens, now we exit after consuming `}` after the call to parseBody()

expression_parsing
Tristan B. Kildaire 2021-03-16 10:57:04 +02:00
parent 0ea5b78a2f
commit 81a4c0537b
2 changed files with 4 additions and 2 deletions

View File

@ -243,6 +243,8 @@ public final class Parser
/* Parse the body (and it leaves ONLY when it gets the correct symbol, no expect needed) */ /* Parse the body (and it leaves ONLY when it gets the correct symbol, no expect needed) */
parseBody(); parseBody();
nextToken(); nextToken();
break;
} }
else if (getSymbolType(getCurrentToken()) == SymbolType.COMMA) else if (getSymbolType(getCurrentToken()) == SymbolType.COMMA)
{ {
@ -256,9 +258,9 @@ public final class Parser
gprintln("ParseFuncDef: ParameterDec: (Type: " ~ type ~ ", Identifier: " ~ identifier ~ ")", gprintln("ParseFuncDef: ParameterDec: (Type: " ~ type ~ ", Identifier: " ~ identifier ~ ")",
DebugType.WARNING); DebugType.WARNING);
gprintln("ParseFuncDef: Parameter count: " ~ to!(string)(parameterCount));
} }
gprintln("ParseFuncDef: Parameter count: " ~ to!(string)(parameterCount));
gprintln("parseFuncDef(): Leave", DebugType.WARNING); gprintln("parseFuncDef(): Leave", DebugType.WARNING);
} }

View File

@ -73,7 +73,7 @@ void main(int hello, byte d)
} }
} }
void k(int j) void k(int j, int k)
{ {
} }