Пример #1
0
        public void SyntaxError(TextWriter textWriter, IRecognizer recogniser, IToken token, int i1, int i2,
                                string msg, RecognitionException recognitionException)
        {
            var lexeme           = Builder.GetCurrentLexeme();
            var nonCommentLexeme = Builder.GetCurrentNonCommentLexeme();

            Builder.ResetCurrentLexeme(token.TokenIndex, token.TokenIndex);
            var mark = Builder.Mark();

            Builder.Done(mark, SpringNodeType.Error, new ErrorMessage(msg, token.StopIndex - token.StartIndex + 1));
            Builder.ResetCurrentLexeme(lexeme, nonCommentLexeme);
        }
Пример #2
0
            public override void SyntaxError(
                TextWriter output, IRecognizer recognizer, IToken offendingSymbol,
                int line, int charPositionInLine, string msg, RecognitionException e
                )
            {
                var curLexeme           = _builder.GetCurrentLexeme();
                var curNonCommentLexeme = _builder.GetCurrentNonCommentLexeme();

                _builder.ResetCurrentLexeme(offendingSymbol.TokenIndex, offendingSymbol.TokenIndex);

                var mark   = _builder.Mark();
                var length = offendingSymbol.StopIndex - offendingSymbol.StartIndex + 1;

                _builder.Done(mark, PascalNodeTypes.Error, new PascalErrorNodeType.Message(msg, length));

                _builder.ResetCurrentLexeme(curLexeme, curNonCommentLexeme);
            }