diff --git a/source/tlang/compiler/parser.d b/source/tlang/compiler/parser.d index 20ca98f..ef0a50f 100644 --- a/source/tlang/compiler/parser.d +++ b/source/tlang/compiler/parser.d @@ -25,14 +25,17 @@ public final class Parser /* TODO: Crash program if not */ if (!isFine) { - gprintln("Expected symbol of type " ~ to!(string)(symbol) ~ " but got " ~ to!( - string)(actualType) ~ " with " ~ token.toString(), DebugType.ERROR); - import core.stdc.stdlib; - - exit(0); + expect("Expected symbol of type " ~ to!(string)(symbol) ~ " but got " ~ to!( + string)(actualType) ~ " with " ~ token.toString()); } } + public static void expect(string message) + { + gprintln(message, DebugType.ERROR); + exit(0); + } + this(Token[] tokens) { this.tokens = tokens;