-
Notifications
You must be signed in to change notification settings - Fork 45
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
Reference parser stores TermReference sigil inside its name #142
Comments
This is a question of whether the dash |
BTW I filed #144 with a suggestion to simplify the AST wrt. storing identifiers. |
The train of thought I followed here is what I expect to be more helpful in syntax highlighting: Giving the leading My perception is that having the same color for the Which leaves me with the same idea that stas has, |
Should we consider changing the |
I'd say no. |
I agree with the syntax coloring UX described by @Pike. Was my assumption wrong? As to what @stasm said - I believe this approach was designed when we wanted to have terms to be regular identifiers in AST and only treat them separately in tooling. Do you know of a precedence for such behavior? Do you have a strong reason for holding this position? |
Our AST keeps them separate because by design it does a little bit of static analysis. In a regular programming language we'd only have |
Interesting. That is not aligned with my opinion (I believe those should be separate nodes), but I'm not going to pursue this change any further :) Feel free to close if you're not interested in changes I suggested. |
I bumped into @Manishearth in a hallways and asked him for feedback on this. Manish - do you have any thoughts on our AST design here? You can find the ebnf here: https://github.com/projectfluent/fluent/blob/master/spec/fluent.ebnf |
I've never seen sigils be stored alongside identifiers in an AST (in a lex tree, sure, but this seems to be an AST) If there is a difference between TermReference and MessageReference at a syntactic level, they should probably be stored as separate nodes without any sigils. OTOH if they're similar enough that it makes sense to store them as the same kind of node, that works too, and you can use the (If I'm understanding the situation correctly) |
Extracting from projectfluent/fluent.js#206 -
Reference parser stores term reference sigil in its name:
Variables don't carry the variable sigil, and Comments don't carry the # sigil either.
In the EBNF it clearly is represented as:
In JS, Python, PHP and Rust if a bit of information is encoded by the AST node type, it is not stored in any node field's content.
I believe that in the same vein, TermReference should be stored as either:
or:
Out of the two, I believe the former is easier to work with, while the latter is closer to EBNF.
The text was updated successfully, but these errors were encountered: