10.4. typped.shared_settings_and_exceptions

Some settings and exceptions that are shared between several modules.

typped.shared_settings_and_exceptions.DEFAULT_ALWAYS_TRUE_PRECOND_FUN(lex, extra_data)[source]

The default precondition function; always returns true. It is never actually called, just tested for with “is” and assumed true.

exception typped.shared_settings_and_exceptions.TyppedBaseException[source]

Bases: Exception

The base exception for all package-defined exceptions. All potentially-recoverable exceptions should be subclasses of this class (i.e., not a builtin Python exception).

exception typped.shared_settings_and_exceptions.ParserException[source]

Bases: typped.shared_settings_and_exceptions.TyppedBaseException

Base exception for exceptions in the parser modules.

exception typped.shared_settings_and_exceptions.LexerException[source]

Bases: typped.shared_settings_and_exceptions.TyppedBaseException

Base exception for exceptions in the lexer modules.

exception typped.shared_settings_and_exceptions.CalledBeginTokenHandler[source]

Bases: typped.shared_settings_and_exceptions.ParserException

Called a handler for the begin token.

exception typped.shared_settings_and_exceptions.CalledEndTokenHandler[source]

Bases: typped.shared_settings_and_exceptions.ParserException

Called a handler for the end token.

exception typped.shared_settings_and_exceptions.NoHandlerFunctionDefined[source]

Bases: typped.shared_settings_and_exceptions.ParserException

Only raised by dispatcher function, and only when it fails to find a handler function (head or tail, whichever it was looking for).

exception typped.shared_settings_and_exceptions.ErrorInParsedLanguage[source]

Bases: typped.shared_settings_and_exceptions.ParserException

Raised for syntax errors and other errors in the language that is being parsed. For type errors the exception TypeErrorInParsedLanguage is raised.

typped.shared_settings_and_exceptions.is_class(obj)[source]

Test if object obj is a class.

typped.shared_settings_and_exceptions.is_subclass_of(subclass_name, class_name)[source]

This is just a call to issubclass except that it first checks that the first argument is a class, returning false if it is not.