diff --git a/src/syn/parser.rs b/src/syn/parser.rs index 82d25ec..2a56a06 100644 --- a/src/syn/parser.rs +++ b/src/syn/parser.rs @@ -171,6 +171,12 @@ impl<'t> Parser<'t> { bin_expr!( next_bin_mul_expr, &[TokenKind::FSlash, TokenKind::Splat], + next_dot_expr + ); + // . + bin_expr!( + next_dot_expr, + &[TokenKind::Dot], next_un_expr ); @@ -845,6 +851,20 @@ mod test { ) ) ); + + test_parser!( + Parser::try_from("foo.bar().baz(qux)").unwrap(), + next_expr, + bin_expr( + base_expr(BaseExprKind::Ident), + BinOp::Dot, + bin_expr( + fun_call_expr(base_expr(BaseExprKind::Ident), vec![]), + BinOp::Dot, + fun_call_expr(base_expr(BaseExprKind::Ident), vec![base_expr(BaseExprKind::Ident)]), + ) + ) + ); } #[test]