Beispiel #1
0
 /** <summary>
  *  Create tree node that holds the start and stop tokens associated
  *  with an error.
  *  </summary>
  *
  *  <remarks>
  *  If you specify your own kind of tree nodes, you will likely have to
  *  override this method. CommonTree returns Token.INVALID_TOKEN_TYPE
  *  if no token payload but you might have to set token type for diff
  *  node type.
  *
  *  You don't have to subclass CommonErrorNode; you will likely need to
  *  subclass your own tree node class to avoid class cast exception.
  *  </remarks>
  */
 public virtual object ErrorNode( ITokenStream input, IToken start, IToken stop,
                         RecognitionException e )
 {
     CommonErrorNode t = new CommonErrorNode( input, start, stop, e );
     //System.out.println("returning error node '"+t+"' @index="+input.index());
     return t;
 }
Beispiel #2
0
 public virtual object ErrorNode(ITokenStream input, IToken start, IToken stop,
                         RecognitionException e) {
     object node = adaptor.ErrorNode(input, start, stop, e);
     if (node != null) {
         dbg.ErrorNode(node);
     }
     return node;
 }
Beispiel #3
0
 public CommonErrorNode(ITokenStream input, IToken start, IToken stop,
                        RecognitionException e) {
     //System.out.println("start: "+start+", stop: "+stop);
     if (stop == null ||
          (stop.TokenIndex < start.TokenIndex &&
           stop.Type != TokenTypes.EndOfFile)) {
         // sometimes resync does not consume a token (when LT(1) is
         // in follow set.  So, stop will be 1 to left to start. adjust.
         // Also handle case where start is the first token and no token
         // is consumed during recovery; LT(-1) will return null.
         stop = start;
     }
     this.input = input;
     this.start = start;
     this.stop = stop;
     this.trappedException = e;
 }
Beispiel #4
0
 protected override object GetMissingSymbol( IIntStream input,
                                   RecognitionException e,
                                   int expectedTokenType,
                                   BitSet follow )
 {
     string tokenText = null;
     if ( expectedTokenType == TokenConstants.EOF )
         tokenText = "<missing EOF>";
     else
         tokenText = "<missing " + GetTokenNames()[expectedTokenType] + ">";
     CommonToken t = new CommonToken( expectedTokenType, tokenText );
     IToken current = ( (ITokenStream)input ).LT( 1 );
     if ( current.Type == TokenConstants.EOF )
     {
         current = ( (ITokenStream)input ).LT( -1 );
     }
     t.Line = current.Line;
     t.CharPositionInLine = current.CharPositionInLine;
     t.Channel = DEFAULT_TOKEN_CHANNEL;
     return t;
 }
Beispiel #5
0
 protected override object GetMissingSymbol( IIntStream input,
                                   RecognitionException e,
                                   int expectedTokenType,
                                   BitSet follow )
 {
     string tokenText = null;
     if ( expectedTokenType == TokenTypes.EndOfFile )
         tokenText = "<missing EOF>";
     else
         tokenText = "<missing " + TokenNames[expectedTokenType] + ">";
     CommonToken t = new CommonToken( expectedTokenType, tokenText );
     IToken current = ( (ITokenStream)input ).LT( 1 );
     if ( current.Type == TokenTypes.EndOfFile )
     {
         current = ( (ITokenStream)input ).LT( -1 );
     }
     t.Line = current.Line;
     t.CharPositionInLine = current.CharPositionInLine;
     t.Channel = DefaultTokenChannel;
     return t;
 }
Beispiel #6
0
 public override void RecognitionException(RecognitionException e) {
     numberReportedErrors++;
 }
