vortex icon indicating copy to clipboard operation
vortex copied to clipboard

Fix: sample with index number

Open Bubobubobubobubo opened this issue 2 years ago • 0 comments

bd plays a sound but bd:2 does not play anything. You can investigate the issue by printing part of the tree as an expression is being evaluated by the mini-notation:

def visit_word_with_index(self, _node, children):
    word, index = children
    print(word, index)
    index = 0 if isinstance(index, Node) else index[0]
    return dict(type="word", value=word, index=index)

And then you'll see:

>>> s('bd')
bd <Node matching "">
~[((0, 1), (0, 1), {'s': 'bd'})] ...~
>>> s('bd:2')
bd [2]
bd <Node matching "">
~[((0, 1), (0, 1), {'s': {'n': 2, 's': 'bd'}})] ...~

Any ideas? I'm learning parsimonious to try to fix the issue.

Bubobubobubobubo avatar May 06 '23 18:05 Bubobubobubobubo