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'm currently working on documenting the grammar of my language (an extension of Tiny-C) and the line comments are nice, but I'd like to be able to write multi-line comments for two reasons: format and ergonomics.
Format
Single-line comments tends towards this kind of formatting:
////////////////////////////////////////////////// Terms //////////////////////////////////////////////////// Terms are the smallest concept in this grammar.// A term can either be:// - An expression (nested between two parenthesis)// - An integer literal// - A variable's id// Terms can be evaluated to have a value. In the // case of the "expression" kind of Term, their// value is propagated to the left like this:// "a = 5" // Value is 5// "1 < 2" // Value is 1// "1 - (2 < 3)" // Value is 0
Whereas with multi-line comments it would look like this:
////////////////////////////////////////////////// Terms ///////////////////////////////////////////////////* Terms are the smallest concept in this grammar. A term can either be: - An expression (nested between two parenthesis) - An integer literal - A variable's id Terms can be evaluated to have a value. In the case of the "expression" kind of Term, their value is propagated to the left like this: "a = 5" // Value is 5 "1 < 2" // Value is 1 "1 - (2 < 3)" // Value is 0*/
Multi-line comments are usually easier to read and feel less cluttered.
Ergonomics
With single-line comments you have to manually start a comment every time you want to write another line, which isn't as good as it could be in the ergonomic sense.
Editing is also easier with multi-line comments: the two slashes (//) that you would otherwise have to manually edit alongside your text aren't there anymore. This makes documenting the grammar inside its own file that much easier.
Anyway, I might be completely wrong here. I've only been using Pest for like 3-4 weeks. But I'd love to have multi-line comments inside the grammar files.
If you agree with me, I'll happily make the PR. What file should I edit? I get the feeling that I should add the multi-line option here.
Have a good weekend 🙂
The text was updated successfully, but these errors were encountered:
Thanks for writing this out. 😃 I'm generally in favor of this change. Keeping this similar to Rust is a good trend and I guess it should be as easy as possible to change from Rust to pest and back. Would you like to give this a try?
332: [WIP] Add multiline comments to Pest's PEG format r=dragostis a=felix91gr
Implementation of #330. At least, that's what I think.
Probably needs tests. How do I make one, or update the existing ones?
And how can I test it manually?
Thanks <3
Co-authored-by: Félix Fischer <[email protected]>
Co-authored-by: Félix Fischer <[email protected]>
Hi all,
I'm currently working on documenting the grammar of my language (an extension of Tiny-C) and the line comments are nice, but I'd like to be able to write multi-line comments for two reasons: format and ergonomics.
Format
Single-line comments tends towards this kind of formatting:
Whereas with multi-line comments it would look like this:
Multi-line comments are usually easier to read and feel less cluttered.
Ergonomics
With single-line comments you have to manually start a comment every time you want to write another line, which isn't as good as it could be in the ergonomic sense.
Editing is also easier with multi-line comments: the two slashes (
//
) that you would otherwise have to manually edit alongside your text aren't there anymore. This makes documenting the grammar inside its own file that much easier.Anyway, I might be completely wrong here. I've only been using Pest for like 3-4 weeks. But I'd love to have multi-line comments inside the grammar files.
If you agree with me, I'll happily make the PR. What file should I edit? I get the feeling that I should add the multi-line option here.
Have a good weekend 🙂
The text was updated successfully, but these errors were encountered: