Skip to content

Commit 9e4714c

Browse files
committed
---
yaml --- r: 8107 b: refs/heads/snap-stage3 c: 87a4880 h: refs/heads/master i: 8105: 5777582 8103: ac635a0 v: v3
1 parent 21bbcfb commit 9e4714c

File tree

3 files changed

+28
-54
lines changed

3 files changed

+28
-54
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 2898dcc5d97da9427ac367542382b6239d9c0bbf
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: a08e589390993d27bf8504c1c8c54586bbfa3d37
4+
refs/heads/snap-stage3: 87a488048d59dcdcfe191c1cfcaaf1684416eb27
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/snap-stage3/doc/rust.md

Lines changed: 21 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ Productions](#special-unicode-productions).
102102

103103
Some rules in the grammar -- notably [unary
104104
operators](#unary-operator-expressions), [binary
105-
operators](#binary-operator-expressions), [keywords](#keywords) and [reserved
106-
words](#reserved-words) -- are given in a simplified form: as a listing of a
107-
table of unquoted, printable whitespace-separated strings. These cases form a
108-
subset of the rules regarding the [token](#tokens) rule, and are assumed to be
109-
the result of a lexical-analysis phase feeding the parser, driven by a DFA,
110-
operating over the disjunction of all such string table entries.
105+
operators](#binary-operator-expressions), and [keywords](#keywords) --
106+
are given in a simplified form: as a listing of a table of unquoted,
107+
printable whitespace-separated strings. These cases form a subset of
108+
the rules regarding the [token](#tokens) rule, and are assumed to be
109+
the result of a lexical-analysis phase feeding the parser, driven by a
110+
DFA, operating over the disjunction of all such string table entries.
111111

112112
When such a string enclosed in double-quotes (`"`) occurs inside the
113113
grammar, it is an implicit reference to a single member of such a string table
@@ -139,8 +139,7 @@ The `ident` production is any nonempty Unicode string of the following form:
139139
- The first character has property `XID_start`
140140
- The remaining characters have property `XID_continue`
141141

142-
that does _not_ occur in the set of [keywords](#keywords) or [reserved
143-
words](#reserved-words).
142+
that does _not_ occur in the set of [keywords](#keywords).
144143

145144
Note: `XID_start` and `XID_continue` as character properties cover the
146145
character ranges used to form the more familiar C and Java language-family
@@ -190,7 +189,7 @@ with any other legal whitespace element, such as a single space character.
190189
## Tokens
191190

192191
~~~~~~~~ {.ebnf .gram}
193-
simple_token : keyword | reserved | unop | binop ;
192+
simple_token : keyword | unop | binop ;
194193
token : simple_token | ident | literal | symbol | whitespace token ;
195194
~~~~~~~~
196195

@@ -204,52 +203,32 @@ grammar as double-quoted strings. Other tokens have exact rules given.
204203
The keywords in [crate files](#crate-files) are the following strings:
205204

206205
~~~~~~~~ {.keyword}
207-
import export use mod dir
206+
import export use mod
208207
~~~~~~~~
209208

210209
The keywords in [source files](#source-files) are the following strings:
211210

212-
*TODO* split these between type keywords and regular (value) keywords,
213-
and define two different `identifier` productions for the different
214-
contexts.
215-
216211
~~~~~~~~ {.keyword}
217-
alt any as assert
218-
be bind block bool break
219-
char check claim const cont
212+
alt assert
213+
be break
214+
check claim class const cont copy
220215
do
221216
else enum export
222-
f32 f64 fail false float fn for
223-
i16 i32 i64 i8 if iface impl import in int
217+
fail false fn for
218+
if iface impl import
224219
let log
225220
mod mutable
226-
native note
227-
of
228-
prove pure
221+
native
222+
pure
229223
resource ret
230-
self str syntax
231224
true type
232-
u16 u32 u64 u8 uint unchecked unsafe use
233-
vec
225+
unsafe use
234226
while
235227
~~~~~~~~
236228

237229
Any of these have special meaning in their respective grammars, and are
238230
excluded from the `ident` rule.
239231

240-
### Reserved words
241-
242-
The reserved words are the following strings:
243-
244-
~~~~~~~~ {.reserved}
245-
m32 m64 m128
246-
f80 f16 f128
247-
class trait
248-
~~~~~~~~
249-
250-
Any of these may have special meaning in future versions of the language, so
251-
are excluded from the `ident` rule.
252-
253232
### Literals
254233

255234
A literal is an expression consisting of a single token, rather than a
@@ -389,10 +368,6 @@ literal. There are three floating-point suffixes: `f` (for the base
389368
`float` type), `f32`, and `f64` (the 32-bit and 64-bit floating point
390369
types).
391370

392-
A set of suffixes are also reserved to accommodate literal support for
393-
types corresponding to reserved tokens. The reserved suffixes are `f16`,
394-
`f80`, `f128`, `m`, `m32`, `m64` and `m128`.
395-
396371
Examples of floating-point literals of various forms:
397372

398373
~~~~
@@ -421,8 +396,7 @@ Symbols are a general class of printable [token](#tokens) that play structural
421396
roles in a variety of grammar productions. They are catalogued here for
422397
completeness as the set of remaining miscellaneous printable tokens that do not
423398
otherwise appear as [unary operators](#unary-operator-expressions), [binary
424-
operators](#binary-operator-expressions), [keywords](#keywords) or [reserved
425-
words](#reserved-words).
399+
operators](#binary-operator-expressions), or [keywords](#keywords).
426400

427401

428402
## Paths
@@ -1431,9 +1405,9 @@ rec_expr : '{' ident ':' expr
14311405

14321406
A _[record](#record-types) expression_ is one or more comma-separated
14331407
name-value pairs enclosed by braces. A fieldname can be any identifier
1434-
(including reserved words), and is separated from its value expression
1435-
by a colon. To indicate that a field is mutable, the `mutable` keyword
1436-
is written before its name.
1408+
(including keywords), and is separated from its value expression by a
1409+
colon. To indicate that a field is mutable, the `mutable` keyword is
1410+
written before its name.
14371411

14381412
~~~~
14391413
{x: 10f, y: 20f};

branches/snap-stage3/src/comp/syntax/parse/parser.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,12 @@ fn new_parser(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader,
147147
// interpreted as a specific kind of statement, which would be confusing.
148148
fn bad_expr_word_table() -> hashmap<str, ()> {
149149
let words = new_str_hash();
150-
for word in ["mod", "if", "else", "while", "do", "alt", "for", "break",
151-
"cont", "ret", "be", "fail", "type", "resource", "check",
152-
"assert", "claim", "native", "fn", "pure",
153-
"unsafe", "import", "export", "let", "const",
154-
"log", "copy", "impl", "iface", "enum",
155-
"class", "trait"] {
150+
for word in ["alt", "assert", "be", "break", "check", "claim",
151+
"class", "const", "cont", "copy", "do", "else", "enum",
152+
"export", "fail", "fn", "for", "if", "iface", "impl",
153+
"import", "let", "log", "mod", "mutable", "native", "pure",
154+
"resource", "ret", "trait", "type", "unchecked", "unsafe",
155+
"while"] {
156156
words.insert(word, ());
157157
}
158158
words

0 commit comments

Comments
 (0)