Class GrammarException

All Implemented Interfaces:
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:
  • Constructor Details

    • GrammarException

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

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

    • 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(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.