Class GrammarException

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    CompilerException

    public class GrammarException
    extends CoffeeGrinderException
    Grammar exceptions.

    Grammar exceptions are generally errors in the grammar, use of a nonterminal that has no rule defining it, for example.

    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      GrammarException​(java.lang.String code, java.lang.String message)
      Grammar exception with a message.
      GrammarException​(java.lang.String code, java.lang.String message, java.lang.Throwable cause)
      Grammar exception with an underlying cause.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static GrammarException grammarIsClosed()
      Raised if an attempt is made to write to a closed grammar.
      static GrammarException invalidCharacterClass​(java.lang.String name)
      Raised if an invalid Unicode character class is specified.
      static GrammarException invalidGrammarRegex()
      Raised if a regular expression is used incorrectly.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • GrammarException

        public GrammarException​(java.lang.String code,
                                java.lang.String message)
        Grammar exception with a message.
        Parameters:
        code - the code
        message - the message
      • GrammarException

        public GrammarException​(java.lang.String code,
                                java.lang.String message,
                                java.lang.Throwable cause)
        Grammar exception with an underlying cause.
        Parameters:
        code - the code
        message - the message
        cause - the cause
    • Method Detail

      • grammarIsClosed

        public static GrammarException grammarIsClosed()
        Raised if an attempt is made to write to a closed grammar.
        Returns:
        a GrammarException
      • invalidCharacterClass

        public static GrammarException invalidCharacterClass​(java.lang.String name)
        Raised if an invalid Unicode character class is specified.
        Parameters:
        name - the Unicode character class
        Returns:
        a GrammarException.
      • invalidGrammarRegex

        public static GrammarException invalidGrammarRegex()
        Raised if a regular expression is used incorrectly.

        Regular expressions must be the only symbol on the right hand side of a rule.

        Returns:
        a GrammarException.