mirror of https://github.com/rm-dr/daisy
Whitespace
parent
03d081fe06
commit
156b94c937
|
@ -8,12 +8,12 @@ use crate::tokens::Operator;
|
||||||
// Called whenever a token is finished.
|
// Called whenever a token is finished.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn push_token(g: &mut VecDeque<PreToken>, t: Option<PreToken>, stop_i: usize) {
|
fn push_token(g: &mut VecDeque<PreToken>, t: Option<PreToken>, stop_i: usize) {
|
||||||
|
|
||||||
if t.is_none() { return }
|
if t.is_none() { return }
|
||||||
let mut t = t.unwrap();
|
let mut t = t.unwrap();
|
||||||
|
|
||||||
match t {
|
match t {
|
||||||
PreToken::PreGroupStart(ref mut l)
|
PreToken::PreGroupStart(ref mut l)
|
||||||
| PreToken::PreGroupEnd(ref mut l)
|
| PreToken::PreGroupEnd(ref mut l)
|
||||||
| PreToken::PreOperator(ref mut l, _)
|
| PreToken::PreOperator(ref mut l, _)
|
||||||
| PreToken::PreNumber(ref mut l, _)
|
| PreToken::PreNumber(ref mut l, _)
|
||||||
|
@ -62,7 +62,7 @@ fn push_token(g: &mut VecDeque<PreToken>, t: Option<PreToken>, stop_i: usize) {
|
||||||
/// Turns a string into Tokens. First stage of parsing.
|
/// Turns a string into Tokens. First stage of parsing.
|
||||||
pub(in crate::parser) fn tokenize(input: &String) -> VecDeque<PreToken> {
|
pub(in crate::parser) fn tokenize(input: &String) -> VecDeque<PreToken> {
|
||||||
let mut t: Option<PreToken> = None; // The current token we're reading
|
let mut t: Option<PreToken> = None; // The current token we're reading
|
||||||
let mut g: VecDeque<PreToken> = VecDeque::with_capacity(32);
|
let mut g: VecDeque<PreToken> = VecDeque::with_capacity(32);
|
||||||
|
|
||||||
|
|
||||||
for (i, c) in input.chars().enumerate() {
|
for (i, c) in input.chars().enumerate() {
|
||||||
|
@ -145,7 +145,7 @@ pub(in crate::parser) fn tokenize(input: &String) -> VecDeque<PreToken> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
// Group
|
// Group
|
||||||
'(' => {
|
'(' => {
|
||||||
push_token(&mut g, t, i);
|
push_token(&mut g, t, i);
|
||||||
|
|
Loading…
Reference in New Issue