Fixed unary operators

pull/2/head
Mark 2023-03-27 10:55:14 -07:00
parent d2f03976f8
commit 4eb476c2b7
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
1 changed files with 3 additions and 12 deletions

View File

@ -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(),