add function replace_nodes to Tree#1524
Open
zzc0430 wants to merge 10 commits intolark-parser:masterfrom
Open
Conversation
This can be used to replace tokens in a `Tree` that satisfy a specified rule.
Member
|
Add tests. |
MegaIng
suggested changes
Apr 7, 2025
Author
added 388fd80 |
Member
|
Let's call it Also in the tests, you are changing |
Author
Member
|
*deepcopy |
Author
|
MegaIng
approved these changes
Apr 8, 2025
Member
|
@MegaIng Do we really need the special behavior for None? The callback can just return the parameter as is, if no changes are necessary. (I don't think it matters in terms of performance) |
Member
|
True, probably not needed. To get the type checking to work:
This slightly changes the semantics, but I think it's more useful. |
…30/lark into feat/add_replace_node_func
Author
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This can be used to replace tokens in a
Treethat satisfy a specified rule.