mirror of https://github.com/rm-dr/daisy
Minor cleanup
parent
6e46f6c42a
commit
fa94d9ca35
|
@ -175,10 +175,7 @@ fn lookback(
|
||||||
// The following are syntax errors
|
// The following are syntax errors
|
||||||
(Token::Quantity(la,_), Token::Quantity(lb,_))
|
(Token::Quantity(la,_), Token::Quantity(lb,_))
|
||||||
=> {
|
=> {
|
||||||
return Err((
|
return Err((*la + *lb, ParserError::Syntax));
|
||||||
LineLocation{pos: la.pos, len: lb.pos - la.pos + lb.len},
|
|
||||||
ParserError::Syntax
|
|
||||||
));
|
|
||||||
},
|
},
|
||||||
_ => {g.insert(i-1, b); g.insert(i-1, a);}
|
_ => {g.insert(i-1, b); g.insert(i-1, a);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ fn treeify_binary(
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
} else {
|
} else {
|
||||||
let tl = *this.get_line_location() + *l;
|
let tl = *this.get_line_location() + *l;
|
||||||
return Err((tl, ParserError::Syntax)); // left operator isn't valid
|
return Err((tl, ParserError::Syntax)); // left argument isn't valid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ fn treeify_binary(
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
} else {
|
} else {
|
||||||
let tl = *this.get_line_location() + *l;
|
let tl = *this.get_line_location() + *l;
|
||||||
return Err((tl, ParserError::Syntax)); // right operator isn't valid (two operators next to each other)
|
return Err((tl, ParserError::Syntax)); // right argument isn't valid (two operators next to each other)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,7 +286,6 @@ pub fn treeify(
|
||||||
mut g: Token,
|
mut g: Token,
|
||||||
context: &Context
|
context: &Context
|
||||||
) -> Result<Expression, (LineLocation, ParserError)> {
|
) -> Result<Expression, (LineLocation, ParserError)> {
|
||||||
|
|
||||||
let (l, g_inner): (LineLocation, &mut VecDeque<Token>) = match g {
|
let (l, g_inner): (LineLocation, &mut VecDeque<Token>) = match g {
|
||||||
Token::Group(l, ref mut x) => (l, x),
|
Token::Group(l, ref mut x) => (l, x),
|
||||||
_ => panic!()
|
_ => panic!()
|
||||||
|
|
Loading…
Reference in New Issue