WIP: Make the compiler more like a library

This commit is contained in:
Tristan B. Kildaire 2021-06-08 10:30:15 +02:00
parent 5c566644c3
commit 8028fc1d7b
2 changed files with 18 additions and 2 deletions

View File

@ -45,7 +45,21 @@ void beginCompilation(string[] sourceFiles)
gprintln("Parsing tokens...");
Parser parser = new Parser(currentLexer.getTokens());
Module modulle = parser.parse();
Module modulle;
import misc.exceptions;
try
{
modulle = parser.parse();
}
catch(TError e)
{
gprintln(e.msg, DebugType.ERROR);
exit(0); /* TODO: Exit code */ /* TODO: Version that returns or asserts for unit tests */
}
gprintln("Type checking and symbol resolution...");
try

View File

@ -55,11 +55,13 @@ public final class Parser
if(isUnitTest)
{
throw new TError(message);
assert(false);
}
else
{
exit(0); /* TODO: Exit code */ /* TODO: Version that returns or asserts for unit tests */
throw new TError(message);
//exit(0); /* TODO: Exit code */ /* TODO: Version that returns or asserts for unit tests */
}
}