Module yeanpypa :: Class ZeroOrMore
[show private | hide private]
[frames | no frames]

Class ZeroOrMore

Rule --+
       |
      ZeroOrMore


Match a rule ad infinitum. This rule is similar to the Optional() rule. While this one only matches if the subrule matches 0 or 1 times, the ZeroOrMore rule matches at any time. This rule tries to consume as much input as possible.
Method Summary
  __init__(self, rule)
Initialize this rule with a subrule.
  __str__(self)
Return a human readable representation of the rule.
  match(self, input_reader)
Match the input against the subrule.
    Inherited from Rule
  __add__(self, second_rule)
Define an operator to concat two rules.
  __or__(self, second_rule)
Define an operator to concat two rules via OR.
  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.

Class Variable Summary
    Inherited from Rule
NoneType action = None                                                                  
bool hide_token = False

Method Details

__init__(self, rule)
(Constructor)

Initialize this rule with a subrule. The subrule is transformed to a Optional(OneOrMore(rule)) construct.
Parameters:
rule - The subrule to match.
           (type=Rule)

__str__(self)
(Informal representation operator)

Return a human readable representation of the rule.

@return A description of this rule.

match(self, input_reader)

Match the input against the subrule.
Parameters:
input_reader - The input reader to read from.
           (type=InputReader)
Returns:
A list of token generated by the matching of the subrule.
Overrides:
yeanpypa.Rule.match

Generated by Epydoc 2.1 on Sat Feb 10 16:11:43 2007 http://epydoc.sf.net