fluent-rs icon indicating copy to clipboard operation
fluent-rs copied to clipboard

Expose spans in parser / source positions in the AST

Open juliancoffee opened this issue 2 years ago • 3 comments

I'm thinking about writing my own tool for fluent files and if I want to use something like git blame to find out updates of messages, I'll need to know the span of entry. fluent-js seems to expose that and I guess fluent-rs operates on spans too, as it has it in errors, but I couldn't find it in public API, is it possible to expose it?

juliancoffee avatar Aug 17 '22 23:08 juliancoffee

Yup, we did not include it in Rust parser, but the intent was always to eventually add it for the purpose you're describing.

Please, feel free to prototype - the main condition is that it should not degrade runtime performance. That may mean we need to keep it as a separate AST/parser or via some generics/macros generalize the current AST/parser to allow for white space preservation.

zbraniecki avatar Aug 18 '22 00:08 zbraniecki

The later issue #346 seems to be a duplicate of this. There is actually a bit more discussion there that might be worth reviewing before anybody jumps in to start implementing this.

alerque avatar May 07 '24 09:05 alerque

What about a cst (Concrete Syntax Tree) feature for fluent-syntax that would add this information to the current AST parser?

mondeja avatar Jun 02 '24 15:06 mondeja