Skip to content

Commit a5b41b7

Browse files
Merge pull request #1563 from chorman0773/spec-add-identifiers-comments
Add spec identifiers to comments.md
2 parents 8a273e7 + 560be62 commit a5b41b7

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/comments.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Comments
22

3+
r[comments.syntax]
4+
35
> **<sup>Lexer</sup>**\
46
> LINE_COMMENT :\
57
> &nbsp;&nbsp; &nbsp;&nbsp; `//` (~\[`/` `!` `\n`] | `//`) ~`\n`<sup>\*</sup>\
@@ -34,26 +36,40 @@
3436
3537
## Non-doc comments
3638

39+
r[comments.normal]
40+
3741
Comments follow the general C++ style of line (`//`) and
3842
block (`/* ... */`) comment forms. Nested block comments are supported.
3943

44+
r[comments.normal.tokenization]
4045
Non-doc comments are interpreted as a form of whitespace.
4146

4247
## Doc comments
4348

49+
r[comments.doc]
50+
51+
r[comments.doc.syntax]
4452
Line doc comments beginning with exactly _three_ slashes (`///`), and block
4553
doc comments (`/** ... */`), both outer doc comments, are interpreted as a
46-
special syntax for [`doc` attributes]. That is, they are equivalent to writing
54+
special syntax for [`doc` attributes].
55+
56+
r[comments.doc.attributes]
57+
That is, they are equivalent to writing
4758
`#[doc="..."]` around the body of the comment, i.e., `/// Foo` turns into
4859
`#[doc="Foo"]` and `/** Bar */` turns into `#[doc="Bar"]`. They must therefore
4960
appear before something that accepts an outer attribute.
5061

62+
r[comments.doc.inner-syntax]
5163
Line comments beginning with `//!` and block comments `/*! ... */` are
5264
doc comments that apply to the parent of the comment, rather than the item
53-
that follows. That is, they are equivalent to writing `#![doc="..."]` around
65+
that follows.
66+
67+
r[comments.doc.inner-attributes]
68+
That is, they are equivalent to writing `#![doc="..."]` around
5469
the body of the comment. `//!` comments are usually used to document
5570
modules that occupy a source file.
5671

72+
r[comments.doc.bare-crs]
5773
The character `U+000D` (CR) is not allowed in doc comments.
5874

5975
> **Note**: It is conventional for doc comments to contain Markdown, as expected by

0 commit comments

Comments
 (0)