public void SyntaxError(IRecognizer recognizer, int offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
        {
            DiagnosticMessage dm = new DiagnosticMessage()
            {
                Message   = msg,
                Line      = line - 1,
                Character = charPositionInLine,
                Symbol    = "",
                Length    = 1
            };

            if (offendingSymbol != 0)
            {
                dm.Symbol = recognizer.Vocabulary.GetDisplayName(offendingSymbol);
            }

            Messages.Add(dm);
        }
示例#2
0
        public override void SyntaxError(IRecognizer recognizer, IToken offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
        {
            DiagnosticMessage dm = new DiagnosticMessage()
            {
                Message   = msg,
                Line      = line - 1,
                Character = charPositionInLine,
                Symbol    = "",
                Length    = 0
            };

            if (offendingSymbol != null)
            {
                dm.Symbol = offendingSymbol.Text;
                dm.Length = offendingSymbol.StopIndex - offendingSymbol.StartIndex + 1;
            }

            Messages.Add(dm);
        }