-
Notifications
You must be signed in to change notification settings - Fork 45
Parse Comments line by line #168
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one I like.
There's a bit of a naming/AST-ishness thing, though. The relationship between the CommentLine, the used-to-be abstract baseclass BaseComment
and the "no BaseComment in the AST".
I'd love to see a comment somewhere. Maybe this is something to add to spec/valid.md
? Like, an AST with a BaseComment
would be illegal? But also, we make 'em illegal and then fix 'em up.
Some human readable "comment lines of the same comment type are aggregated", and "Comments preceding a Message or Term without blank line are removed from the resource, and added to that Message or Term". I really don't know where to best put it, in grammar.mjs->fluent.ebnf
, in abstract.mjs
, or in spec/valid.md
.
Slightly derailing, I wonder if there's a better way to pass non-public Nodes from the CST to AST generation? I toyed with the indention part, and had a similar urge for an Indent node in ast.mjs
, and felt dirty about that. Would using PatternElement have been fine?
I don't want to create too many assumptions about the AST. Some languages will need to slightly diverge from it to be able to implement Fluent. Right now, I think we could standardize the JSON-serialized version of the AST. This would be useful for transporting data between implementations. Abstract classes like
I'll add
Yeah, perhaps! I used |
One more thing. The way I used I'm not familiar with your exact use-case, but if you feel the need to temporarily store the indent as a node in the AST and then do something with it during a construction of another node, then we should look at the code and figure out if In the second commit of this PR I dropped |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. r=me.
Spin-off from #160; the
Comment
part.