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
.parent
attribute to eachTree
in 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.parent
attribute no longer exists. Here is a minimal example, setting an.id
attribute and then checking for that attribute in theTransformer
:If I set the attribute on the
Tree.meta
property, it works, but it doesn't work on theTree
object itself. I have also tried usingTransformer_InPlace
, with the hopes that the originalTransformer
was making a stripped copy of eachTree
object, but the result is the same: each transform callback method cannot see the.id
property.Any idea what I am doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions