Beispiel #1
0
        override public void reportError(RecognitionException x, string rulename)
        {
            // Silently ignore errors which are very close to a previous matched one,
            // assuming that they are produced while the parser is trying to recover.
            if (LastErrorLine != -1 && x.getLine() - LastErrorLine < 3)
            {
                // Update it so we can extend the range as we go
                LastErrorLine = x.getLine();
                return;
            }

            // Override the reported error if there is matching pattern
            if (ErrorPatterns != null)
            {
                foreach (ErrorPattern pattern in ErrorPatterns)
                {
                    if (pattern.Matches(rulename, x))
                    {
                        LastErrorLine = x.getLine();
                        x             = new RecognitionException(
                            pattern.Message,
                            x.getFilename(),
                            x.getLine(),
                            x.getColumn()
                            );
                        break;
                    }
                }
            }

            reportError(x);
        }
Beispiel #2
0
        /* Overridden methods. */
        public override void reportError(RecognitionException ex)
        {
            OCLSyntaticException error = new OCLSyntaticException(ex.Message,
                                                                  new SourceLocation(getFilename(), ex.getLine(), ex.getColumn()));

            errors.Add(error);

            if (this.err != null)
            {
                this.err.WriteLine(error);
            }

            incErrorCount();
        }
Beispiel #3
0
	public override void reportError(RecognitionException ex)
	{
		LexicalPosition lpos = new LexicalPosition( ex.getLine(), ex.getColumn() );
		
		ErrorReport.Error( ex.getFilename(), lpos, ex.Message );
	}