public void SyntaxError(TextWriter output, IRecognizer recognizer, IToken offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e) { SyntaxErrorCode errorCode; if (e != null) { if (e.Data.Contains(Compilation.SyntaxError.DataKey_ErrorCode)) { errorCode = (SyntaxErrorCode)e.Data[Compilation.SyntaxError.DataKey_ErrorCode]; } else { errorCode = new SyntaxErrorCode("D0000", e.Message); } } else { errorCode = new SyntaxErrorCode("D0000", msg); } SyntaxErrors.Add(new SyntaxError { ErrorCode = errorCode, Column = charPositionInLine, Line = line }); }
private RecognitionException CreateRecognitionException(ParserRuleContext context, SyntaxErrorCode errorCode) { var error = new RecognitionException(parser, parser.InputStream, context); error.Data.Add(SyntaxError.DataKey_ErrorCode, errorCode); return(error); }