From c3ac2c93fb446329b09882ef452fd6820290bfc5 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sun, 12 Jan 2020 10:19:17 -0500 Subject: Allow attributes before function arguments This adds support for function calls of the form: ```rust ( #[attr(...)] 1.2, #[attr_one(...)] #[attr_two(...)] 1.5, ... etc ... ) ``` Closes https://github.com/rust-analyzer/rust-analyzer/issues/2801 --- crates/ra_parser/src/grammar/expressions.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'crates/ra_parser/src/grammar') diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs index 81d4f75f9..7caed66a0 100644 --- a/crates/ra_parser/src/grammar/expressions.rs +++ b/crates/ra_parser/src/grammar/expressions.rs @@ -535,11 +535,22 @@ fn cast_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { m.complete(p, CAST_EXPR) } +// test arg_list +// fn assert_float(s: &str, n: f64) {} +// fn foo() { +// assert_float( +// "1.797693134862315708e+308L", +// #[allow(clippy::excessive_precision)] +// #[allow(dead_code)] +// 1.797_693_134_862_315_730_8e+308, +// ); +// } fn arg_list(p: &mut Parser) { assert!(p.at(T!['('])); let m = p.start(); p.bump(T!['(']); while !p.at(T![')']) && !p.at(EOF) { + attributes::outer_attributes(p); if !p.at_ts(EXPR_FIRST) { p.error("expected expression"); break; -- cgit v1.2.3