Lexer ignores commas

This commit is contained in:
Kasper 2020-01-12 00:07:10 +01:00
parent 8a232f72f0
commit efa76e93c5

View File

@ -10,6 +10,7 @@ use crate::units::Unit::*;
pub fn lex(input: &str) -> Result<TokenVector, String> { pub fn lex(input: &str) -> Result<TokenVector, String> {
let input = input.replace(",", "");
let mut chars = input.chars().enumerate().peekable(); let mut chars = input.chars().enumerate().peekable();
let mut tokens: TokenVector = vec![]; let mut tokens: TokenVector = vec![];
let max_word_length = 30; let max_word_length = 30;
@ -36,7 +37,6 @@ pub fn lex(input: &str) -> Result<TokenVector, String> {
tokens.push(Token::Operator(RightParen)); tokens.push(Token::Operator(RightParen));
}, },
'π' => tokens.push(Token::Constant(Pi)), 'π' => tokens.push(Token::Constant(Pi)),
',' => {},
value if value.is_whitespace() => {}, value if value.is_whitespace() => {},
value if value.is_alphabetic() => { value if value.is_alphabetic() => {