mirror of https://github.com/rm-dr/daisy
Fixed a minor bug
parent
99f4919fea
commit
b072ff3691
|
@ -23,7 +23,10 @@ fn lookback_signs(
|
|||
=> {
|
||||
if o == "-" {
|
||||
g.insert(i, Token::Operator(*l, String::from("neg")));
|
||||
} else if o == "+" {
|
||||
} else if o == "+" && g.len() != 0 {
|
||||
// Don't remove "+" if it's the only token,
|
||||
// this is a syntax error that is caught later.e
|
||||
|
||||
continue; // We should not increment i if we remove a token
|
||||
} else {g.insert(i, a);}
|
||||
},
|
||||
|
|
|
@ -288,11 +288,16 @@ pub fn treeify(
|
|||
context: &Context
|
||||
) -> Result<Expression, (LineLocation, ParserError)> {
|
||||
|
||||
let g_inner: &mut VecDeque<Token> = match g {
|
||||
Token::Group(_, ref mut x) => x,
|
||||
let (l, g_inner): (LineLocation, &mut VecDeque<Token>) = match g {
|
||||
Token::Group(l, ref mut x) => (l, x),
|
||||
_ => panic!()
|
||||
};
|
||||
|
||||
if g_inner.len() == 0 {
|
||||
// This shouldn't ever happen.
|
||||
return Err((l, ParserError::EmptyGroup));
|
||||
}
|
||||
|
||||
let mut left_associative = true;
|
||||
let mut j: i64 = 0;
|
||||
while g_inner.len() > 1 {
|
||||
|
|
Loading…
Reference in New Issue