diff options
Diffstat (limited to 'src/parser.rs')
-rw-r--r-- | src/parser.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/parser.rs b/src/parser.rs index 2e252b1..8416d9b 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -13,15 +13,15 @@ pub fn parse_expr(s: &str) -> Result<BoxExpr, ParseError> { #[test] fn test_parse() { use crate::core::Expr::*; - println!("test {:?}", parse_expr("+3 + +5 * +10")); + println!("test {:?}", parse_expr("3 + 5 * 10")); assert!(parse_expr("22").is_ok()); assert!(parse_expr("(22)").is_ok()); - assert_eq!(parse_expr("+3 + +5 * +10").ok(), + assert_eq!(parse_expr("3 + 5 * 10").ok(), Some(Box::new(NaturalPlus(Box::new(NaturalLit(3)), Box::new(NaturalTimes(Box::new(NaturalLit(5)), Box::new(NaturalLit(10)))))))); // The original parser is apparently right-associative - assert_eq!(parse_expr("+2 * +3 * +4").ok(), + assert_eq!(parse_expr("2 * 3 * 4").ok(), Some(Box::new(NaturalTimes(Box::new(NaturalLit(2)), Box::new(NaturalTimes(Box::new(NaturalLit(3)), Box::new(NaturalLit(4)))))))); |