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

Introduce a walker in AGTree for node traversal #150

Open
scripthunter7 opened this issue Feb 25, 2025 · 0 comments
Open

Introduce a walker in AGTree for node traversal #150

scripthunter7 opened this issue Feb 25, 2025 · 0 comments

Comments

@scripthunter7
Copy link
Member

We should consider introducing a walker in AGTree that supports two callbacks: one when entering a node and another when leaving it. This will provide a structured way to traverse the tree while allowing custom logic at different stages of traversal.

Implementing a walker would be beneficial in multiple areas, such as the linter and modifiers, especially as we enable more advanced parsing of values. It would offer a reusable and consistent approach to tree traversal, reducing redundancy in related features.

Additionally, the walker should support early termination, allowing traversal to stop when a specific condition is met (e.g., when searching for a particular node). It should also provide an option to skip specific subtrees, such as ignoring comment nodes and preventing their child nodes from being processed.

By introducing this walker, we can improve efficiency, maintainability, and flexibility when working with AGTree.

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

3 participants