com.sonar.sslr.api
Class RecognitionException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by com.sonar.sslr.api.RecognitionException
All Implemented Interfaces:
java.io.Serializable

public class RecognitionException
extends java.lang.RuntimeException

If a parsing error is encountered, an exception which implements this RecognitionException is thrown by the Parser. This RecognitionException allows to get some contextual information about the parsing error like the parsing stack trace.

See Also:
Serialized Form

Constructor Summary
RecognitionException(com.sonar.sslr.impl.events.ExtendedStackTrace extendedStackTrace, boolean isFatal)
           
RecognitionException(com.sonar.sslr.impl.LexerException e)
           
RecognitionException(com.sonar.sslr.impl.ParsingState parsingState, boolean isFatal)
           
RecognitionException(java.lang.String message, com.sonar.sslr.impl.ParsingState parsingState, boolean isFatal, java.lang.Throwable e)
           
 
Method Summary
 int getLine()
          Line where the parsing error has occurred.
 boolean isFatal()
           
 boolean isToRetryWithExtendStackTrace()
           
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RecognitionException

public RecognitionException(com.sonar.sslr.impl.ParsingState parsingState,
                            boolean isFatal)

RecognitionException

public RecognitionException(java.lang.String message,
                            com.sonar.sslr.impl.ParsingState parsingState,
                            boolean isFatal,
                            java.lang.Throwable e)

RecognitionException

public RecognitionException(com.sonar.sslr.impl.events.ExtendedStackTrace extendedStackTrace,
                            boolean isFatal)

RecognitionException

public RecognitionException(com.sonar.sslr.impl.LexerException e)
Method Detail

getLine

public int getLine()
Line where the parsing error has occurred.

Returns:
line

isToRetryWithExtendStackTrace

public boolean isToRetryWithExtendStackTrace()
Returns:
Whether or not it is worth to retry the parsing with the extended stack trace enabled.

isFatal

public boolean isFatal()
Returns:
True if this recognition exception is a fatal one (i.e. not in recovery mode).


Copyright © 2012 SonarSource. All Rights Reserved.