Class CompilerException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.nineml.coffeegrinder.exceptions.CoffeeGrinderException
-
- org.nineml.coffeegrinder.exceptions.GrammarException
-
- org.nineml.coffeegrinder.exceptions.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 Summary
Constructors Constructor Description CompilerException(java.lang.String code, java.lang.String message)Grammar exception with a message.CompilerException(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 CompilerExceptioncheckumFailed()Raised if the compiled grammar checksum doesn't match the computed value.static CompilerExceptionerrorReadingGrammar(java.lang.String message)Raised if an error occurs reading the grammarstatic CompilerExceptioninvalidGramamr(java.lang.String message)Raised if the grammar is invalid.static CompilerExceptioninvalidNameEscaping(java.lang.String escape, java.lang.String name)Raised if a name is improperly escaped.static CompilerExceptionmessageDigestError(java.lang.String hash, java.lang.String reason)Raised if the digest cannot be created.static CompilerExceptionmissingAttributeGroup(java.lang.String id)Raised if an attribute group is missingstatic CompilerExceptionmissingXmlId(java.lang.String name)Raised if an element is missing a required xml:idstatic CompilerExceptionnotAGrammar(java.lang.String namespace)Raised if the compiled grammar is not in the correct namespace.static CompilerExceptionnoVersionProvided()Raised if the compiled grammar has no version attribute.static CompilerExceptiontextNotAllowed(java.lang.String text)Raised if text is used where it isn't allowed.static CompilerExceptionunexpectedCharacterSet(java.lang.String charset)Raised if an unexpected character set is used.static CompilerExceptionunexpectedElement(java.lang.String name)Raised if the compiled grammar contains an element with an unexpected name.static CompilerExceptionunexpectedFlag(java.lang.String flag)Raised if the internal flag value is unrecognized.static CompilerExceptionunexpectedTerminalTokenClass(java.lang.String tokenClass)Raised if an unexpected terminal token class is encounteredstatic CompilerExceptionunsupportedVersion(java.lang.String version)Raised if the version is unrecognized.-
Methods inherited from class org.nineml.coffeegrinder.exceptions.GrammarException
grammarIsClosed, invalidCharacterClass, invalidGrammarRegex
-
Methods inherited from class org.nineml.coffeegrinder.exceptions.CoffeeGrinderException
getCode
-
-
-
-
Constructor Detail
-
CompilerException
public CompilerException(java.lang.String code, java.lang.String message)Grammar exception with a message.- Parameters:
code- the codemessage- 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 codemessage- the messagecause- 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 hashreason- 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 escapename- 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
-
-