Manual:Resource Management

まんま

>>> from lepl import *
>>> matches = (Literal('*')[:,...][2] & Eos()).match('*' * 4)
>>> list(matches)
[(['****'], ''), (['***', '*'], ''), (['**', '**'], ''), (['*', '***'], ''), (['****'], '')]
>>> config = Configuration(monitors=[GeneratorManager(queue_len=1)])
>>> matches = (Literal('*')[:,...][2] & Eos()).match('*' * 4, config)
>>> list(matches)
No handlers could be found for logger "lepl.manager._GeneratorManager"
[(['****'], ''), (['***', '*'], '')]
>>> config = Configuration(monitors=[GeneratorManager(queue_len=2)])
>>> matches = (Literal('*')[:,...][2] & Eos()).match('*' * 4, config)
>>> list(matches)
[(['****'], ''), (['***', '*'], '')]