Package lepl :: Package lexer :: Module rewriters :: Class AddLexer
[hide private]
[frames] | no frames]

Class AddLexer

source code

This is required when using Tokens.  It does the following:
- Find all tokens in the matcher graph
- Construct a lexer from the tokens
- Connect the lexer to the matcher
- Check that all children have a token parent 
  (and optionally add a default token)
Although possibly not in that order. 

alphabet is the alphabet for which the regular expressions are defined.

discard is a regular expression that is used to match space (typically)
if no token can be matched (and which is then discarded)

Instance Methods [hide private]
__init__(self, alphabet=None, discard=None, lexer=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
__call__(self, graph) source code

Inherited from core.rewriters.Rewriter: __eq__, __ge__, __gt__, __hash__, __le__, __lt__, __ne__, __str__

Inherited from object: __delattr__, __format__, __getattribute__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, alphabet=None, discard=None, lexer=None)

source code 
x.__init__(...) initializes x; see help(type(x)) for signature
Overrides: object.__init__
(inherited documentation)

__call__(self, graph)
(Call operator)

source code 
Overrides: core.rewriters.Rewriter.__call__