diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs index a498b69527a..4b8bfcda848 100644 --- a/src/libsyntax/parse/common.rs +++ b/src/libsyntax/parse/common.rs @@ -37,9 +37,6 @@ trait parser_common { fn is_any_keyword(tok: token::token) -> bool; fn eat_keyword(word: ~str) -> bool; fn expect_keyword(word: ~str); - fn is_restricted_keyword(word: ~str) -> bool; - fn check_restricted_keywords(); - fn check_restricted_keywords_(w: ~str); fn expect_gt(); fn parse_seq_to_before_gt(sep: Option, f: fn(parser) -> T) -> ~[T]; @@ -104,7 +101,6 @@ impl parser: parser_common { } fn parse_value_ident() -> ast::ident { - self.check_restricted_keywords(); return self.parse_ident(); } @@ -165,26 +161,6 @@ impl parser: parser_common { } } - fn is_restricted_keyword(word: ~str) -> bool { - self.restricted_keywords.contains_key_ref(&word) - } - - fn check_restricted_keywords() { - match self.token { - token::IDENT(_, false) => { - let w = token_to_str(self.reader, self.token); - self.check_restricted_keywords_(w); - } - _ => () - } - } - - fn check_restricted_keywords_(w: ~str) { - if self.is_restricted_keyword(w) { - self.fatal(~"found `" + w + ~"` in restricted position"); - } - } - fn is_strict_keyword(word: ~str) -> bool { self.strict_keywords.contains_key_ref(&word) } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 73b2594c4ae..06e68a09abe 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -217,7 +217,6 @@ fn parser(sess: parse_sess, cfg: ast::crate_cfg, restriction: UNRESTRICTED, quote_depth: 0u, keywords: token::keyword_table(), - restricted_keywords: token::restricted_keyword_table(), strict_keywords: token::strict_keyword_table(), reserved_keywords: token::reserved_keyword_table(), obsolete_set: std::map::HashMap(), @@ -239,7 +238,6 @@ struct parser { reader: reader, interner: interner<@~str>, keywords: HashMap<~str, ()>, - restricted_keywords: HashMap<~str, ()>, strict_keywords: HashMap<~str, ()>, reserved_keywords: HashMap<~str, ()>, /// The set of seen errors about obsolete syntax. Used to suppress @@ -3200,7 +3198,6 @@ impl parser { let ty_params = self.parse_ty_params(); // Newtype syntax if self.token == token::EQ { - self.check_restricted_keywords_(*self.id_to_str(id)); self.bump(); let ty = self.parse_ty(false); self.expect(token::SEMI); diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index f9c50e46264..c7ecc5ae548 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -362,20 +362,17 @@ fn mk_fake_ident_interner() -> ident_interner { /** * All the valid words that have meaning in the Rust language. * - * Rust keywords are either 'temporary', 'restricted', or 'strict'. Temporary + * Rust keywords are either 'temporary', 'strict' or 'reserved'. Temporary * keywords are contextual and may be used as identifiers anywhere. They are - * expected to disappear from the grammar soon. Restricted keywords may not - * appear in positions that might otherwise contain _value identifiers_. - * Strict keywords may not appear as identifiers at all. + * expected to disappear from the grammar soon. Strict keywords may not + * appear as identifiers at all. Reserved keywords are not used anywhere in + * the language and may not appear as identifiers. */ fn keyword_table() -> HashMap<~str, ()> { let keywords = str_hash(); for temporary_keyword_table().each_key |word| { keywords.insert(word, ()); } - for restricted_keyword_table().each_key |word| { - keywords.insert(word, ()); - } for strict_keyword_table().each_key |word| { keywords.insert(word, ()); } @@ -397,30 +394,6 @@ fn temporary_keyword_table() -> HashMap<~str, ()> { words } -/** - * Keywords that may not appear in any position that might otherwise contain a - * _value identifier_. Restricted keywords may still be used as other types of - * identifiers. - * - * Reasons: - * - * * For some (most?), if used at the start of a line, they will cause the - * line to be interpreted as a specific kind of statement, which would be - * confusing. - * - * * `true` or `false` as identifiers would always be shadowed by - * the boolean constants - */ -fn restricted_keyword_table() -> HashMap<~str, ()> { - let words = str_hash(); - let keys = ~[ - ]; - for keys.each |word| { - words.insert(word, ()); - } - words -} - /// Full keywords. May not appear anywhere else. fn strict_keyword_table() -> HashMap<~str, ()> { let words = str_hash();