about summary refs log tree commit diff
path: root/src/libsyntax/parse/token.rs
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2013-07-31 17:59:59 -0400
committerDaniel Micay <danielmicay@gmail.com>2013-08-01 00:21:13 -0400
commitdabd4762037baab06603fe76dd59795e4d415334 (patch)
treed06d60ad7b3088ba03377f022c11fa779a78a7dc /src/libsyntax/parse/token.rs
parentc47be6929bafa6c585949907627cd1ea3280fd50 (diff)
downloadrust-dabd4762037baab06603fe76dd59795e4d415334.tar.gz
rust-dabd4762037baab06603fe76dd59795e4d415334.zip
make `in` and `foreach` get treated as keywords
Diffstat (limited to 'src/libsyntax/parse/token.rs')
-rw-r--r--src/libsyntax/parse/token.rs26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 8d979990b31..500d2b1c640 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -125,7 +125,7 @@ pub fn binop_to_str(o: binop) -> ~str {
     }
 }
 
-pub fn to_str(in: @ident_interner, t: &Token) -> ~str {
+pub fn to_str(input: @ident_interner, t: &Token) -> ~str {
     match *t {
       EQ => ~"=",
       LT => ~"<",
@@ -195,8 +195,8 @@ pub fn to_str(in: @ident_interner, t: &Token) -> ~str {
       LIT_STR(ref s) => { fmt!("\"%s\"", ident_to_str(s).escape_default()) }
 
       /* Name components */
-      IDENT(s, _) => in.get(s.name).to_owned(),
-      LIFETIME(s) => fmt!("'%s", in.get(s.name)),
+      IDENT(s, _) => input.get(s.name).to_owned(),
+      LIFETIME(s) => fmt!("'%s", input.get(s.name)),
       UNDERSCORE => ~"_",
 
       /* Other */
@@ -204,7 +204,7 @@ pub fn to_str(in: @ident_interner, t: &Token) -> ~str {
       EOF => ~"<eof>",
       INTERPOLATED(ref nt) => {
         match nt {
-            &nt_expr(e) => ::print::pprust::expr_to_str(e, in),
+            &nt_expr(e) => ::print::pprust::expr_to_str(e, input),
             _ => {
                 ~"an interpolated " +
                     match (*nt) {
@@ -471,10 +471,10 @@ fn mk_fresh_ident_interner() -> @ident_interner {
         "unsafe",             // 61
         "use",                // 62
         "while",              // 63
+        "in",                 // 64
+        "foreach",            // 65
 
-        "be",                 // 64
-        "in",                 // 65
-        "foreach",            // 66
+        "be",                 // 66
     ];
 
     @ident_interner {
@@ -615,10 +615,10 @@ pub mod keywords {
                 False => ident { name: 39, ctxt: 0 },
                 Fn => ident { name: 40, ctxt: 0 },
                 For => ident { name: 41, ctxt: 0 },
-                ForEach => ident { name: 66, ctxt: 0 },
+                ForEach => ident { name: 65, ctxt: 0 },
                 If => ident { name: 42, ctxt: 0 },
                 Impl => ident { name: 43, ctxt: 0 },
-                In => ident { name: 65, ctxt: 0 },
+                In => ident { name: 64, ctxt: 0 },
                 Let => ident { name: 44, ctxt: 0 },
                 __Log => ident { name: 45, ctxt: 0 },
                 Loop => ident { name: 46, ctxt: 0 },
@@ -641,7 +641,7 @@ pub mod keywords {
                 Unsafe => ident { name: 61, ctxt: 0 },
                 Use => ident { name: 62, ctxt: 0 },
                 While => ident { name: 63, ctxt: 0 },
-                Be => ident { name: 64, ctxt: 0 },
+                Be => ident { name: 66, ctxt: 0 },
             }
         }
     }
@@ -657,7 +657,7 @@ pub fn is_keyword(kw: keywords::Keyword, tok: &Token) -> bool {
 pub fn is_any_keyword(tok: &Token) -> bool {
     match *tok {
         token::IDENT(sid, false) => match sid.name {
-            8 | 27 | 32 .. 64 => true,
+            8 | 27 | 32 .. 66 => true,
             _ => false,
         },
         _ => false
@@ -667,7 +667,7 @@ pub fn is_any_keyword(tok: &Token) -> bool {
 pub fn is_strict_keyword(tok: &Token) -> bool {
     match *tok {
         token::IDENT(sid, false) => match sid.name {
-            8 | 27 | 32 .. 63 => true,
+            8 | 27 | 32 .. 65 => true,
             _ => false,
         },
         _ => false,
@@ -677,7 +677,7 @@ pub fn is_strict_keyword(tok: &Token) -> bool {
 pub fn is_reserved_keyword(tok: &Token) -> bool {
     match *tok {
         token::IDENT(sid, false) => match sid.name {
-            64 => true,
+            66 => true,
             _ => false,
         },
         _ => false,