You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on a feature to parse a language, fix it's AST, then regenerate the same tokens back.
The CST visitor provided by chevrotain is excellent because it validates the nodes. However it also merges the nodes inside an "MANY > OR" condition. This means it's not trivial to ensure that we process nodes in order. This is needed to ensure that during generation I don't generate nodes out of order.
Here is an example
// other code...document=this.RULE("document",()=>{this.MANY(()=>{this.OR([{ALT: ()=>this.SUBRULE(this.blockDeclaration)},{ALT: ()=>this.SUBRULE(this.attribute)},{ALT: ()=>this.SUBRULE(this.comment)}]);});});// remaining code...
I can't ensure the ordering. I can write some helper to merge all items, sort by their starting line then starting column perhaps. But I am not sure if it covers all cases.
The text was updated successfully, but these errors were encountered:
I am working on a feature to parse a language, fix it's AST, then regenerate the same tokens back.
The CST visitor provided by chevrotain is excellent because it validates the nodes. However it also merges the nodes inside an "MANY > OR" condition. This means it's not trivial to ensure that we process nodes in order. This is needed to ensure that during generation I don't generate nodes out of order.
Here is an example
This means if I have a visitor like so:
I can't ensure the ordering. I can write some helper to merge all items, sort by their starting line then starting column perhaps. But I am not sure if it covers all cases.
The text was updated successfully, but these errors were encountered: