Fix bug with / parsing
This commit is contained in:
parent
ce71254b69
commit
4d5ab95946
@ -563,6 +563,7 @@ impl Parser {
|
|||||||
Operator(op) => op,
|
Operator(op) => op,
|
||||||
Period => Rc::new(".".to_string()),
|
Period => Rc::new(".".to_string()),
|
||||||
Pipe => Rc::new("|".to_string()),
|
Pipe => Rc::new("|".to_string()),
|
||||||
|
Slash => Rc::new("/".to_string()),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
let rhs = self.precedence_expr(new_precedence)?;
|
let rhs = self.precedence_expr(new_precedence)?;
|
||||||
@ -975,6 +976,7 @@ mod parse_tests {
|
|||||||
[exprstatement!(binexp!("*", binexp!("+", IntLiteral(1), IntLiteral(2)), IntLiteral(3)))]));
|
[exprstatement!(binexp!("*", binexp!("+", IntLiteral(1), IntLiteral(2)), IntLiteral(3)))]));
|
||||||
|
|
||||||
parse_test!(".1 + .2", AST(vec![exprstatement!(binexp!("+", FloatLiteral(0.1), FloatLiteral(0.2)))]));
|
parse_test!(".1 + .2", AST(vec![exprstatement!(binexp!("+", FloatLiteral(0.1), FloatLiteral(0.2)))]));
|
||||||
|
parse_test!("1 / 2", AST(vec![exprstatement!(binexp!("/", IntLiteral(1), IntLiteral(2)))]));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
Reference in New Issue
Block a user