Replies: 1 comment
-
|
Sorry, I'm only seeing this now. You're right that the transform creates new tree nodes, which would be without the 'id' attribute. However, using Transformer_InPlace should work. If you're still having trouble with it, let me know, and I'll try to guide you towards a solution. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there, I'm trying to attach a
.parentattribute to eachTreein the parsed result, as explained with this example:https://lark-parser.readthedocs.io/en/latest/recipes.html#keeping-track-of-parents-when-visiting
However, when my tree is processed by a
Transformer, the.parentattribute no longer exists. Here is a minimal example, setting an.idattribute and then checking for that attribute in theTransformer:If I set the attribute on the
Tree.metaproperty, it works, but it doesn't work on theTreeobject itself. I have also tried usingTransformer_InPlace, with the hopes that the originalTransformerwas making a stripped copy of eachTreeobject, but the result is the same: each transform callback method cannot see the.idproperty.Any idea what I am doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions