http://www.jpicedt.org

jpicedt.format.input.util
Class REParserException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by jpicedt.graphic.io.parser.ParserException
              extended by jpicedt.format.input.util.REParserException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
REParserException.BeginGroupMismatch, REParserException.BlockMismatch, REParserException.EndGroupMismatch, REParserException.EndOfPicture, REParserException.EndOfPictureNotFound, REParserException.EOF, REParserException.IncompleteSequence, REParserException.NotFoundInFile, REParserException.NumberFormat, REParserException.NumberSign, REParserException.SyntaxError

public class REParserException
extends ParserException

An Exception manager to be used by RE-parsers (i.e. those built on top of AbstractRegularExpression's).

The main purpose is to build a meaningfull string so that the user may be able to precisely locate the source of the syntax error and what kind of error it is.

See also: key-entries starting with "parser-exception" in jpicedt/lang/i18n_xx.properties resource files.

[Developpers] : new exceptions should be implemented as inner static classes so as to reduce namespace pollution. Simply inherit your class from REParserException, feeding the mother-class constructor with a key-entry string of your choice, then add an appropriate key/value pair in EACH jpicedt/lang.i18n_xx.properties resource file.

Since:
jpicedt 1.3
Version:
$Id: REParserException.java,v 1.10 2013/03/31 06:58:54 vincentb1 Exp $
Author:
Sylvain Reynal
See Also:
Serialized Form

Nested Class Summary
static class REParserException.BeginGroupMismatch
          a "begin group" has no matching "end group"
static class REParserException.BlockMismatch
          a closing delimiter has no matching opening delimiter (see EnclosingExpression)
static class REParserException.EndGroupMismatch
          a "end group" has no matching "begin group"
static class REParserException.EndOfPicture
          the end of the picture environment was encoutered.
static class REParserException.EndOfPictureNotFound
          the end of the picture environment wasn't found in the current Reader.
static class REParserException.EOF
          the end of the file (or the underlying Reader) was reached abnormally, e.g. in the course of a AbstractRegularExpression.interpret() operation.
static class REParserException.IncompleteSequence
          signals an incomplete SequenceExpression
static class REParserException.NotFoundInFile
          a mandatory expression wasn't found
static class REParserException.NumberFormat
          aka NumberFormatException
static class REParserException.NumberSign
          signals an error concerning the sign of a number (see NumericalExpression)
static class REParserException.SyntaxError
          a syntax error has occured ; should be used as a last resort, when no specific exception message applies.
 
Nested classes/interfaces inherited from class jpicedt.graphic.io.parser.ParserException
ParserException.UnrecognizedFileFormat
 
Constructor Summary
REParserException(String message, Context context)
          create a new REParserException with the specified error code and line number.
REParserException(String message, Context context, AbstractRegularExpression expr)
          create a new REParserException, raised by the given Expression
 
Method Summary
 String getLocalizedMessage()
          Convenience call to getMessage()
 String getMessage()
          Return a meaningfull, human-readable, properly localized description of this exception
 String toString()
          Convenience call to getMessage()
 
Methods inherited from class jpicedt.graphic.io.parser.ParserException
localize
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

REParserException

public REParserException(String message,
                         Context context)
create a new REParserException with the specified error code and line number.

Parameters:
message - used for localization purpose ; this should be a key-entry in the current set of jpicedt/lang/i18n_xx.properties resource files, with the corresponding value being a properly localized message.

REParserException

public REParserException(String message,
                         Context context,
                         AbstractRegularExpression expr)
create a new REParserException, raised by the given Expression

Parameters:
context - the Context used by the parser raising this exception ; merely serves as a document locator.
Method Detail

getMessage

public String getMessage()
Return a meaningfull, human-readable, properly localized description of this exception

Overrides:
getMessage in class ParserException

toString

public String toString()
Convenience call to getMessage()

Overrides:
toString in class Throwable

getLocalizedMessage

public String getLocalizedMessage()
Convenience call to getMessage()

Overrides:
getLocalizedMessage in class Throwable

http://www.jpicedt.org

Submit a bug : syd@jpicedt.org