Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
275 changes: 2 additions & 273 deletions src/libsyntax/parse/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use util::interner;

use core::cast;
use core::char;
use core::cmp;
use core::str;
use core::task;
use std::oldmap::HashMap;
Expand All @@ -41,6 +40,7 @@ pub enum binop {

#[auto_encode]
#[auto_decode]
#[deriving_eq]
pub enum Token {
/* Expression-operator symbols. */
EQ,
Expand Down Expand Up @@ -103,6 +103,7 @@ pub enum Token {

#[auto_encode]
#[auto_decode]
#[deriving_eq]
/// For interpolation during macro expansion.
pub enum nonterminal {
nt_item(@ast::item),
Expand Down Expand Up @@ -522,278 +523,6 @@ pub fn reserved_keyword_table() -> HashMap<~str, ()> {
}


impl cmp::Eq for Token {
pure fn eq(&self, other: &Token) -> bool {
match (*self) {
EQ => {
match (*other) {
EQ => true,
_ => false
}
}
LT => {
match (*other) {
LT => true,
_ => false
}
}
LE => {
match (*other) {
LE => true,
_ => false
}
}
EQEQ => {
match (*other) {
EQEQ => true,
_ => false
}
}
NE => {
match (*other) {
NE => true,
_ => false
}
}
GE => {
match (*other) {
GE => true,
_ => false
}
}
GT => {
match (*other) {
GT => true,
_ => false
}
}
ANDAND => {
match (*other) {
ANDAND => true,
_ => false
}
}
OROR => {
match (*other) {
OROR => true,
_ => false
}
}
NOT => {
match (*other) {
NOT => true,
_ => false
}
}
TILDE => {
match (*other) {
TILDE => true,
_ => false
}
}
BINOP(e0a) => {
match (*other) {
BINOP(e0b) => e0a == e0b,
_ => false
}
}
BINOPEQ(e0a) => {
match (*other) {
BINOPEQ(e0b) => e0a == e0b,
_ => false
}
}
AT => {
match (*other) {
AT => true,
_ => false
}
}
DOT => {
match (*other) {
DOT => true,
_ => false
}
}
DOTDOT => {
match (*other) {
DOTDOT => true,
_ => false
}
}
COMMA => {
match (*other) {
COMMA => true,
_ => false
}
}
SEMI => {
match (*other) {
SEMI => true,
_ => false
}
}
COLON => {
match (*other) {
COLON => true,
_ => false
}
}
MOD_SEP => {
match (*other) {
MOD_SEP => true,
_ => false
}
}
RARROW => {
match (*other) {
RARROW => true,
_ => false
}
}
LARROW => {
match (*other) {
LARROW => true,
_ => false
}
}
DARROW => {
match (*other) {
DARROW => true,
_ => false
}
}
FAT_ARROW => {
match (*other) {
FAT_ARROW => true,
_ => false
}
}
LPAREN => {
match (*other) {
LPAREN => true,
_ => false
}
}
RPAREN => {
match (*other) {
RPAREN => true,
_ => false
}
}
LBRACKET => {
match (*other) {
LBRACKET => true,
_ => false
}
}
RBRACKET => {
match (*other) {
RBRACKET => true,
_ => false
}
}
LBRACE => {
match (*other) {
LBRACE => true,
_ => false
}
}
RBRACE => {
match (*other) {
RBRACE => true,
_ => false
}
}
POUND => {
match (*other) {
POUND => true,
_ => false
}
}
DOLLAR => {
match (*other) {
DOLLAR => true,
_ => false
}
}
LIT_INT(e0a, e1a) => {
match (*other) {
LIT_INT(e0b, e1b) => e0a == e0b && e1a == e1b,
_ => false
}
}
LIT_UINT(e0a, e1a) => {
match (*other) {
LIT_UINT(e0b, e1b) => e0a == e0b && e1a == e1b,
_ => false
}
}
LIT_INT_UNSUFFIXED(e0a) => {
match (*other) {
LIT_INT_UNSUFFIXED(e0b) => e0a == e0b,
_ => false
}
}
LIT_FLOAT(e0a, e1a) => {
match (*other) {
LIT_FLOAT(e0b, e1b) => e0a == e0b && e1a == e1b,
_ => false
}
}
LIT_FLOAT_UNSUFFIXED(e0a) => {
match (*other) {
LIT_FLOAT_UNSUFFIXED(e0b) => e0a == e0b,
_ => false
}
}
LIT_STR(e0a) => {
match (*other) {
LIT_STR(e0b) => e0a == e0b,
_ => false
}
}
IDENT(e0a, e1a) => {
match (*other) {
IDENT(e0b, e1b) => e0a == e0b && e1a == e1b,
_ => false
}
}
LIFETIME(e0a) => {
match (*other) {
LIFETIME(e0b) => e0a == e0b,
_ => false
}
}
UNDERSCORE => {
match (*other) {
UNDERSCORE => true,
_ => false
}
}
INTERPOLATED(_) => {
match (*other) {
INTERPOLATED(_) => true,
_ => false
}
}
DOC_COMMENT(e0a) => {
match (*other) {
DOC_COMMENT(e0b) => e0a == e0b,
_ => false
}
}
EOF => {
match (*other) {
EOF => true,
_ => false
}
}
}
}
pure fn ne(&self, other: &Token) -> bool { !(*self).eq(other) }
}

// Local Variables:
// fill-column: 78;
// indent-tabs-mode: nil
Expand Down