From 8e3774ffcacda53cf92d928fff23d2cb4ad09f63 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 19 Jul 2015 14:24:42 -0700 Subject: [PATCH] Comma as separate token --- src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 85852b7..19a73cf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,6 +14,7 @@ enum Token { Separator, LParen, RParen, + Comma, NumLiteral(i32), StrLiteral(String), Identifier(String) @@ -85,8 +86,9 @@ fn tokenize(input: &str) -> Vec { tokens.push(Token::LParen); } else if c == ')' { tokens.push(Token::RParen); + } else if c == ',' { + tokens.push(Token::Comma); } else { - let mut buffer = String::with_capacity(20); buffer.push(c);