about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorBirunthan Mohanathas <birunthan@mohanathas.com>2013-09-21 16:31:57 +0300
committerBirunthan Mohanathas <birunthan@mohanathas.com>2013-09-22 10:47:36 +0300
commit2ab278f130cb206ce9117145ddefbbb650ba8c68 (patch)
treef3a05c3ea35007bebd243e5c9c62c2bc31576fc5 /src/libsyntax/parse
parenteabcb39f8d5c634185174461481ec1f39fe07bcb (diff)
downloadrust-2ab278f130cb206ce9117145ddefbbb650ba8c68.tar.gz
rust-2ab278f130cb206ce9117145ddefbbb650ba8c68.zip
Reserve the `alignof`, `offsetof`, and `sizeof` keywords
Closes #9333.
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/token.rs18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index a8df737e49f..6cc1058954c 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -482,6 +482,9 @@ fn mk_fresh_ident_interner() -> @ident_interner {
         "pure",               // 65
         "yield",              // 66
         "typeof",             // 67
+        "alignof",            // 68
+        "offsetof",           // 69
+        "sizeof",             // 70
     ];
 
     @interner::StrInterner::prefill(init_vec)
@@ -622,14 +625,17 @@ pub mod keywords {
         True,
         Trait,
         Type,
-        Typeof,
         Unsafe,
         Use,
         While,
 
         // Reserved keywords
+        Alignof,
         Be,
+        Offsetof,
         Pure,
+        Sizeof,
+        Typeof,
         Yield,
     }
 
@@ -667,12 +673,16 @@ pub mod keywords {
                 True => Ident { name: 57, ctxt: 0 },
                 Trait => Ident { name: 58, ctxt: 0 },
                 Type => Ident { name: 59, ctxt: 0 },
-                Typeof => Ident { name: 67, ctxt: 0 },
                 Unsafe => Ident { name: 60, ctxt: 0 },
                 Use => Ident { name: 61, ctxt: 0 },
                 While => Ident { name: 62, ctxt: 0 },
+
+                Alignof => Ident { name: 68, ctxt: 0 },
                 Be => Ident { name: 64, ctxt: 0 },
+                Offsetof => Ident { name: 69, ctxt: 0 },
                 Pure => Ident { name: 65, ctxt: 0 },
+                Sizeof => Ident { name: 70, ctxt: 0 },
+                Typeof => Ident { name: 67, ctxt: 0 },
                 Yield => Ident { name: 66, ctxt: 0 },
             }
         }
@@ -689,7 +699,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 .. 67 => true,
+            8 | 27 | 32 .. 70 => true,
             _ => false,
         },
         _ => false
@@ -709,7 +719,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 .. 67 => true,
+            64 .. 70 => true,
             _ => false,
         },
         _ => false,