Package lepl :: Package matchers :: Module matcher :: Class Matcher
[hide private]
[frames] | no frames]

Class Matcher

source code


Instance Methods [hide private]
 
__init__(self) source code
 
_match(self, stream)
This is the core method called during recursive decent.
source code
 
indented_repr(self, indent, key=None)
Called by repr; should recursively call contents.
source code
Method Details [hide private]

_match(self, stream)

source code 

This is the core method called during recursive decent.  It must
yield (stream, results) pairs until the matcher has exhausted all
possible matches.

To evaluate a sub-matcher it should yield the result of calling
this method on the sub-matcher:

    generator = sub_matcher._match(stream_in)
    try:
        while True:
            # evaluate the sub-matcher
            (stream_out, result) = yield generator
            ....
            # return the result from this matcher
            yield (stream_out, result)
    except StopIteration:
        ...
        
The implementation should be decorated with @tagged in almost all
cases.