You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've just been using your library for parsing some text and it's been very useful. One feature I missed was being able to handle missing values in my NodeVisitor nicely (e.g. from a ? or * pattern that doesn't match). Being able to do:
ifnotnode:
vals= []
would be a convenient idiom to use when the pattern didn't match. It could also be used to do the right thing if visited_children was used as well.
I think bool(node) would just be:
def__bool__(self):
"""Returns True when one or more characters were matched. Returns False for ? and * Patterns that fail to match."""returnself.start!=self.end
I'm happy to turn this into a (trivial) pull request, posting as an issue in case I'm missing something!
The text was updated successfully, but these errors were encountered:
I've just been using your library for parsing some text and it's been very useful. One feature I missed was being able to handle missing values in my
NodeVisitor
nicely (e.g. from a?
or*
pattern that doesn't match). Being able to do:would be a convenient idiom to use when the pattern didn't match. It could also be used to do the right thing if
visited_children
was used as well.I think
bool(node)
would just be:I'm happy to turn this into a (trivial) pull request, posting as an issue in case I'm missing something!
The text was updated successfully, but these errors were encountered: