diff options
author | Aleksey Kladov <[email protected]> | 2020-03-13 11:09:14 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-03-13 12:54:14 +0000 |
commit | bee5cdb359c283c4201b0357c320f9d610d79786 (patch) | |
tree | 5c6bdb8bd7a3a8db3fd2869bd42e35eaa9d22ddd /crates/ra_syntax/test_data | |
parent | 93527b5f193ed214f6ae0f8112eaec2eebabd016 (diff) |
Parse variadics correctly
closes #3571
Diffstat (limited to 'crates/ra_syntax/test_data')
5 files changed, 144 insertions, 3 deletions
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.txt b/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.txt index a0a8aea76..4c17f0db8 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.txt | |||
@@ -81,7 +81,8 @@ SOURCE_FILE@[0; 113) | |||
81 | WHITESPACE@[97; 98) " " | 81 | WHITESPACE@[97; 98) " " |
82 | COMMA@[98; 99) "," | 82 | COMMA@[98; 99) "," |
83 | WHITESPACE@[99; 100) " " | 83 | WHITESPACE@[99; 100) " " |
84 | DOTDOTDOT@[100; 103) "..." | 84 | PARAM@[100; 103) |
85 | DOTDOTDOT@[100; 103) "..." | ||
85 | WHITESPACE@[103; 104) " " | 86 | WHITESPACE@[103; 104) " " |
86 | R_PAREN@[104; 105) ")" | 87 | R_PAREN@[104; 105) ")" |
87 | WHITESPACE@[105; 106) " " | 88 | WHITESPACE@[105; 106) " " |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.txt b/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.txt index 836e8e55b..6c3b17868 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.txt | |||
@@ -32,7 +32,8 @@ SOURCE_FILE@[0; 57) | |||
32 | IDENT@[38; 40) "i8" | 32 | IDENT@[38; 40) "i8" |
33 | COMMA@[40; 41) "," | 33 | COMMA@[40; 41) "," |
34 | WHITESPACE@[41; 42) " " | 34 | WHITESPACE@[41; 42) " " |
35 | DOTDOTDOT@[42; 45) "..." | 35 | PARAM@[42; 45) |
36 | DOTDOTDOT@[42; 45) "..." | ||
36 | R_PAREN@[45; 46) ")" | 37 | R_PAREN@[45; 46) ")" |
37 | WHITESPACE@[46; 47) " " | 38 | WHITESPACE@[46; 47) " " |
38 | RET_TYPE@[47; 53) | 39 | RET_TYPE@[47; 53) |
diff --git a/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.txt b/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.txt index 719c99c17..254eafc36 100644 --- a/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.txt +++ b/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.txt | |||
@@ -118,7 +118,8 @@ SOURCE_FILE@[0; 519) | |||
118 | IDENT@[108; 112) "attr" | 118 | IDENT@[108; 112) "attr" |
119 | R_BRACK@[112; 113) "]" | 119 | R_BRACK@[112; 113) "]" |
120 | WHITESPACE@[113; 114) " " | 120 | WHITESPACE@[113; 114) " " |
121 | DOTDOTDOT@[114; 117) "..." | 121 | PARAM@[114; 117) |
122 | DOTDOTDOT@[114; 117) "..." | ||
122 | R_PAREN@[117; 118) ")" | 123 | R_PAREN@[117; 118) ")" |
123 | WHITESPACE@[118; 119) " " | 124 | WHITESPACE@[118; 119) " " |
124 | RET_TYPE@[119; 125) | 125 | RET_TYPE@[119; 125) |
diff --git a/crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.rs b/crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.rs new file mode 100644 index 000000000..a16afbaf3 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.rs | |||
@@ -0,0 +1,5 @@ | |||
1 | extern "C" { | ||
2 | fn a(_: *mut u8, ...,); | ||
3 | fn b(_: *mut u8, _: ...); | ||
4 | fn c(_: *mut u8, #[cfg(never)] [w, t, f]: ...,); | ||
5 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.txt b/crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.txt new file mode 100644 index 000000000..186f03626 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.txt | |||
@@ -0,0 +1,133 @@ | |||
1 | SOURCE_FILE@[0; 126) | ||
2 | EXTERN_BLOCK@[0; 125) | ||
3 | ABI@[0; 10) | ||
4 | EXTERN_KW@[0; 6) "extern" | ||
5 | WHITESPACE@[6; 7) " " | ||
6 | STRING@[7; 10) "\"C\"" | ||
7 | WHITESPACE@[10; 11) " " | ||
8 | EXTERN_ITEM_LIST@[11; 125) | ||
9 | L_CURLY@[11; 12) "{" | ||
10 | WHITESPACE@[12; 17) "\n " | ||
11 | FN_DEF@[17; 40) | ||
12 | FN_KW@[17; 19) "fn" | ||
13 | WHITESPACE@[19; 20) " " | ||
14 | NAME@[20; 21) | ||
15 | IDENT@[20; 21) "a" | ||
16 | PARAM_LIST@[21; 39) | ||
17 | L_PAREN@[21; 22) "(" | ||
18 | PARAM@[22; 32) | ||
19 | PLACEHOLDER_PAT@[22; 23) | ||
20 | UNDERSCORE@[22; 23) "_" | ||
21 | COLON@[23; 24) ":" | ||
22 | WHITESPACE@[24; 25) " " | ||
23 | POINTER_TYPE@[25; 32) | ||
24 | STAR@[25; 26) "*" | ||
25 | MUT_KW@[26; 29) "mut" | ||
26 | WHITESPACE@[29; 30) " " | ||
27 | PATH_TYPE@[30; 32) | ||
28 | PATH@[30; 32) | ||
29 | PATH_SEGMENT@[30; 32) | ||
30 | NAME_REF@[30; 32) | ||
31 | IDENT@[30; 32) "u8" | ||
32 | COMMA@[32; 33) "," | ||
33 | WHITESPACE@[33; 34) " " | ||
34 | PARAM@[34; 37) | ||
35 | DOTDOTDOT@[34; 37) "..." | ||
36 | COMMA@[37; 38) "," | ||
37 | R_PAREN@[38; 39) ")" | ||
38 | SEMI@[39; 40) ";" | ||
39 | WHITESPACE@[40; 45) "\n " | ||
40 | FN_DEF@[45; 70) | ||
41 | FN_KW@[45; 47) "fn" | ||
42 | WHITESPACE@[47; 48) " " | ||
43 | NAME@[48; 49) | ||
44 | IDENT@[48; 49) "b" | ||
45 | PARAM_LIST@[49; 69) | ||
46 | L_PAREN@[49; 50) "(" | ||
47 | PARAM@[50; 60) | ||
48 | PLACEHOLDER_PAT@[50; 51) | ||
49 | UNDERSCORE@[50; 51) "_" | ||
50 | COLON@[51; 52) ":" | ||
51 | WHITESPACE@[52; 53) " " | ||
52 | POINTER_TYPE@[53; 60) | ||
53 | STAR@[53; 54) "*" | ||
54 | MUT_KW@[54; 57) "mut" | ||
55 | WHITESPACE@[57; 58) " " | ||
56 | PATH_TYPE@[58; 60) | ||
57 | PATH@[58; 60) | ||
58 | PATH_SEGMENT@[58; 60) | ||
59 | NAME_REF@[58; 60) | ||
60 | IDENT@[58; 60) "u8" | ||
61 | COMMA@[60; 61) "," | ||
62 | WHITESPACE@[61; 62) " " | ||
63 | PARAM@[62; 68) | ||
64 | PLACEHOLDER_PAT@[62; 63) | ||
65 | UNDERSCORE@[62; 63) "_" | ||
66 | COLON@[63; 64) ":" | ||
67 | WHITESPACE@[64; 65) " " | ||
68 | DOTDOTDOT@[65; 68) "..." | ||
69 | R_PAREN@[68; 69) ")" | ||
70 | SEMI@[69; 70) ";" | ||
71 | WHITESPACE@[70; 75) "\n " | ||
72 | FN_DEF@[75; 123) | ||
73 | FN_KW@[75; 77) "fn" | ||
74 | WHITESPACE@[77; 78) " " | ||
75 | NAME@[78; 79) | ||
76 | IDENT@[78; 79) "c" | ||
77 | PARAM_LIST@[79; 122) | ||
78 | L_PAREN@[79; 80) "(" | ||
79 | PARAM@[80; 90) | ||
80 | PLACEHOLDER_PAT@[80; 81) | ||
81 | UNDERSCORE@[80; 81) "_" | ||
82 | COLON@[81; 82) ":" | ||
83 | WHITESPACE@[82; 83) " " | ||
84 | POINTER_TYPE@[83; 90) | ||
85 | STAR@[83; 84) "*" | ||
86 | MUT_KW@[84; 87) "mut" | ||
87 | WHITESPACE@[87; 88) " " | ||
88 | PATH_TYPE@[88; 90) | ||
89 | PATH@[88; 90) | ||
90 | PATH_SEGMENT@[88; 90) | ||
91 | NAME_REF@[88; 90) | ||
92 | IDENT@[88; 90) "u8" | ||
93 | COMMA@[90; 91) "," | ||
94 | WHITESPACE@[91; 92) " " | ||
95 | ATTR@[92; 105) | ||
96 | POUND@[92; 93) "#" | ||
97 | L_BRACK@[93; 94) "[" | ||
98 | PATH@[94; 97) | ||
99 | PATH_SEGMENT@[94; 97) | ||
100 | NAME_REF@[94; 97) | ||
101 | IDENT@[94; 97) "cfg" | ||
102 | TOKEN_TREE@[97; 104) | ||
103 | L_PAREN@[97; 98) "(" | ||
104 | IDENT@[98; 103) "never" | ||
105 | R_PAREN@[103; 104) ")" | ||
106 | R_BRACK@[104; 105) "]" | ||
107 | WHITESPACE@[105; 106) " " | ||
108 | PARAM@[106; 120) | ||
109 | SLICE_PAT@[106; 115) | ||
110 | L_BRACK@[106; 107) "[" | ||
111 | BIND_PAT@[107; 108) | ||
112 | NAME@[107; 108) | ||
113 | IDENT@[107; 108) "w" | ||
114 | COMMA@[108; 109) "," | ||
115 | WHITESPACE@[109; 110) " " | ||
116 | BIND_PAT@[110; 111) | ||
117 | NAME@[110; 111) | ||
118 | IDENT@[110; 111) "t" | ||
119 | COMMA@[111; 112) "," | ||
120 | WHITESPACE@[112; 113) " " | ||
121 | BIND_PAT@[113; 114) | ||
122 | NAME@[113; 114) | ||
123 | IDENT@[113; 114) "f" | ||
124 | R_BRACK@[114; 115) "]" | ||
125 | COLON@[115; 116) ":" | ||
126 | WHITESPACE@[116; 117) " " | ||
127 | DOTDOTDOT@[117; 120) "..." | ||
128 | COMMA@[120; 121) "," | ||
129 | R_PAREN@[121; 122) ")" | ||
130 | SEMI@[122; 123) ";" | ||
131 | WHITESPACE@[123; 124) "\n" | ||
132 | R_CURLY@[124; 125) "}" | ||
133 | WHITESPACE@[125; 126) "\n" | ||