mirror of https://github.com/rm-dr/daisy
Fixed unary operators
parent
d2f03976f8
commit
4eb476c2b7
|
@ -1,7 +1,6 @@
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
|
|
||||||
use crate::tokens::Token;
|
use crate::tokens::Token;
|
||||||
use crate::tokens::Operator;
|
|
||||||
use crate::tokens::LineLocation;
|
use crate::tokens::LineLocation;
|
||||||
|
|
||||||
use crate::parser::ParserError;
|
use crate::parser::ParserError;
|
||||||
|
@ -165,17 +164,9 @@ fn treeify_unary(
|
||||||
|
|
||||||
if prev.is_some() {
|
if prev.is_some() {
|
||||||
if let Token::PreOperator(l, o) = prev.unwrap() {
|
if let Token::PreOperator(l, o) = prev.unwrap() {
|
||||||
match o {
|
if o.is_left_associative() && left_associative {
|
||||||
// Left unary operators
|
return Err((*l, ParserError::Syntax));
|
||||||
Operator::Negative => {
|
}
|
||||||
let tl = *this.get_line_location();
|
|
||||||
return Err((
|
|
||||||
LineLocation{pos: tl.pos, len: l.pos - tl.pos + l.len},
|
|
||||||
ParserError::Syntax
|
|
||||||
));
|
|
||||||
},
|
|
||||||
_ => {},
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
return Err((
|
return Err((
|
||||||
*this.get_line_location(),
|
*this.get_line_location(),
|
||||||
|
|
Loading…
Reference in New Issue