Comma as separate token
This commit is contained in:
parent
c6059ada7d
commit
8e3774ffca
@ -14,6 +14,7 @@ enum Token {
|
|||||||
Separator,
|
Separator,
|
||||||
LParen,
|
LParen,
|
||||||
RParen,
|
RParen,
|
||||||
|
Comma,
|
||||||
NumLiteral(i32),
|
NumLiteral(i32),
|
||||||
StrLiteral(String),
|
StrLiteral(String),
|
||||||
Identifier(String)
|
Identifier(String)
|
||||||
@ -85,8 +86,9 @@ fn tokenize(input: &str) -> Vec<Token> {
|
|||||||
tokens.push(Token::LParen);
|
tokens.push(Token::LParen);
|
||||||
} else if c == ')' {
|
} else if c == ')' {
|
||||||
tokens.push(Token::RParen);
|
tokens.push(Token::RParen);
|
||||||
|
} else if c == ',' {
|
||||||
|
tokens.push(Token::Comma);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
let mut buffer = String::with_capacity(20);
|
let mut buffer = String::with_capacity(20);
|
||||||
buffer.push(c);
|
buffer.push(c);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user