Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support python match on Tree #1487

Open
philzook58 opened this issue Nov 13, 2024 · 1 comment
Open

Support python match on Tree #1487

philzook58 opened this issue Nov 13, 2024 · 1 comment

Comments

@philzook58
Copy link

I really like the new python match construct but it seems the Tree datatype doesn't currently support it.

I can monkey patch it in with Tree.__match_args__ = ("data", "children") , but inserting this line into https://github.com/lark-parser/lark/blob/master/lark/tree.py should support it reasonably. Alternatively, a dataclass annotation I believe would also enable pattern matching.

@erezsh
Copy link
Member

erezsh commented Nov 13, 2024

I support adding it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants