EDIT 2: Full edit.
So, I want to implement an ErrorListener in my code. But I have a few problems and I have no idea how to solve them. Searching for Java equivalents was my first idea, but not many seem to do anything with the ErrorListener, which makes it harder for me.
So, this is my ErrorListener:
public class CodeError : BaseErrorListener
{
public override void SyntaxError(IRecognizer recognizer, IToken offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
{
Console.WriteLine("Error in parser at line " + ":" + e.OffendingToken.Column + e.OffendingToken.Line + e.Message);
base.SyntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, e);
}
And that's how I implemented it in my main code:
Debugger.CodeError ld = new Debugger.CodeError();
parser.AddErrorListener(ld);
I tried it and I always got this error: