diff --git a/src/parser/stage/groupify.rs b/src/parser/stage/groupify.rs index 966bf3a..99ea6ee 100644 --- a/src/parser/stage/groupify.rs +++ b/src/parser/stage/groupify.rs @@ -175,10 +175,7 @@ fn lookback( // The following are syntax errors (Token::Quantity(la,_), Token::Quantity(lb,_)) => { - return Err(( - LineLocation{pos: la.pos, len: lb.pos - la.pos + lb.len}, - ParserError::Syntax - )); + return Err((*la + *lb, ParserError::Syntax)); }, _ => {g.insert(i-1, b); g.insert(i-1, a);} } diff --git a/src/parser/stage/treeify.rs b/src/parser/stage/treeify.rs index 0bd1a50..37698a5 100644 --- a/src/parser/stage/treeify.rs +++ b/src/parser/stage/treeify.rs @@ -67,7 +67,7 @@ fn treeify_binary( return Ok(false); } else { 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); } else { 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, context: &Context ) -> Result { - let (l, g_inner): (LineLocation, &mut VecDeque) = match g { Token::Group(l, ref mut x) => (l, x), _ => panic!()