Added class parsing to `parse()` and updated test case to test it

expression_parsing.sync-conflict-20210316-090018-O3W7KWN
Tristan B. V. Kildaire 2021-03-05 11:21:06 +02:00
parent 5c37112f42
commit f62c2bbc02
3 changed files with 24 additions and 1 deletions

View File

@ -375,6 +375,7 @@ public final class Parser
/* TODO: Ending here, expect closing `}`? */ /* TODO: Ending here, expect closing `}`? */
nextToken();
} }
private void parseStatement() private void parseStatement()
@ -434,9 +435,14 @@ public final class Parser
gprintln("parse()::woah: Current token: "~tok.getToken()); gprintln("parse()::woah: Current token: "~tok.getToken());
} }
/* If it is a class */
else if(symbol == SymbolType.CLASS)
{
parseClass();
}
else else
{ {
gprintln("parse(): Geen idee", DebugType.ERROR); gprintln("parse(): Unknown '"~tok.getToken()~"'", DebugType.ERROR);
exit(0); exit(0);
} }
} }

View File

@ -40,6 +40,7 @@ public enum SymbolType
CASE, CASE,
GOTO, GOTO,
DO, DO,
DELETE,
UNKNOWN UNKNOWN
} }
@ -187,6 +188,11 @@ public static SymbolType getSymbolType(Token tokenIn)
{ {
return SymbolType.DO; return SymbolType.DO;
} }
/* delete keyword */
else if(cmp(token, "delete") == 0)
{
return SymbolType.DELETE;
}

View File

@ -3,6 +3,17 @@ ubyte y;
ubyte k = 1; ubyte k = 1;
class clazzOne
{
}
class clazzTwo
{
}
void main(int hello, byte d) void main(int hello, byte d)
{ {
ubyte thing = "Hello"; ubyte thing = "Hello";