Add dot binary op expression parsing
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user