Class StateMachineFileParser
source code
- Known Subclasses:
-
A state machine based line-oriented parser.
You should subclass this and implement 'state' functions that begin
with '_on', e.g., _onStart(self, line)
Each such function:
-
takes a single argument 'line' which contains the next line read from
input string.
-
returns the next state to go into, e.g. "End", or returns
None (i.e. returns nothing) to stay in the same state.
Additionally, two special functions must be defined with no
parameters:
-
_onInit(self)
-
_onFinish(self)
to handle initialization (local state) and end of file (useful for
formats that use no ending tag).
|
|
|
|
|
_introspect(self)
Find all functions that begin with 'on' and create a map from the
rest of their name to the function object. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|