-
Notifications
You must be signed in to change notification settings - Fork 501
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
Added grammar of comments #85
Added grammar of comments #85
Conversation
dfb4236
to
586e630
Compare
src/comments.md
Outdated
@@ -1,5 +1,24 @@ | |||
# Comments | |||
|
|||
> **<sup>Lexer</sup>** | |||
> LINE_COMMENT : | |||
> `//` ~[\n\r]* |
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.
A line comment can include bare CRs unless it isn't a doc-comment.
src/comments.md
Outdated
> `/*` (BLOCK_COMMENT | .)* `*/` | ||
> | ||
> OUTER_DOC_LINE_COMMENT : | ||
> `//!` ~[\n\r]* |
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.
Only one of LF/CRLF/EOF can end outer/inner doc line comments and bare CR isn't allowed here. For example, "//! foo \r//! bar\n"
will lead to a syntax error. The difficulty here would be to express the fact that //! foo \r//! bar\n
isn't a non-doc comment neither.
src/comments.md
Outdated
> `/*!` (OUTER_DOC_BLOCK_COMMENT | .)* `*/` | ||
> | ||
> INNER_DOC_LINE_COMMENT : | ||
> `///` ~[\n\r]* |
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.
There is an exception: comments starting with ////
is a non-doc line comment.
src/comments.md
Outdated
> `//!` ~[\n\r]* | ||
> | ||
> OUTER_DOC_BLOCK_COMMENT : | ||
> `/*!` (OUTER_DOC_BLOCK_COMMENT | .)* `*/` |
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.
In outer/inner doc block comments, any kinds of block comments /* */
/** */
/*! */
can be nested.
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.
In outer/inner doc comments, bare CR isn't allowed. CRLF is allowed instead.
@qnighy Thank you for your comments 👍 I changed the comments' grammar to account for the special cases (and put a lot of examples to make these clear). I'll try to tackle the CR / CRLF problem tomorrow. |
9f094be
to
c623f98
Compare
@brauliobz What's the status here? |
@Havvy I got involved with other parts of the grammar and forgot about this one :/ . The remaining problem here is the CR/LF details. I'm doing it now. |
LGTM, thanks! |
Issue #84