Skip to content

Commit d5bef01

Browse files
committed
Add identifiers to comments.md
1 parent 0b18ee6 commit d5bef01

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/comments.md

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

3+
4+
r[comments.lexical]
5+
36
> **<sup>Lexer</sup>**\
47
> LINE_COMMENT :\
58
> &nbsp;&nbsp; &nbsp;&nbsp; `//` (~\[`/` `!` `\n`] | `//`) ~`\n`<sup>\*</sup>\
@@ -34,25 +37,39 @@
3437
3538
## Non-doc comments
3639

40+
r[comments.normal]
41+
3742
Comments follow the general C++ style of line (`//`) and
3843
block (`/* ... */`) comment forms. Nested block comments are supported.
3944

45+
r[comments.normal.tokenization]
4046
Non-doc comments are interpreted as a form of whitespace.
4147

4248
## Doc comments
4349

50+
r[comments.doc]
51+
52+
r[comments.doc.syntax]
4453
Line doc comments beginning with exactly _three_ slashes (`///`), and block
4554
doc comments (`/** ... */`), both outer doc comments, are interpreted as a
46-
special syntax for [`doc` attributes]. That is, they are equivalent to writing
55+
special syntax for [`doc` attributes].
56+
57+
r[comments.doc.attribute]
58+
That is, they are equivalent to writing
4759
`#[doc="..."]` around the body of the comment, i.e., `/// Foo` turns into
4860
`#[doc="Foo"]` and `/** Bar */` turns into `#[doc="Bar"]`.
4961

62+
r[comments.doc.inner-syntax]
5063
Line comments beginning with `//!` and block comments `/*! ... */` are
5164
doc comments that apply to the parent of the comment, rather than the item
52-
that follows. That is, they are equivalent to writing `#![doc="..."]` around
65+
that follows.
66+
67+
r[comments.doc.inner-attribute]
68+
That is, they are equivalent to writing `#![doc="..."]` around
5369
the body of the comment. `//!` comments are usually used to document
5470
modules that occupy a source file.
5571

72+
r[comments.doc.bare-cr]
5673
The character `U+000D` (CR) is not allowed in doc comments.
5774

5875
> **Note**: The sequence `U+000D` (CR) immediately followed by `U+000A` (LF) would have been previously transformed into a single `U+000A` (LF).

0 commit comments

Comments
 (0)