A set of alternative rules. This object matches one of the alternative
subrules contained in it. The rules are matched in left-to-right order.
Matching stops after a rule matches.
This class is not intended for direct use. It is created by the
|-operator of the Rule class.
| Method Summary |
| |
__init__(self,
left_rule,
right_rule)
Initialize this rule with two subrules. |
| |
__or__(self,
right_rule)
Reimplementation of the |-operator to concat subsequent rules into one
object. |
| |
__str__(self)
Return a human readable representation of that rule. |
| |
match(self,
input_reader)
Match the subrules of this rule against the input. |
| Inherited from Rule |
| |
__add__(self,
second_rule)
Define an operator to concat two rules. |
| |
callAction(self,
param)
Call the action attached to this rule. |
| |
hide(self)
Tell this rule to not produce any token output. |
| |
returnToken(self,
token)
Helper function encapsulating the hide()-functionality. |
| |
setAction(self,
action)
Set the action to execute on a rule match. |