Class CompilerException

  • All Implemented Interfaces:
    java.io.Serializable

    public class CompilerException
    extends GrammarException
    Compiler exceptions.

    Compiler exceptions identify problems encountered attempting to compile a grammar or parse a compiled grammar.

    See Also:
    Serialized Form
    • Constructor Detail

      • CompilerException

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

        public CompilerException​(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

      • messageDigestError

        public static CompilerException messageDigestError​(java.lang.String hash,
                                                           java.lang.String reason)
        Raised if the digest cannot be created.

        This should never happen.

        Parameters:
        hash - the hash
        reason - the underlying exception message
        Returns:
        a CompilerException
      • unexpectedCharacterSet

        public static CompilerException unexpectedCharacterSet​(java.lang.String charset)
        Raised if an unexpected character set is used.
        Parameters:
        charset - the characterset.
        Returns:
        a CompilerException
      • unexpectedTerminalTokenClass

        public static CompilerException unexpectedTerminalTokenClass​(java.lang.String tokenClass)
        Raised if an unexpected terminal token class is encountered
        Parameters:
        tokenClass - the token class
        Returns:
        a CompilerException
      • invalidNameEscaping

        public static CompilerException invalidNameEscaping​(java.lang.String escape,
                                                            java.lang.String name)
        Raised if a name is improperly escaped.
        Parameters:
        escape - The invalid escape
        name - The full name
        Returns:
        a CompilerException
      • errorReadingGrammar

        public static CompilerException errorReadingGrammar​(java.lang.String message)
        Raised if an error occurs reading the grammar
        Parameters:
        message - a detail message
        Returns:
        a CompilerException
      • notAGrammar

        public static CompilerException notAGrammar​(java.lang.String namespace)
        Raised if the compiled grammar is not in the correct namespace.
        Parameters:
        namespace - the root element namespace
        Returns:
        a CompilerException
      • unexpectedElement

        public static CompilerException unexpectedElement​(java.lang.String name)
        Raised if the compiled grammar contains an element with an unexpected name.
        Parameters:
        name - the element name
        Returns:
        a CompilerException
      • noVersionProvided

        public static CompilerException noVersionProvided()
        Raised if the compiled grammar has no version attribute.
        Returns:
        a CompilerException
      • unsupportedVersion

        public static CompilerException unsupportedVersion​(java.lang.String version)
        Raised if the version is unrecognized.
        Parameters:
        version - the version.
        Returns:
        a CompilerException
      • checkumFailed

        public static CompilerException checkumFailed()
        Raised if the compiled grammar checksum doesn't match the computed value.
        Returns:
        a CompilerException
      • missingXmlId

        public static CompilerException missingXmlId​(java.lang.String name)
        Raised if an element is missing a required xml:id
        Parameters:
        name - the name of the element
        Returns:
        a CompilerException
      • missingAttributeGroup

        public static CompilerException missingAttributeGroup​(java.lang.String id)
        Raised if an attribute group is missing
        Parameters:
        id - the id of the group
        Returns:
        a CompilerException
      • unexpectedFlag

        public static CompilerException unexpectedFlag​(java.lang.String flag)
        Raised if the internal flag value is unrecognized.
        Parameters:
        flag - the flag value
        Returns:
        a CompilerException
      • invalidGramamr

        public static CompilerException invalidGramamr​(java.lang.String message)
        Raised if the grammar is invalid.
        Parameters:
        message - a detail message
        Returns:
        a CompilerException
      • textNotAllowed

        public static CompilerException textNotAllowed​(java.lang.String text)
        Raised if text is used where it isn't allowed.
        Parameters:
        text - the text
        Returns:
        a CompilerException