SyntaxError

- The generated message now uses `report(string, Token)` to generate its `msg`
This commit is contained in:
Tristan B. Velloza Kildaire 2024-04-02 21:28:26 +02:00
parent bfa1295c06
commit adb6b203d1
1 changed files with 6 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import tlang.compiler.symbols.check;
import tlang.compiler.symbols.data;
import tlang.compiler.lexer.core.tokens : Token;
import std.conv : to;
import tlang.compiler.reporting : LineInfo, report;
public class ParserException : TError
{
@ -38,6 +39,10 @@ public final class SyntaxError : ParserException
super(parser);
msg = "Syntax error: Expected "~to!(string)(expected)~" but got "~to!(string)(provided)~", see "~providedToken.toString();
msg = report
(
"Syntax error: Expected "~to!(string)(expected)~" but got "~to!(string)(provided)~", see "~providedToken.toString(),
providedToken
);
}
}