State superclass. Contains a list of transitions, and transition methods.

Transition methods all have the same signature. They take 3 parameters:

Transition methods all return a 3-tuple:

Transition methods may raise an EOFError to cut processing short.

There are two implicit transitions, and corresponding transition methods are defined: bof() handles the beginning-of-file, and eof() handles the end-of-file. These methods have non-standard signatures and return values. bof() returns the initial context and results, and may be used to return a header string, or do any other processing needed. eof() should handle any remaining context and wrap things up; it returns the final processing result.

Typical applications need only subclass State (or a subclass), set the patterns and initial_transitions class attributes, and provide corresponding transition methods. The default object initialization will take care of constructing the list of transitions.

Base classes

There are no base classes.

Implemented Interfaces

There are no implemented interfaces.



Known Subclasses