aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_parser/src/grammar/params.rs7
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0123_param_list_vararg.rs1
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0123_param_list_vararg.txt49
3 files changed, 56 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}
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0123_param_list_vararg.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0123_param_list_vararg.rs
new file mode 100644
index 000000000..c59addaf4
--- /dev/null
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0123_param_list_vararg.rs
@@ -0,0 +1 @@
extern "C" { fn printf(format: *const i8, ...) -> i32; }
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0123_param_list_vararg.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0123_param_list_vararg.txt
new file mode 100644
index 000000000..8bb9949ab
--- /dev/null
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0123_param_list_vararg.txt
@@ -0,0 +1,49 @@
1SOURCE_FILE@[0; 57)
2 EXTERN_BLOCK@[0; 56)
3 ABI@[0; 10)
4 EXTERN_KW@[0; 6)
5 WHITESPACE@[6; 7)
6 STRING@[7; 10)
7 WHITESPACE@[10; 11)
8 EXTERN_ITEM_LIST@[11; 56)
9 L_CURLY@[11; 12)
10 WHITESPACE@[12; 13)
11 FN_DEF@[13; 54)
12 FN_KW@[13; 15)
13 WHITESPACE@[15; 16)
14 NAME@[16; 22)
15 IDENT@[16; 22) "printf"
16 PARAM_LIST@[22; 46)
17 L_PAREN@[22; 23)
18 PARAM@[23; 40)
19 BIND_PAT@[23; 29)
20 NAME@[23; 29)
21 IDENT@[23; 29) "format"
22 COLON@[29; 30)
23 WHITESPACE@[30; 31)
24 POINTER_TYPE@[31; 40)
25 STAR@[31; 32)
26 CONST_KW@[32; 37)
27 WHITESPACE@[37; 38)
28 PATH_TYPE@[38; 40)
29 PATH@[38; 40)
30 PATH_SEGMENT@[38; 40)
31 NAME_REF@[38; 40)
32 IDENT@[38; 40) "i8"
33 COMMA@[40; 41)
34 WHITESPACE@[41; 42)
35 DOTDOTDOT@[42; 45)
36 R_PAREN@[45; 46)
37 WHITESPACE@[46; 47)
38 RET_TYPE@[47; 53)
39 THIN_ARROW@[47; 49)
40 WHITESPACE@[49; 50)
41 PATH_TYPE@[50; 53)
42 PATH@[50; 53)
43 PATH_SEGMENT@[50; 53)
44 NAME_REF@[50; 53)
45 IDENT@[50; 53) "i32"
46 SEMI@[53; 54)
47 WHITESPACE@[54; 55)
48 R_CURLY@[55; 56)
49 WHITESPACE@[56; 57)