Add and lex LIFETIME tokens

cc #4846
This commit is contained in:
Niko Matsakis 2013-02-08 06:02:35 -08:00
parent bc1fb62c34
commit 14930fbffe
3 changed files with 90 additions and 22 deletions

View file

@ -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,