Home | Trees | Index | Help |
|
---|
Package docutils :: Module statemachine :: Class StateWS |
|
State
--+
|
StateWS
RSTState
State superclass specialized for whitespace (blank lines & indents).
Use this class with StateMachineWS
. The transitions 'blank' (for blank
lines) and 'indent' (for indented text blocks) are added automatically,
before any other transitions. The transition method blank()
handles
blank lines and indent()
handles nested indented blocks. Indented
blocks trigger a new state machine to be created by indent()
and run.
The class of the state machine to be created is in indent_sm
, and the
constructor keyword arguments are in the dictionary indent_sm_kwargs
.
The methods known_indent()
and firstknown_indent()
are provided for
indented blocks where the indent (all lines' and first line's only,
respectively) is known to the transition method, along with the attributes
known_indent_sm
and known_indent_sm_kwargs
. Neither transition method
is triggered automatically.
Method Summary | |
---|---|
Initialize a StateSM object; extends State.__init__() . | |
Add whitespace-specific transitions before those defined in subclass. | |
Handle blank lines. | |
Handle an indented text block (first line's indent known). | |
Handle an indented text block. | |
Handle a known-indent text block. | |
Inherited from State | |
Add a transition to the start of the transition list. | |
Add a list of transitions to the start of the transition list. | |
Handle beginning-of-file. | |
Handle end-of-file. | |
Make & return a transition tuple based on name . | |
Return a list of transition names and a transition mapping. | |
Called when there is no match from StateMachine.check_line() . | |
A "do nothing" transition method. | |
Remove a transition by name . | |
Initialize this State before running the state machine; called from
self.state_machine.run() . | |
Remove circular references to objects no longer required. |
Class Variable Summary | |
---|---|
NoneType |
indent_sm = None |
NoneType |
indent_sm_kwargs = None |
NoneType |
known_indent_sm = None |
NoneType |
known_indent_sm_kwargs = None |
tuple |
ws_initial_transitions = ('blank', 'indent')
|
dict |
ws_patterns = {'indent': ' +', 'blank': ' *$'}
|
Inherited from State | |
NoneType |
initial_transitions = None |
NoneType |
nested_sm = None |
NoneType |
nested_sm_kwargs = None |
NoneType |
patterns = None |
Method Details |
---|
__init__(self,
state_machine,
debug=0)
|
add_initial_transitions(self)Add whitespace-specific transitions before those defined in subclass. Extends |
blank(self, match, context, next_state)Handle blank lines. Does nothing. Override in subclasses. |
first_known_indent(self, match, context, next_state)Handle an indented text block (first line's indent known). Extend or override in subclasses. Recursively run the registered state machine for known-indent indented
blocks ( |
indent(self, match, context, next_state)Handle an indented text block. Extend or override in subclasses. Recursively run the registered state machine for indented blocks
( |
known_indent(self, match, context, next_state)Handle a known-indent text block. Extend or override in subclasses. Recursively run the registered state machine for known-indent indented
blocks ( |
Class Variable Details |
---|
indent_sm
|
indent_sm_kwargs
|
known_indent_sm
|
known_indent_sm_kwargs
|
ws_initial_transitions
|
ws_patterns
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.0 on Tue Jul 22 05:31:40 2003 | http://epydoc.sf.net |