Package lepl :: Package matchers :: Module support :: Class SequenceWrapper
[hide private]
[frames] | no frames]

Class SequenceWrapper

source code

A wrapper for simple generator factories, where the final matcher is a function that yields a series of matches without evaluating other matchers via the trampoline.
Instance Methods [hide private]
_match(self, stream_in)
This is the core method called during recursive decent.
source code
_untagged_match(self, stream_in)
This should work like _match(), but without any tagged wrapper.
source code

Inherited from TransformableWrapper: compose, tree_repr

Inherited from BaseFactoryMatcher: __init__, factory

Inherited from BaseFactoryMatcher (private): _cached_matcher

Inherited from Transformable (private): _format_repr

Inherited from operators.OperatorMixin: __add__, __and__, __div__, __floordiv__, __ge__, __getitem__, __gt__, __invert__, __mod__, __or__, __pow__, __radd__, __rand__, __rdiv__, __rfloordiv__, __rmod__, __ror__, __rshift__, __rtruediv__, __truediv__, __xor__

Inherited from support.context.NamespaceMixin (private): _lookup

Inherited from core.config.ParserMixin: get_match, get_match_file, get_match_iterable, get_match_list, get_match_sequence, get_match_string, get_parse, get_parse_all, get_parse_file, get_parse_file_all, get_parse_iterable, get_parse_iterable_all, get_parse_list, get_parse_list_all, get_parse_sequence, get_parse_sequence_all, get_parse_string, get_parse_string_all, match, match_file, match_iterable, match_list, match_sequence, match_string, parse, parse_all, parse_file, parse_file_all, parse_iterable, parse_iterable_all, parse_list, parse_list_all, parse_sequence, parse_sequence_all, parse_string, parse_string_all

Inherited from core.config.ParserMixin (private): _raw_parser

Inherited from BaseMatcher: __repr__, __str__, clone, kargs, tree

Inherited from support.graph.ArgAsAttributeMixin: __iter__

Inherited from support.graph.PostorderWalkerMixin: postorder

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

Inherited from matcher.Matcher: indented_repr

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

_match(self, stream_in)

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)
        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

  • @tagged
Overrides: matcher.Matcher._match
(inherited documentation)

_untagged_match(self, stream_in)

source code 

This should work like _match(), but without any tagged wrapper.

It would be nice if both could be generated dynamically, but cut + paste appears to be faster, and this is an optimisation.

Overrides: NoTrampoline._untagged_match
(inherited documentation)