StateMachine which uses re.search() instead of re.match().
There are no implemented interfaces.
There are no attributes in this class.
abs_line_number()
Return line number of current line (counting from 1).
abs_line_offset()
Return line offset of current line, from beginning of file.
add_state(state_class)
Initialize & add a state_class (State subclass) object.
Exception: DuplicateStateError raised if state_class was already added.
add_states(state_classes)
Add state_classes (a list of State subclasses).
at_bof()
Return 1 if the input is at or before beginning-of-file.
at_eof()
Return 1 if the input is at or past end-of-file.
attach_observer(observer)
The observer parameter is a function or bound method which takes two arguments, the source and offset of the current line.
check_line(context, state, transitions=None)
Examine one line of input for a transition match & execute its method.
Parameters:
Return the values returned by the transition method:
When there is no match, state.no_match() is called and its return value is returned.
detach_observer(observer)
error()
Report error details.
get_source(line_offset)
Return source of line at absolute line offset line_offset.
get_state(next_state=None)
Return current state object; set it first if next_state given.
Parameter next_state: a string, the name of the next state.
Exception: UnknownStateError raised if next_state unknown.
get_text_block(flush_left=0)
Return a contiguous block of text.
If flush_left is true, raise UnexpectedIndentationError if an indented line is encountered before the text block ends (with a blank line).
goto_line(line_offset)
Jump to absolute line offset line_offset, load and return it.
insert_input(input_lines, source)
is_next_line_blank()
Return 1 if the next line is blank or non-existant.
match(pattern)
Return the result of a regular expression search.
Overrides StateMachine.match().
Parameter pattern: re compiled regular expression.
next_line(n=1)
Load self.line with the n'th next line and return it.
notify_observers()
previous_line(n=1)
Load self.line with the n'th previous line and return it.
run(input_lines, input_offset=0, context=None, input_source=None)
Run the state machine on input_lines. Return results (a list).
Reset self.line_offset and self.current_state. Run the beginning-of-file transition. Input one line at a time and check for a matching transition. If a match is found, call the transition method and possibly change the state. Store the context returned by the transition method to be passed on to the next transition matched. Accumulate the results returned by the transition methods in a list. Run the end-of-file transition. Finally, return the accumulated results.
Parameters:
runtime_init()
Initialize self.states.
unlink()
Remove circular references to objects no longer required.
There are no known subclasses.