summary refs log tree commit diff
path: root/src/libsyntax/parse/token.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-05-10 15:15:06 -0700
committerPatrick Walton <pcwalton@mimiga.net>2013-05-12 16:35:18 -0700
commit5d3559e6455757c5508bba5b5add69477ebac53e (patch)
tree71e166364df7f828c4c98c5853597d2c62c37fac /src/libsyntax/parse/token.rs
parent06ef889cdc77db862d526bf6a607ecdf3ee80beb (diff)
downloadrust-5d3559e6455757c5508bba5b5add69477ebac53e.tar.gz
rust-5d3559e6455757c5508bba5b5add69477ebac53e.zip
librustc: Make `self` and `static` into keywords
Diffstat (limited to 'src/libsyntax/parse/token.rs')
-rw-r--r--src/libsyntax/parse/token.rs27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 5688678b06a..fde383b445c 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -340,7 +340,7 @@ pub mod special_idents {
     pub static main : ident = ident { repr: 26, ctxt: 0};
     pub static opaque : ident = ident { repr: 27, ctxt: 0};
     pub static blk : ident = ident { repr: 28, ctxt: 0};
-    pub static static : ident = ident { repr: 29, ctxt: 0};
+    pub static statik : ident = ident { repr: 29, ctxt: 0};
     pub static intrinsic : ident = ident { repr: 30, ctxt: 0};
     pub static clownshoes_foreign_mod: ident = ident { repr: 31, ctxt: 0};
     pub static unnamed_field: ident = ident { repr: 32, ctxt: 0};
@@ -504,26 +504,17 @@ pub fn mk_fake_ident_interner() -> @ident_interner {
  */
 pub fn keyword_table() -> HashSet<~str> {
     let mut keywords = HashSet::new();
-    let mut tmp = temporary_keyword_table();
     let mut strict = strict_keyword_table();
     let mut reserved = reserved_keyword_table();
 
-    do tmp.consume |word|      { keywords.insert(word); }
-    do strict.consume |word|   { keywords.insert(word); }
-    do reserved.consume |word| { keywords.insert(word); }
-    return keywords;
-}
-
-/// Keywords that may be used as identifiers
-pub fn temporary_keyword_table() -> HashSet<~str> {
-    let mut words = HashSet::new();
-    let keys = ~[
-        ~"self", ~"static",
-    ];
-    do vec::consume(keys) |_, s| {
-        words.insert(s);
+    do strict.consume |word| {
+        keywords.insert(word);
     }
-    return words;
+    do reserved.consume |word| {
+        keywords.insert(word);
+    }
+
+    keywords
 }
 
 /// Full keywords. May not appear anywhere else.
@@ -542,7 +533,7 @@ pub fn strict_keyword_table() -> HashSet<~str> {
         ~"once",
         ~"priv", ~"pub", ~"pure",
         ~"ref", ~"return",
-        ~"struct", ~"super",
+        ~"static", ~"self", ~"struct", ~"super",
         ~"true", ~"trait", ~"type",
         ~"unsafe", ~"use",
         ~"while"