-
-
Notifications
You must be signed in to change notification settings - Fork 426
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
Run code on every attribute #1512
Comments
As always, the answer comes 10 milliseconds after I post the question. I modified the grammar to group each attribute in another attribute ( |
No, actually, not fixed. How do I run code before and after each attribute? |
Why do you need to run on every attribute? And maybe you can just solve it with decorators? |
Most likely. I'll look into that.
I parse file line by line. I want to do certain action if previous line was a specific attribute. Setting variable |
Then you don't need every attribute, you only need the attribute that marks a new line. Btw you can use @v_args(wrapper=...) on the class to decorate every method in the class with one line. But maybe it's better to keep it simple. |
I tried really hard to make it work, but to no avail. Could you please provide an example? There is currently no one in the documentation.
That's really smart. I'd try that, thanks. Thought, I would still like to know how to achieve that with |
Sorry, I made a mistake. v_args only applies to Transformer, not Visitor. |
What is your question?
How do I run code inside a Visitor class on every attribute? Something like
__default__(tree)
, but in case the attribute exists.The text was updated successfully, but these errors were encountered: