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.
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.