mirror of https://github.com/rm-dr/daisy
Cleanup
parent
047c900193
commit
e0210a8f09
|
@ -49,16 +49,6 @@ pub(in crate::parser) fn tokenize(input: &String) -> VecDeque<PreToken> {
|
|||
|
||||
for (i, c) in input.chars().enumerate() {
|
||||
match c {
|
||||
// The minus sign can be both a Negative and an Operator.
|
||||
// Needs special treatment.
|
||||
'-' => {
|
||||
push_token(&mut g, t, i);
|
||||
t = Some(PreToken::PreOperator(
|
||||
LineLocation{pos: i, len: 1},
|
||||
String::from("-")
|
||||
));
|
||||
},
|
||||
|
||||
// Number
|
||||
// Commas act just like dots.
|
||||
',' | '.' | '0'..='9' => {
|
||||
|
@ -78,6 +68,16 @@ pub(in crate::parser) fn tokenize(input: &String) -> VecDeque<PreToken> {
|
|||
};
|
||||
},
|
||||
|
||||
// The minus sign can be both a Negative and an Operator.
|
||||
// Needs special treatment, always starts a new token.
|
||||
'-' => {
|
||||
push_token(&mut g, t, i);
|
||||
t = Some(PreToken::PreOperator(
|
||||
LineLocation{pos: i, len: 1},
|
||||
String::from("-")
|
||||
));
|
||||
},
|
||||
|
||||
// Operator
|
||||
'*'|'×'|'/'|'÷'|
|
||||
'+'|'^'|'!'|'%'
|
||||
|
|
Loading…
Reference in New Issue