Exemplo n.º 1
0
 def _untagged_match(self, stream_in):
     from lepl.matchers.transform import raise_
     function = self.wrapper.function
     for results in self._cached_matcher(self, stream_in):
         yield function(stream_in, lambda: results) if function else results
     while function:
         yield function(stream_in, lambda: raise_(StopIteration))
Exemplo n.º 2
0
 def _untagged_match(self, stream_in):
     from lepl.matchers.transform import raise_
     function = self.wrapper.function
     for results in self._cached_matcher(self, stream_in):
         yield function(stream_in, lambda: results) if function else results
     while function:
         yield function(stream_in, lambda: raise_(StopIteration))
Exemplo n.º 3
0
 def _untagged_match(self, stream_in):
     '''
     Actually do the work of matching.
     '''
     function = self.wrapper.function
     matches = self._compile()(stream_in)
     for (_terminal, match, stream_out) in matches:
         yield function(stream_in, lambda: ([match], stream_out)) \
             if function else ([match], stream_out)
     while True:
         yield function(stream_in, lambda: raise_(StopIteration))
Exemplo n.º 4
0
 def _match(self, stream_in):
     '''
     Actually do the work of matching.
     '''
     function = self.wrapper.function
     matches = self._compile()(stream_in)
     for (_terminal, match, stream_out) in matches:
         yield function(stream_in, lambda: ([match], stream_out)) \
             if function else ([match], stream_out)
     while True:
         yield function(stream_in, lambda: raise_(StopIteration))
Exemplo n.º 5
0
 def _match(self, stream_in):
     '''
     Actually do the work of matching.
     '''
     function = self.wrapper.function
     match = self._compile()(stream_in)
     if match is not None:
         (_terminals, match, stream_out) = match
         yield function(stream_in, lambda: ([match], stream_out)) \
             if function else ([match], stream_out)
     while True:
         yield function(stream_in, lambda: raise_(StopIteration))
Exemplo n.º 6
0
 def _untagged_match(self, stream_in):
     '''
     Actually do the work of matching.
     '''
     function = self.wrapper.function
     match = self._compile()(stream_in)
     if match is not None:
         (_terminals, match, stream_out) = match
         yield function(stream_in, lambda: ([match], stream_out)) \
             if function else ([match], stream_out)
     while True:
         yield function(stream_in, lambda: raise_(StopIteration))
Exemplo n.º 7
0
 def _match(self, stream_in):
     from lepl.matchers.transform import raise_
     function = self.wrapper.function
     generator = GeneratorWrapper(self._cached_matcher(self, stream_in), 
                                  self, stream_in)
     while True:
         try:
             value = yield generator
             yield function(stream_in, lambda: value) \
                 if function else value
         except StopIteration as e:
             if function:
                 yield function(stream_in, lambda: raise_(StopIteration))
             else:
                 raise e
Exemplo n.º 8
0
 def _match(self, stream_in):
     from lepl.matchers.transform import raise_
     function = self.wrapper.function
     generator = GeneratorWrapper(self._cached_matcher(self, stream_in), 
                                  self, stream_in)
     while True:
         try:
             value = yield generator
             yield function(stream_in, lambda: value) \
                 if function else value
         except StopIteration as e:
             if function:
                 yield function(stream_in, lambda: raise_(StopIteration))
             else:
                 raise e