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 can't find any way to keep the trivia (whitespace, line-shifts etc...) when parsing the syntax-tree. Ideally, a roundtrip from a Javascript string, to AST and back to a Javascript string should in my case give the exact same string (like the Microsoft.CodeAnalysis.CSharp syntax tree). Is there a plan for a feature like this?
The text was updated successfully, but these errors were encountered:
Short answer: full fidelity (or concrete) syntax (including trivia) is not supported currently.
Long answer: Esprima is based on the ESTree specification, which doesn't implement full fidelity syntax. There is an open proposal though, without a clear perspective.
But even if such thing gets spec'ed, it's unlikely that it will ever land here. Besides the fact that implementing it would be a huge amount of work, there are also other aspects to take into account:
[...] because its main consumer is Jint, which wouldn't want to pay the price of a more detailed AST model.
I can't find any way to keep the trivia (whitespace, line-shifts etc...) when parsing the syntax-tree. Ideally, a roundtrip from a Javascript string, to AST and back to a Javascript string should in my case give the exact same string (like the Microsoft.CodeAnalysis.CSharp syntax tree). Is there a plan for a feature like this?
The text was updated successfully, but these errors were encountered: