A control token.
Methods
|
|
build
run
scan
string
subrun
subscan
substring
|
|
build
|
build ( self, allowed=None )
Process the list of subtokens and divide it into a list of
2-tuples, consisting of the dividing tokens and the list of
subtokens that follow them. If allowed is specified, it will
represent the list of the only secondary markup types which
are allowed.
Exceptions
|
|
ParseError, "control unexpected secondary: '%s'" % subtoken.type
|
|
|
run
|
run (
self,
interpreter,
locals,
)
Exceptions
|
|
BreakFlow, "control 'break' without 'for', 'while'"
ContinueFlow, "control 'continue' without 'for', 'while'"
ParseError, "control '%s' cannot be at this level" % self.type
ParseError, "control 'end' requires primary markup"
ParseError, "control 'for' expects at most one 'else'"
ParseError, "control 'if' unexpected secondary: '%s'" % secondary.type
|
ParseError, "control 'try' can only have one 'finally'"
ParseError, "control 'try' cannot have 'except' and 'finally'"
ParseError, "control 'try' needs 'except' or 'finally'"
ParseError, "control 'while' expects at most one 'else'"
ParseError, "control expected 'for x in seq'"
|
|
|
|
scan
|
scan ( self, scanner )
Exceptions
|
|
ParseError, "control '%s' needs arguments" % self.type
ParseError, "unknown control markup: '%s'" % self.type
|
|
|
string
|
string ( self )
|
|
subrun
|
subrun (
self,
tokens,
interpreter,
locals,
)
Execute a sequence of tokens.
|
|
subscan
|
subscan (
self,
scanner,
primary,
)
Do a subscan for contained tokens.
Exceptions
|
|
ParseError, "control must end with 'end %s'" % primary
TransientParseError, "control '%s' needs more tokens" % primary
|
|
|
substring
|
substring ( self )
|
|