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

Class Literal

Rule --+
       |
      Literal


Rule matching a certain string. The rule matches a given string. The string matches the len(string) next characters, regardless if the input reader should ignored whitespaces or not.
Method Summary
  __init__(self, string)
Initialize the rule with the string to match.
  __str__(self)
Return a string representation of this rule.
  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, string)
(Constructor)

Initialize the rule with the string to match.
Parameters:
string - The string this rule instance should match.
           (type=str)

__str__(self)
(Informal representation operator)

Return a string representation of this rule.
Returns:
a string representation of this rule.

match(self, input_reader)

Match this rule against the input.
Parameters:
input_reader - The input reader to read the string from.
           (type=InputReader)
Returns:
The matched string.
Overrides:
yeanpypa.Rule.match

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