diff options
author | Aleksey Kladov <[email protected]> | 2019-03-04 11:34:59 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-03-04 11:34:59 +0000 |
commit | a99b1db49f9040f2aec9e72b2c68ec8153210b49 (patch) | |
tree | e3e600d9bd603f65f12cb7aa01f2d0d189f3d52b /crates/ra_parser/src/grammar | |
parent | 5197e1664856fa4fef5a4c4dd43b6915e9fa847d (diff) |
allow vararg functions
Diffstat (limited to 'crates/ra_parser/src/grammar')
-rw-r--r-- | crates/ra_parser/src/grammar/params.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/ra_parser/src/grammar/params.rs b/crates/ra_parser/src/grammar/params.rs index 185386569..a70f067f9 100644 --- a/crates/ra_parser/src/grammar/params.rs +++ b/crates/ra_parser/src/grammar/params.rs | |||
@@ -43,7 +43,7 @@ fn list_(p: &mut Parser, flavor: Flavor) { | |||
43 | if flavor.type_required() { | 43 | if flavor.type_required() { |
44 | opt_self_param(p); | 44 | opt_self_param(p); |
45 | } | 45 | } |
46 | while !p.at(EOF) && !p.at(ket) { | 46 | while !p.at(EOF) && !p.at(ket) && !(flavor == Flavor::Normal && p.at(DOTDOTDOT)) { |
47 | if !p.at_ts(VALUE_PARAMETER_FIRST) { | 47 | if !p.at_ts(VALUE_PARAMETER_FIRST) { |
48 | p.error("expected value parameter"); | 48 | p.error("expected value parameter"); |
49 | break; | 49 | break; |
@@ -53,6 +53,11 @@ fn list_(p: &mut Parser, flavor: Flavor) { | |||
53 | p.expect(COMMA); | 53 | p.expect(COMMA); |
54 | } | 54 | } |
55 | } | 55 | } |
56 | // test param_list_vararg | ||
57 | // extern "C" { fn printf(format: *const i8, ...) -> i32; } | ||
58 | if flavor == Flavor::Normal { | ||
59 | p.eat(DOTDOTDOT); | ||
60 | } | ||
56 | p.expect(ket); | 61 | p.expect(ket); |
57 | m.complete(p, PARAM_LIST); | 62 | m.complete(p, PARAM_LIST); |
58 | } | 63 | } |