Skip to content

Commit 61a5e46

Browse files
committed
Auto merge of rust-lang#24825 - rkruppe:reference-audit, r=steveklabnik
Transplant the relevant changes (turns out to be all of them) to `grammar.md`, and remove all grammar talk from `reference.md`. Sorry for the chaos. The second commit, further below, goes over the comments and whitespace sections. r? @steveklabnik
2 parents 20adc95 + 0ea193d commit 61a5e46

File tree

2 files changed

+21
-30
lines changed

2 files changed

+21
-30
lines changed

src/doc/grammar.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,16 @@ explicit codepoint lists. [^inputformat]
9696
## Special Unicode Productions
9797

9898
The following productions in the Rust grammar are defined in terms of Unicode
99-
properties: `ident`, `non_null`, `non_star`, `non_eol`, `non_slash_or_star`,
100-
`non_single_quote` and `non_double_quote`.
99+
properties: `ident`, `non_null`, `non_eol`, `non_single_quote` and
100+
`non_double_quote`.
101101

102102
### Identifiers
103103

104-
The `ident` production is any nonempty Unicode string of the following form:
104+
The `ident` production is any nonempty Unicode[^non_ascii_idents] string of
105+
the following form:
106+
107+
[^non_ascii_idents]: Non-ASCII characters in identifiers are currently feature
108+
gated. This is expected to improve soon.
105109

106110
- The first character has property `XID_start`
107111
- The remaining characters have property `XID_continue`
@@ -118,8 +122,6 @@ Some productions are defined by exclusion of particular Unicode characters:
118122

119123
- `non_null` is any single Unicode character aside from `U+0000` (null)
120124
- `non_eol` is `non_null` restricted to exclude `U+000A` (`'\n'`)
121-
- `non_star` is `non_null` restricted to exclude `U+002A` (`*`)
122-
- `non_slash_or_star` is `non_null` restricted to exclude `U+002F` (`/`) and `U+002A` (`*`)
123125
- `non_single_quote` is `non_null` restricted to exclude `U+0027` (`'`)
124126
- `non_double_quote` is `non_null` restricted to exclude `U+0022` (`"`)
125127

src/doc/reference.md

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,9 @@ explicit code point lists. [^inputformat]
6565
provided to the grammar verifier, restricted to ASCII range, when verifying the
6666
grammar in this document.
6767

68-
## Special Unicode Productions
68+
## Identifiers
6969

70-
The following productions in the Rust grammar are defined in terms of Unicode
71-
properties: `ident`, `non_null`, `non_eol`, `non_single_quote` and `non_double_quote`.
72-
73-
### Identifiers
74-
75-
The `ident` production is any nonempty Unicode[^non_ascii_idents] string of the following form:
70+
An identifier is any nonempty Unicode[^non_ascii_idents] string of the following form:
7671

7772
[^non_ascii_idents]: Non-ASCII characters in identifiers are currently feature
7873
gated. This is expected to improve soon.
@@ -86,40 +81,34 @@ that does _not_ occur in the set of [keywords](#keywords).
8681
> character ranges used to form the more familiar C and Java language-family
8782
> identifiers.
8883
89-
### Delimiter-restricted productions
90-
91-
Some productions are defined by exclusion of particular Unicode characters:
92-
93-
- `non_null` is any single Unicode character aside from `U+0000` (null)
94-
- `non_eol` is `non_null` restricted to exclude `U+000A` (`'\n'`)
95-
- `non_single_quote` is `non_null` restricted to exclude `U+0027` (`'`)
96-
- `non_double_quote` is `non_null` restricted to exclude `U+0022` (`"`)
97-
9884
## Comments
9985

100-
Comments in Rust code follow the general C++ style of line and block-comment
101-
forms. Nested block comments are supported.
86+
Comments in Rust code follow the general C++ style of line (`//`) and
87+
block-comment (`/* ... */`) forms. Nested block comments are supported.
10288

10389
Line comments beginning with exactly _three_ slashes (`///`), and block
10490
comments beginning with exactly one repeated asterisk in the block-open
10591
sequence (`/**`), are interpreted as a special syntax for `doc`
10692
[attributes](#attributes). That is, they are equivalent to writing
107-
`#[doc="..."]` around the body of the comment (this includes the comment
108-
characters themselves, i.e. `/// Foo` turns into `#[doc="/// Foo"]`).
93+
`#[doc="..."]` around the body of the comment, i.e., `/// Foo` turns into
94+
`#[doc="Foo"]`.
10995

11096
Line comments beginning with `//!` and block comments beginning with `/*!` are
11197
doc comments that apply to the parent of the comment, rather than the item
11298
that follows. That is, they are equivalent to writing `#![doc="..."]` around
113-
the body of the comment. `//!` comments are usually used to display
114-
information on the crate index page.
99+
the body of the comment. `//!` comments are usually used to document
100+
modules that occupy a source file.
115101

116102
Non-doc comments are interpreted as a form of whitespace.
117103

118104
## Whitespace
119105

120-
The `whitespace_char` production is any nonempty Unicode string consisting of
121-
any of the following Unicode characters: `U+0020` (space, `' '`), `U+0009`
122-
(tab, `'\t'`), `U+000A` (LF, `'\n'`), `U+000D` (CR, `'\r'`).
106+
Whitespace is any non-empty string containing any the following characters:
107+
108+
- `U+0020` (space, `' '`)
109+
- `U+0009` (tab, `'\t'`)
110+
- `U+000A` (LF, `'\n'`)
111+
- `U+000D` (CR, `'\r'`)
123112

124113
Rust is a "free-form" language, meaning that all forms of whitespace serve only
125114
to separate _tokens_ in the grammar, and have no semantic significance.

0 commit comments

Comments
 (0)