Skip to content

Commit 496ad20

Browse files
committed
---
yaml --- r: 28595 b: refs/heads/try c: 0c82c00 h: refs/heads/master i: 28593: 846f110 28591: ea0f8cd v: v3
1 parent 189d755 commit 496ad20

File tree

4 files changed

+5
-59
lines changed

4 files changed

+5
-59
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5-
refs/heads/try: 76f8cfb26c7aa38cf066c42ea500a57d48fc828d
5+
refs/heads/try: 0c82c00dc4f49aeb9b57c92c9a40ae35d8a1ee29
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df

branches/try/src/libsyntax/parse/common.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ trait parser_common {
3737
fn is_any_keyword(tok: token::token) -> bool;
3838
fn eat_keyword(word: ~str) -> bool;
3939
fn expect_keyword(word: ~str);
40-
fn is_restricted_keyword(word: ~str) -> bool;
41-
fn check_restricted_keywords();
42-
fn check_restricted_keywords_(w: ~str);
4340
fn expect_gt();
4441
fn parse_seq_to_before_gt<T: Copy>(sep: Option<token::token>,
4542
f: fn(parser) -> T) -> ~[T];
@@ -104,7 +101,6 @@ impl parser: parser_common {
104101
}
105102

106103
fn parse_value_ident() -> ast::ident {
107-
self.check_restricted_keywords();
108104
return self.parse_ident();
109105
}
110106

@@ -165,26 +161,6 @@ impl parser: parser_common {
165161
}
166162
}
167163

168-
fn is_restricted_keyword(word: ~str) -> bool {
169-
self.restricted_keywords.contains_key_ref(&word)
170-
}
171-
172-
fn check_restricted_keywords() {
173-
match self.token {
174-
token::IDENT(_, false) => {
175-
let w = token_to_str(self.reader, self.token);
176-
self.check_restricted_keywords_(w);
177-
}
178-
_ => ()
179-
}
180-
}
181-
182-
fn check_restricted_keywords_(w: ~str) {
183-
if self.is_restricted_keyword(w) {
184-
self.fatal(~"found `" + w + ~"` in restricted position");
185-
}
186-
}
187-
188164
fn is_strict_keyword(word: ~str) -> bool {
189165
self.strict_keywords.contains_key_ref(&word)
190166
}

branches/try/src/libsyntax/parse/parser.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ fn parser(sess: parse_sess, cfg: ast::crate_cfg,
217217
restriction: UNRESTRICTED,
218218
quote_depth: 0u,
219219
keywords: token::keyword_table(),
220-
restricted_keywords: token::restricted_keyword_table(),
221220
strict_keywords: token::strict_keyword_table(),
222221
reserved_keywords: token::reserved_keyword_table(),
223222
obsolete_set: std::map::HashMap(),
@@ -239,7 +238,6 @@ struct parser {
239238
reader: reader,
240239
interner: interner<@~str>,
241240
keywords: HashMap<~str, ()>,
242-
restricted_keywords: HashMap<~str, ()>,
243241
strict_keywords: HashMap<~str, ()>,
244242
reserved_keywords: HashMap<~str, ()>,
245243
/// The set of seen errors about obsolete syntax. Used to suppress
@@ -3200,7 +3198,6 @@ impl parser {
32003198
let ty_params = self.parse_ty_params();
32013199
// Newtype syntax
32023200
if self.token == token::EQ {
3203-
self.check_restricted_keywords_(*self.id_to_str(id));
32043201
self.bump();
32053202
let ty = self.parse_ty(false);
32063203
self.expect(token::SEMI);

branches/try/src/libsyntax/parse/token.rs

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -362,20 +362,17 @@ fn mk_fake_ident_interner() -> ident_interner {
362362
/**
363363
* All the valid words that have meaning in the Rust language.
364364
*
365-
* Rust keywords are either 'temporary', 'restricted', or 'strict'. Temporary
365+
* Rust keywords are either 'temporary', 'strict' or 'reserved'. Temporary
366366
* keywords are contextual and may be used as identifiers anywhere. They are
367-
* expected to disappear from the grammar soon. Restricted keywords may not
368-
* appear in positions that might otherwise contain _value identifiers_.
369-
* Strict keywords may not appear as identifiers at all.
367+
* expected to disappear from the grammar soon. Strict keywords may not
368+
* appear as identifiers at all. Reserved keywords are not used anywhere in
369+
* the language and may not appear as identifiers.
370370
*/
371371
fn keyword_table() -> HashMap<~str, ()> {
372372
let keywords = str_hash();
373373
for temporary_keyword_table().each_key |word| {
374374
keywords.insert(word, ());
375375
}
376-
for restricted_keyword_table().each_key |word| {
377-
keywords.insert(word, ());
378-
}
379376
for strict_keyword_table().each_key |word| {
380377
keywords.insert(word, ());
381378
}
@@ -397,30 +394,6 @@ fn temporary_keyword_table() -> HashMap<~str, ()> {
397394
words
398395
}
399396

400-
/**
401-
* Keywords that may not appear in any position that might otherwise contain a
402-
* _value identifier_. Restricted keywords may still be used as other types of
403-
* identifiers.
404-
*
405-
* Reasons:
406-
*
407-
* * For some (most?), if used at the start of a line, they will cause the
408-
* line to be interpreted as a specific kind of statement, which would be
409-
* confusing.
410-
*
411-
* * `true` or `false` as identifiers would always be shadowed by
412-
* the boolean constants
413-
*/
414-
fn restricted_keyword_table() -> HashMap<~str, ()> {
415-
let words = str_hash();
416-
let keys = ~[
417-
];
418-
for keys.each |word| {
419-
words.insert(word, ());
420-
}
421-
words
422-
}
423-
424397
/// Full keywords. May not appear anywhere else.
425398
fn strict_keyword_table() -> HashMap<~str, ()> {
426399
let words = str_hash();

0 commit comments

Comments
 (0)