How to traverse CST upward from a Token? #597
vanessadnguyen
started this conversation in
General
Replies: 1 comment
-
For that sort of use, you're probably better off using The CST isn't guranteed to be valid YAML, so it might be dealing with a document that looks like this:
With that sort of input, e.g. the top-level parent of the |
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I found Scalar token using CST.visit and match its key.source to a given name. From that token, I have a need to traverse upward to the root to collect the path from the root to the token. How do I do that?
For example,
The result of the upward traversal should return a path array as ['validations', 0, 'messageExpression']
Beta Was this translation helpful? Give feedback.
All reactions