-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
>>> from funcparserlib.parser import a, many
>>> many(a("x")).parse("xxxxxxx")
['x', 'x', 'x', 'x', 'x', 'x', 'x']
>>> many(a("x")).parse(x for x in "xxxxxxx")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/hippo/Scratch/Python-venv/lib/python3.11/site-packages/funcparserlib/parser.py", line 221, in parse
(tree, _) = self.run(tokens, State(0, 0, None))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/hippo/Scratch/Python-venv/lib/python3.11/site-packages/funcparserlib/parser.py", line 569, in _many
(v, s) = p.run(tokens, s)
^^^^^^^^^^^^^^^^
File "/home/hippo/Scratch/Python-venv/lib/python3.11/site-packages/funcparserlib/parser.py", line 614, in _some
if s.pos >= len(tokens):
^^^^^^^^^^^
TypeError: object of type 'generator' has no len()
It seems likely one would want to parse an iterable stream of tokens at times.
wrobell, Marrin and alexeyshockov
Metadata
Metadata
Assignees
Labels
No labels