Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose spans in parser / source positions in the AST #270

Open
juliancoffee opened this issue Aug 17, 2022 · 3 comments
Open

Expose spans in parser / source positions in the AST #270

juliancoffee opened this issue Aug 17, 2022 · 3 comments
Labels
crate:fluent-syntax Issues related to fluent-syntax crate enhancement

Comments

@juliancoffee
Copy link
Contributor

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?

@zbraniecki
Copy link
Collaborator

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.

@alerque alerque added the crate:fluent-syntax Issues related to fluent-syntax crate label May 7, 2024
@alerque
Copy link
Collaborator

alerque commented May 7, 2024

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 alerque closed this as completed May 7, 2024
@alerque alerque changed the title Expose spans in parser Expose spans in parser / source positions in the AST May 7, 2024
@alerque alerque reopened this May 7, 2024
@mondeja
Copy link

mondeja commented Jun 2, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate:fluent-syntax Issues related to fluent-syntax crate enhancement
Projects
None yet
Development

No branches or pull requests

5 participants