diff options
author | Joshua Nelson <[email protected]> | 2020-01-12 15:19:17 +0000 |
---|---|---|
committer | Joshua Nelson <[email protected]> | 2020-01-12 15:25:41 +0000 |
commit | c3ac2c93fb446329b09882ef452fd6820290bfc5 (patch) | |
tree | 44734cc34641cfab04cb1c71611ee0a299a90c96 /crates/ra_parser/src/grammar | |
parent | f7a7092d691aea5c254412d9fd4b3f76a355f11f (diff) |
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
Diffstat (limited to 'crates/ra_parser/src/grammar')
-rw-r--r-- | crates/ra_parser/src/grammar/expressions.rs | 11 |
1 files changed, 11 insertions, 0 deletions
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 { | |||
535 | m.complete(p, CAST_EXPR) | 535 | m.complete(p, CAST_EXPR) |
536 | } | 536 | } |
537 | 537 | ||
538 | // test arg_list | ||
539 | // fn assert_float(s: &str, n: f64) {} | ||
540 | // fn foo() { | ||
541 | // assert_float( | ||
542 | // "1.797693134862315708e+308L", | ||
543 | // #[allow(clippy::excessive_precision)] | ||
544 | // #[allow(dead_code)] | ||
545 | // 1.797_693_134_862_315_730_8e+308, | ||
546 | // ); | ||
547 | // } | ||
538 | fn arg_list(p: &mut Parser) { | 548 | fn arg_list(p: &mut Parser) { |
539 | assert!(p.at(T!['('])); | 549 | assert!(p.at(T!['('])); |
540 | let m = p.start(); | 550 | let m = p.start(); |
541 | p.bump(T!['(']); | 551 | p.bump(T!['(']); |
542 | while !p.at(T![')']) && !p.at(EOF) { | 552 | while !p.at(T![')']) && !p.at(EOF) { |
553 | attributes::outer_attributes(p); | ||
543 | if !p.at_ts(EXPR_FIRST) { | 554 | if !p.at_ts(EXPR_FIRST) { |
544 | p.error("expected expression"); | 555 | p.error("expected expression"); |
545 | break; | 556 | break; |