-
Notifications
You must be signed in to change notification settings - Fork 27
Parent covers children invariant is not respected #394
Comments
It depends on the parsing mode you use. For For But for your specific case, this issue is caused by bblfsh/javascript-driver#74 - the UAST pipeline does not process comments correctly, and they are preserved in the same places as in |
Thanks for the clarifications. |
@dennwc @creachadair I wouldn't really close this one. Although I do understand the implemented logic,
|
@vmarkovtsev You have to realize that nodes have a totally different order in Semantic. You just can't have a single universal representation and still have the "correct" node hierarchy in regards to positions for all languages. At least with the tree structures. It is possible though if we switch to graph representation (#339) because you will be able to jump from Semantic nodes to Native and get positions and the "correct" hierarchy. @creachadair @bzz As I mentioned in last couple of months, the issues with the current representation (tree structure) start to actually matter. I think we should bump the priority for the transition to the new representation. |
Actually, we are likely to use the |
You mentioned Semantic, so I focused the answer on it.
Right, Annotated will work better for this use case, but again, it has a similar issue - some AST does not provide a "correct" hierarchy. This time we cannot fix it because we cannot modify the structure in this mode by definition. We really need a way to link those trees (+ token stream) in an arbitrary way. I will dedicate some time this week to outline the proposal in regards to the new representation (graphs). It will solve all those issues. |
Reopening and moving to SDK. |
With the concept of leading comments in the UAST, the simple invariant of parent covering their children is not respected.
I think this might be non-intuitive to many users.
To reproduce:
The initial comment is a child of the expression assignment node (on current bblfsh web for example).
The text was updated successfully, but these errors were encountered: