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

Class Combine

Rule --+
       |
      Combine


Pseudo rule that recursivly combines all of it's children into one token. This rule is useful if the token of a group of subrules should be combined to form one string.
Method Summary
  __init__(self, rule)
Initialize the rule with a subrule.
  __str__(self)
Return a human-readable description of the rule.
  combine(self, token)
Recursivly combine all token into a single one.
  match(self, input_reader)
Match this rule against the input.
    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 the rule with a subrule. The token generated by the subrule are recursivly combined into one string.
Parameters:
rule - The subrule to combine.
           (type=Rule)

__str__(self)
(Informal representation operator)

Return a human-readable description of the rule.
Returns:
A string describing this rule.

combine(self, token)

Recursivly combine all token into a single one. This is an internal helper that recursivly combines a list of lists (or strings) into one string.
Parameters:
token - the token list to combine into one string.
           (type=list or str)

match(self, input_reader)

Match this rule against the input. The rule matches the input against its subrule and combines the resulting token into a string.
Parameters:
input_reader - The input reader to read from.
           (type=InputReader)
Returns:
A string combining all the token generated by the subrule.
Overrides:
yeanpypa.Rule.match

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