Created
October 7, 2013 04:37
-
-
Save micahrj/6862615 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub enum Token { | |
Name(~str), | |
Number(float), | |
String(~str), | |
LeftParen, | |
RightParen, | |
LeftBrace, | |
RightBrace | |
} | |
impl ToStr for Token { | |
fn to_str(&self) -> ~str { | |
match *self { | |
Name(n) => n, | |
Number(n) => n.to_str(), | |
String(s) => s, | |
LeftParen => ~"(", | |
RightParen => ~")", | |
LeftBrace => ~"{", | |
RightBrace => ~"}" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment