about summary refs log tree commit diff
path: root/src/libsyntax/parse/token.rs
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2013-02-08 06:02:35 -0800
committerNiko Matsakis <niko@alum.mit.edu>2013-02-08 06:02:35 -0800
commit14930fbffe95971e9258cb2eb45a1642eb735bbe (patch)
tree605f9182243b7979f5d334a51b2733d08e0d14d4 /src/libsyntax/parse/token.rs
parentbc1fb62c343639f9ac66cb0017b8c1813d5e06a7 (diff)
downloadrust-14930fbffe95971e9258cb2eb45a1642eb735bbe.tar.gz
rust-14930fbffe95971e9258cb2eb45a1642eb735bbe.zip
Add and lex LIFETIME tokens
cc #4846
Diffstat (limited to 'src/libsyntax/parse/token.rs')
-rw-r--r--src/libsyntax/parse/token.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 2770d823bf3..49de7264d2c 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -88,6 +88,7 @@ pub enum Token {
     /* Name components */
     IDENT(ast::ident, bool),
     UNDERSCORE,
+    LIFETIME(ast::ident),
 
     /* For interpolation */
     INTERPOLATED(nonterminal),
@@ -193,7 +194,7 @@ pub fn to_str(in: @ident_interner, t: Token) -> ~str {
 
       /* Name components */
       IDENT(s, _) => *in.get(s),
-
+      LIFETIME(s) => fmt!("'%s", *in.get(s)),
       UNDERSCORE => ~"_",
 
       /* Other */
@@ -760,6 +761,12 @@ impl Token : cmp::Eq {
                     _ => false
                 }
             }
+            LIFETIME(e0a) => {
+                match (*other) {
+                    LIFETIME(e0b) => e0a == e0b,
+                    _ => false
+                }
+            }
             UNDERSCORE => {
                 match (*other) {
                     UNDERSCORE => true,