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

Class AnyOf

Rule --+
       |
      AnyOf


A class to match chars from a charset. The class matches exactly one of the chars from the given charset. Whitespaces are matched depending on the setting of the input reader. Note that if the input reader is set to ignore whitespaces, they will not be matched even if the charset contains a whitespace character.
Method Summary
  __init__(self, set)
Initialize the object with a given set.
  __str__(self)
Return a human readable representation of the rule.
  match(self, input_reader)
Match a character from 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, set)
(Constructor)

Initialize the object with a given set.
Parameters:
set - the charset this rule should match
           (type=str)

__str__(self)
(Informal representation operator)

Return a human readable representation of the rule.
Returns:
A string describing the rule

match(self, input_reader)

Match a character from the input. Depending on the setting of the input reader, the next character ist matched directly or the next non-whitespace character is matched.
Parameters:
input_reader - The input to read from.
           (type=InputReader)
Returns:
The matched character
Overrides:
yeanpypa.Rule.match

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