Beispiel #7
0
 public override void SyntaxError(IRecognizer recognizer, IToken offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
 {
     Errors.Add(msg + " in  line: " + line + ", position: " + charPositionInLine);
 }
Beispiel #8
0
        public override void SyntaxError(IRecognizer recognizer, IToken offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
        {
            ErrorCount++;

            IList <String> stack = ((Antlr4.Runtime.Parser)recognizer).GetRuleInvocationStack();

            foreach (string ruleInvocation in stack.Reverse())
            {
                errorLog.AppendLine(ruleInvocation);
            }
            errorLog.AppendLine("line " + line + ":" + charPositionInLine + " at " + offendingSymbol);
            errorLog.AppendLine("=> " + msg);
            errorLog.AppendLine();
        }
Beispiel #9
0
 public void SyntaxError(IRecognizer recognizer, IToken offendingSymbol, int line, int charPositionInLine, string msg,
                         RecognitionException e)
 {
     Console.Error.WriteLine(recognizer.InputStream.SourceName + " line " + line + ":" + charPositionInLine + " " + msg);
 }
        protected virtual void Dispatch(string line)
        {
            //[email protected]( "event: " + line );
            string[] elements = GetEventElements(line);
            if (elements == null || elements[0] == null)
            {
                Console.Error.WriteLine("unknown debug event: " + line);
                return;
            }
            if (elements[0].Equals("enterRule"))
            {
                listener.EnterRule(elements[1], elements[2]);
            }
            else if (elements[0].Equals("exitRule"))
            {
                listener.ExitRule(elements[1], elements[2]);
            }
            else if (elements[0].Equals("enterAlt"))
            {
                listener.EnterAlt(int.Parse(elements[1]));
            }
            else if (elements[0].Equals("enterSubRule"))
            {
                listener.EnterSubRule(int.Parse(elements[1]));
            }
            else if (elements[0].Equals("exitSubRule"))
            {
                listener.ExitSubRule(int.Parse(elements[1]));
            }
            else if (elements[0].Equals("enterDecision"))
            {
                listener.EnterDecision(int.Parse(elements[1]), elements[2].Equals("true"));
            }
            else if (elements[0].Equals("exitDecision"))
            {
                listener.ExitDecision(int.Parse(elements[1]));
            }
            else if (elements[0].Equals("location"))
            {
                listener.Location(int.Parse(elements[1]),
                                  int.Parse(elements[2]));
            }
            else if (elements[0].Equals("consumeToken"))
            {
                ProxyToken t = DeserializeToken(elements, 1);
                if (t.TokenIndex == previousTokenIndex)
                {
                    tokenIndexesInvalid = true;
                }
                previousTokenIndex = t.TokenIndex;
                listener.ConsumeToken(t);
            }
            else if (elements[0].Equals("consumeHiddenToken"))
            {
                ProxyToken t = DeserializeToken(elements, 1);
                if (t.TokenIndex == previousTokenIndex)
                {
                    tokenIndexesInvalid = true;
                }
                previousTokenIndex = t.TokenIndex;
                listener.ConsumeHiddenToken(t);
            }
            else if (elements[0].Equals("LT"))
            {
                IToken t = DeserializeToken(elements, 2);
                listener.LT(int.Parse(elements[1]), t);
            }
            else if (elements[0].Equals("mark"))
            {
                listener.Mark(int.Parse(elements[1]));
            }
            else if (elements[0].Equals("rewind"))
            {
                if (elements[1] != null)
                {
                    listener.Rewind(int.Parse(elements[1]));
                }
                else
                {
                    listener.Rewind();
                }
            }
            else if (elements[0].Equals("beginBacktrack"))
            {
                listener.BeginBacktrack(int.Parse(elements[1]));
            }
            else if (elements[0].Equals("endBacktrack"))
            {
                int level    = int.Parse(elements[1]);
                int successI = int.Parse(elements[2]);
                listener.EndBacktrack(level, successI == DebugEventListenerConstants.True);
            }
            else if (elements[0].Equals("exception"))
            {
#if true
                throw new System.NotImplementedException();
#else
                string excName  = elements[1];
                string indexS   = elements[2];
                string lineS    = elements[3];
                string posS     = elements[4];
                Class  excClass = null;
                try
                {
                    excClass = Class.forName(excName);
                    RecognitionException e =
                        (RecognitionException)excClass.newInstance();
                    e.index = int.Parse(indexS);
                    e.line  = int.Parse(lineS);
                    e.charPositionInLine = int.Parse(posS);
                    listener.recognitionException(e);
                }
                catch (ClassNotFoundException cnfe)
                {
                    Console.Error.println("can't find class " + cnfe);
                    cnfe.printStackTrace(Console.Error);
                }
                catch (InstantiationException ie)
                {
                    Console.Error.println("can't instantiate class " + ie);
                    ie.printStackTrace(Console.Error);
                }
                catch (IllegalAccessException iae)
                {
                    Console.Error.println("can't access class " + iae);
                    iae.printStackTrace(Console.Error);
                }
#endif
            }
            else if (elements[0].Equals("beginResync"))
            {
                listener.BeginResync();
            }
            else if (elements[0].Equals("endResync"))
            {
                listener.EndResync();
            }
            else if (elements[0].Equals("terminate"))
            {
                listener.Terminate();
            }
            else if (elements[0].Equals("semanticPredicate"))
            {
                bool   result        = bool.Parse(elements[1]);
                string predicateText = elements[2];
                predicateText = UnEscapeNewlines(predicateText);
                listener.SemanticPredicate(result,
                                           predicateText);
            }
            else if (elements[0].Equals("consumeNode"))
            {
                ProxyTree node = DeserializeNode(elements, 1);
                listener.ConsumeNode(node);
            }
            else if (elements[0].Equals("LN"))
            {
                int       i    = int.Parse(elements[1]);
                ProxyTree node = DeserializeNode(elements, 2);
                listener.LT(i, node);
            }
            else if (elements[0].Equals("createNodeFromTokenElements"))
            {
                int    ID   = int.Parse(elements[1]);
                int    type = int.Parse(elements[2]);
                string text = elements[3];
                text = UnEscapeNewlines(text);
                ProxyTree node = new ProxyTree(ID, type, -1, -1, -1, text);
                listener.CreateNode(node);
            }
            else if (elements[0].Equals("createNode"))
            {
                int ID         = int.Parse(elements[1]);
                int tokenIndex = int.Parse(elements[2]);
                // create dummy node/token filled with ID, tokenIndex
                ProxyTree  node  = new ProxyTree(ID);
                ProxyToken token = new ProxyToken(tokenIndex);
                listener.CreateNode(node, token);
            }
            else if (elements[0].Equals("nilNode"))
            {
                int       ID   = int.Parse(elements[1]);
                ProxyTree node = new ProxyTree(ID);
                listener.NilNode(node);
            }
            else if (elements[0].Equals("errorNode"))
            {
                // TODO: do we need a special tree here?
                int    ID   = int.Parse(elements[1]);
                int    type = int.Parse(elements[2]);
                string text = elements[3];
                text = UnEscapeNewlines(text);
                ProxyTree node = new ProxyTree(ID, type, -1, -1, -1, text);
                listener.ErrorNode(node);
            }
            else if (elements[0].Equals("becomeRoot"))
            {
                int       newRootID = int.Parse(elements[1]);
                int       oldRootID = int.Parse(elements[2]);
                ProxyTree newRoot   = new ProxyTree(newRootID);
                ProxyTree oldRoot   = new ProxyTree(oldRootID);
                listener.BecomeRoot(newRoot, oldRoot);
            }
            else if (elements[0].Equals("addChild"))
            {
                int       rootID  = int.Parse(elements[1]);
                int       childID = int.Parse(elements[2]);
                ProxyTree root    = new ProxyTree(rootID);
                ProxyTree child   = new ProxyTree(childID);
                listener.AddChild(root, child);
            }
            else if (elements[0].Equals("setTokenBoundaries"))
            {
                int       ID   = int.Parse(elements[1]);
                ProxyTree node = new ProxyTree(ID);
                listener.SetTokenBoundaries(
                    node,
                    int.Parse(elements[2]),
                    int.Parse(elements[3]));
            }
            else
            {
                Console.Error.WriteLine("unknown debug event: " + line);
            }
        }
 /// <summary>Parser error-reporting function can be overridden in subclass 
 /// </summary>
 public override void reportError(RecognitionException ex)
 {
     parserEventSupport.fireReportError(ex);
     base.reportError(ex);
 }
Beispiel #12
0
 protected override object GetMissingSymbol( IIntStream input,
                                   RecognitionException e,
                                   int expectedTokenType,
                                   BitSet follow )
 {
     string tokenText =
         "<missing " + GetTokenNames()[expectedTokenType] + ">";
     return new CommonTree( new CommonToken( expectedTokenType, tokenText ) );
 }
Beispiel #13
0
 public override void SyntaxError(TextWriter output, IRecognizer recognizer, IToken offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
 {
     _errors.Add($"({line}, {charPositionInLine + 1}): {msg}");
 }
 public void ReportError(Parser recognizer, RecognitionException e)
 {
     ExceptionDispatchInfo.Capture(e).Throw();
 }
        // if using ANTLR4cs, signature should be:
        // public override void SyntaxError(IRecognizer recognizer, IToken offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)

        public override void SyntaxError(TextWriter output, IRecognizer recognizer, IToken offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
        {
            Writer.WriteLine(msg);

            Symbol = offendingSymbol.Text;
        }
Beispiel #16
0
 public override void SyntaxError(IRecognizer recognizer, IToken offendingSymbol, int line,
                                  int charPositionInLine, string msg, RecognitionException e)
 {
     log.error(new DiagnosticPosition(line, charPositionInLine), msg);
 }
Beispiel #17
0
 public void SyntaxError([NotNull] IRecognizer recognizer, [Nullable] IToken offendingSymbol, int line, int charPositionInLine, [NotNull] string msg, [Nullable] RecognitionException e)
 {
     System.Diagnostics.Debug.WriteLine(msg);
 }
 public void ReportError(Parser recognizer, RecognitionException e)
 {
     //   throw new NotImplementedException();
 }
Beispiel #19
0
        public override void ReportError( RecognitionException e )
        {
            /** TODO: not thought about recovery in lexer yet.
             *
            // if we've already reported an error and have not matched a token
            // yet successfully, don't report any errors.
            if ( errorRecovery ) {
                //System.err.print("[SPURIOUS] ");
                return;
            }
            errorRecovery = true;
             */

            DisplayRecognitionError( this.GetTokenNames(), e );
        }
Beispiel #20
0
 /** <summary>
  *  Lexers can normally match any char in it's vocabulary after matching
  *  a token, so do the easy thing and just kill a character and hope
  *  it all works out.  You can instead use the rule invocation stack
  *  to do sophisticated error recovery if you are in a fragment rule.
  *  </summary>
  */
 public virtual void Recover( RecognitionException re )
 {
     //System.out.println("consuming char "+(char)input.LA(1)+" during recovery");
     //re.printStackTrace();
     input.Consume();
 }
Beispiel #21
0
        public virtual void LexerError(string srcName, string msg, IToken templateToken, RecognitionException e)
        {
            if (srcName != null)
            {
                srcName = Path.GetFileName(srcName);
            }

            listener.CompiletimeError(new TemplateLexerMessage(srcName, msg, templateToken, e));
        }
Beispiel #22
0
 /** <summary>
  *  Tree parsers parse nodes they usually have a token object as
  *  payload. Set the exception token and do the default behavior.
  *  </summary>
  */
 public override string GetErrorMessage( RecognitionException e, string[] tokenNames )
 {
     if ( this is TreeParser )
     {
         ITreeAdaptor adaptor = ( (ITreeNodeStream)e.input ).TreeAdaptor;
         e.token = adaptor.GetToken( e.node );
         if ( e.token == null )
         { // could be an UP/DOWN node
             e.token = new CommonToken( adaptor.GetType( e.node ),
                                       adaptor.GetText( e.node ) );
         }
     }
     return base.GetErrorMessage( e, tokenNames );
 }
Beispiel #23
0
 public virtual void GroupLexerError(ErrorType error, string srcName, RecognitionException e, string msg)
 {
     listener.CompiletimeError(new TemplateGroupCompiletimeMessage(error, srcName, e.Token, e, msg));
 }
Beispiel #24
0
 protected override object GetMissingSymbol( IIntStream input,
                                   RecognitionException e,
                                   int expectedTokenType,
                                   BitSet follow )
 {
     object o = base.GetMissingSymbol( input, e, expectedTokenType, follow );
     dbg.ConsumeNode( o );
     return o;
 }
Beispiel #25
0
 public void SyntaxError(TextWriter output, IRecognizer recognizer, int offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
 {
     errorLoggers.LogError($"({line},{charPositionInLine}) - LexicographicError {msg}");
 }
Beispiel #26
0
 /** <summary>
  *  Lexers can normally match any char in it's vocabulary after matching
  *  a token, so do the easy thing and just kill a character and hope
  *  it all works out.  You can instead use the rule invocation stack
  *  to do sophisticated error recovery if you are in a fragment rule.
  *  </summary>
  */
 public virtual void Recover(RecognitionException re)
 {
     //System.out.println("consuming char "+(char)input.LA(1)+" during recovery");
     //re.printStackTrace();
     input.Consume();
 }
Beispiel #27
0
 public virtual void SyntaxError(IRecognizer recognizer, int offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
 {
 }
    public override void DisplayRecognitionError(string[] tokenNames, RecognitionException e)
    {
        RecognitionExceptions.Add(e);

        base.DisplayRecognitionError(tokenNames, e);
    }
Beispiel #29
0
	public override void reportError(RecognitionException ex)
	{
		LexicalPosition lpos = new LexicalPosition( ex.getLine(), ex.getColumn() );
		
		ErrorReport.Error( ex.getFilename(), lpos, ex.Message );
	}
Beispiel #30
0
 public override void SyntaxError(TextWriter output, IRecognizer recognizer, IToken offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
 {
     errorLoggers.LogError($"({line},{charPositionInLine}) - SyntaticError {msg}");
     base.SyntaxError(output, recognizer, offendingSymbol, line, charPositionInLine, msg, e);
 }
 public void SyntaxError(IRecognizer recognizer, Antlr4.Runtime.IToken offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
 {
     mCompiler.mLogger.Error($"Syntax error: {msg} ({offendingSymbol.Line}:{offendingSymbol.Column})");
 }
Beispiel #32
0
        public override void SyntaxError(IRecognizer recognizer, IToken offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
        {
            Console.WriteLine(msg);

            base.SyntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, e);
        }
 public override void ReportError(RecognitionException e)
 {
     _parseErrorHandler.ReportError(e);
 }
Beispiel #34
0
 public virtual void RecognitionException( RecognitionException e )
 {
     for ( int i = 0; i < _listeners.Count; i++ )
     {
         IDebugEventListener listener = _listeners[i];
         listener.RecognitionException( e );
     }
 }
Beispiel #35
0
 //IAntlrErrorListener<int> implementation
 public void SyntaxError(IRecognizer recognizer, int offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
 {
     throw new ArgumentException("Invalid Expression: {0}", msg, e);
 }
Beispiel #36
0
 public virtual void RecognitionException( RecognitionException e )
 {
     _listener.RecognitionException( e );
 }
Beispiel #37
0
 public void SyntaxError(IRecognizer recognizer, int symbol, int line, int charPositionInLine, string msg, RecognitionException e)
 {
     if (OnError != null)
     {
         OnError(string.Format("Lexer error at line {0}, char {1} --> {2}", line, charPositionInLine, msg));
     }
 }
Beispiel #38
0
 public override void RecognitionException(RecognitionException e)
 {
     stats.numReportedErrors++;
 }
Beispiel #39
0
 public void SyntaxError(TextWriter output, IRecognizer recognizer, IToken offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
 {
     m_scanner.m_warnings.Add($"{Path.GetFileName(m_scanner.SourceFileName)}:{line}:{charPositionInLine}: {msg}");
 }
Beispiel #40
0
 public override string GetErrorMessage( RecognitionException e, string[] tokenNames )
 {
     string msg = null;
     if ( e is MismatchedTokenException )
     {
         MismatchedTokenException mte = (MismatchedTokenException)e;
         msg = "mismatched character " + GetCharErrorDisplay( e.c ) + " expecting " + GetCharErrorDisplay( mte.expecting );
     }
     else if ( e is NoViableAltException )
     {
         NoViableAltException nvae = (NoViableAltException)e;
         // for development, can add "decision=<<"+nvae.grammarDecisionDescription+">>"
         // and "(decision="+nvae.decisionNumber+") and
         // "state "+nvae.stateNumber
         msg = "no viable alternative at character " + GetCharErrorDisplay( e.c );
     }
     else if ( e is EarlyExitException )
     {
         EarlyExitException eee = (EarlyExitException)e;
         // for development, can add "(decision="+eee.decisionNumber+")"
         msg = "required (...)+ loop did not match anything at character " + GetCharErrorDisplay( e.c );
     }
     else if ( e is MismatchedNotSetException )
     {
         MismatchedNotSetException mse = (MismatchedNotSetException)e;
         msg = "mismatched character " + GetCharErrorDisplay( e.c ) + " expecting set " + mse.expecting;
     }
     else if ( e is MismatchedSetException )
     {
         MismatchedSetException mse = (MismatchedSetException)e;
         msg = "mismatched character " + GetCharErrorDisplay( e.c ) + " expecting set " + mse.expecting;
     }
     else if ( e is MismatchedRangeException )
     {
         MismatchedRangeException mre = (MismatchedRangeException)e;
         msg = "mismatched character " + GetCharErrorDisplay( e.c ) + " expecting set " +
               GetCharErrorDisplay( mre.a ) + ".." + GetCharErrorDisplay( mre.b );
     }
     else
     {
         msg = base.GetErrorMessage( e, tokenNames );
     }
     return msg;
 }
Beispiel #41
0
        public void SyntaxError(IRecognizer recognizer, int offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
        {
            var          lexer = (Lexer)recognizer;
            const string mess  = "Недопустимая последовательность символов";
            string       last  = "";

            if (lexer.CharIndex < _fieldValue.Length)
            {
                last += _fieldValue[lexer.CharIndex];
            }
            if (lexer.Token != null)
            {
                var t = lexer.Token;
                _keeper.AddError(mess, t.Text.Trim() + last, t.Line, t.Column, t);
            }
            else
            {
                _keeper.AddError(mess, lexer.Text.Trim() + last, line, charPositionInLine);
            }
        }
 protected override object GetMissingSymbol( IIntStream input,
                                   RecognitionException e,
                                   int expectedTokenType,
                                   BitSet follow )
 {
     string tokenText =
         "<missing " + TokenNames[expectedTokenType] + ">";
     ITreeAdaptor adaptor = ((ITreeNodeStream)e.Input).TreeAdaptor;
     return adaptor.Create(new CommonToken(expectedTokenType, tokenText));
 }
Beispiel #43
0
        public void SyntaxError(IRecognizer recognizer, IToken offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
        {
            string mess  = "Ошибка разбора выражения";
            IToken token = offendingSymbol;

            if (offendingSymbol != null)
            {
                if (offendingSymbol.Text == "<EOF>")
                {
                    mess  = "Ошибка в конце выражения";
                    token = null;
                }
                else
                {
                    mess = "Недопустимое использование лексемы";
                }
            }
            if (token != null)
            {
                _keeper.AddError(mess, token);
            }
            else
            {
                _keeper.AddError(mess, null, line, charPositionInLine);
            }
        }
Beispiel #44
0
 /** <summary>
  *  Prefix error message with the grammar name because message is
  *  always intended for the programmer because the parser built
  *  the input tree not the user.
  *  </summary>
  */
 public override string GetErrorHeader( RecognitionException e )
 {
     return GrammarFileName + ": node from " +
            ( e.approximateLineInfo ? "after " : "" ) + "line " + e.line + ":" + e.charPositionInLine;
 }
Beispiel #45
0
 public override object ErrorNode(ITokenStream input, IToken start, IToken stop, RecognitionException e)
 {
     return(new COOLCommonErrorNode(input, start, stop, e));
 }
Beispiel #46
0
 public override void RecognitionException( RecognitionException e )
 {
     if ( backtracking > 0 )
         return;
     ParseTree ruleNode = callStack.Peek();
     ParseTree errorNode = Create( e );
     ruleNode.AddChild( errorNode );
 }
Beispiel #47
0
 public override void SyntaxError(IRecognizer recognizer, IToken offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
 {
     if (receiveMessage != null)
     {
         receiveMessage(new SqlParseMessage(msg, SqlParseMessageLevel.Error, new LocationInfo(line, charPositionInLine)));
     }
 }
Beispiel #48
0
 public override void RecognitionException(RecognitionException e) {
     StringBuilder buf = new StringBuilder(50);
     buf.Append("exception\t");
     buf.Append(e.GetType().Name);
     // dump only the data common to all exceptions for now
     buf.Append("\t");
     buf.Append(e.Index);
     buf.Append("\t");
     buf.Append(e.Line);
     buf.Append("\t");
     buf.Append(e.CharPositionInLine);
     Transmit(buf.ToString());
 }
Beispiel #49
0
 /// <summary>Parser error-reporting function can be overridden in subclass
 /// </summary>
 public override void  reportError(RecognitionException ex)
 {
     parserEventSupport.fireReportError(ex);
     base.reportError(ex);
 }
 public virtual void RecognitionException( RecognitionException e )
 {
 }
Beispiel #51
0
 public override void SyntaxError(TextWriter output, IRecognizer recognizer, S offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
 {
     had_error = true;
     base.SyntaxError(output, recognizer, offendingSymbol, line, charPositionInLine, msg, e);
 }
Beispiel #52
0
 public override void ReportError(RecognitionException e) {
     base.ReportError(e);
     dbg.RecognitionException(e);
 }
 public override void SyntaxError(TextWriter output, IRecognizer recognizer, IToken symbol, int ln, int col, string msg, RecognitionException e)
 => throw new SyntaxErrorException(msg, ln, col, e);