diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-02-17 22:07:16 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-02-17 22:07:16 +0000 |
commit | 9500ad521121f501aea02f549223eb583cb298ee (patch) | |
tree | a383a2e71da6029bbd6a5669b5f9d2b99a1b0a92 | |
parent | 8c4c5b5b802a204bfeef52e215358ae838900f1f (diff) | |
parent | c6f4a06b4297f498da4bc2cd747aa38effb855b0 (diff) |
Merge #54
54: G: value_parameters, patterns & let statement r=matklad a=matklad
bors r+
31 files changed, 541 insertions, 107 deletions
diff --git a/grammar.ron b/grammar.ron index fbb3c384a..d5d2e6162 100644 --- a/grammar.ron +++ b/grammar.ron | |||
@@ -27,6 +27,8 @@ Grammar( | |||
27 | "mut", | 27 | "mut", |
28 | "unsafe", | 28 | "unsafe", |
29 | "type", | 29 | "type", |
30 | "ref", | ||
31 | "let", | ||
30 | ], | 32 | ], |
31 | contextual_keywords: [ | 33 | contextual_keywords: [ |
32 | "auto", | 34 | "auto", |
@@ -113,6 +115,12 @@ Grammar( | |||
113 | "FN_POINTER_TYPE", | 115 | "FN_POINTER_TYPE", |
114 | "FOR_TYPE", | 116 | "FOR_TYPE", |
115 | 117 | ||
118 | "REF_PAT", | ||
119 | "BIND_PAT", | ||
120 | "PLACEHOLDER_PAT", | ||
121 | |||
122 | "TUPLE_EXPR", | ||
123 | |||
116 | "EXTERN_BLOCK", | 124 | "EXTERN_BLOCK", |
117 | "ENUM_VARIANT", | 125 | "ENUM_VARIANT", |
118 | "NAMED_FIELD", | 126 | "NAMED_FIELD", |
@@ -132,5 +140,8 @@ Grammar( | |||
132 | "ABI", | 140 | "ABI", |
133 | "NAME", | 141 | "NAME", |
134 | "NAME_REF", | 142 | "NAME_REF", |
143 | "VALUE_PARAMETER", | ||
144 | "BLOCK", | ||
145 | "LET_STMT", | ||
135 | ] | 146 | ] |
136 | ) | 147 | ) |
diff --git a/src/parser/grammar/expressions.rs b/src/parser/grammar/expressions.rs index 3704cb16f..2145b8d8b 100644 --- a/src/parser/grammar/expressions.rs +++ b/src/parser/grammar/expressions.rs | |||
@@ -14,7 +14,20 @@ pub(super) fn literal(p: &mut Parser) -> bool { | |||
14 | } | 14 | } |
15 | 15 | ||
16 | pub(super) fn expr(p: &mut Parser) { | 16 | pub(super) fn expr(p: &mut Parser) { |
17 | if !literal(p) { | 17 | if literal(p) { |
18 | p.error("expected expression"); | 18 | return; |
19 | } | 19 | } |
20 | |||
21 | match p.current() { | ||
22 | L_PAREN => tuple_expr(p), | ||
23 | _ => p.error("expected expression"), | ||
24 | } | ||
25 | } | ||
26 | |||
27 | fn tuple_expr(p: &mut Parser) { | ||
28 | assert!(p.at(L_PAREN)); | ||
29 | let m = p.start(); | ||
30 | p.expect(L_PAREN); | ||
31 | p.expect(R_PAREN); | ||
32 | m.complete(p, TUPLE_EXPR); | ||
20 | } | 33 | } |
diff --git a/src/parser/grammar/items/mod.rs b/src/parser/grammar/items/mod.rs index 3af6d13a1..1fe646652 100644 --- a/src/parser/grammar/items/mod.rs +++ b/src/parser/grammar/items/mod.rs | |||
@@ -218,9 +218,33 @@ fn fn_item(p: &mut Parser) { | |||
218 | p.error("expected function arguments"); | 218 | p.error("expected function arguments"); |
219 | } | 219 | } |
220 | 220 | ||
221 | if p.at(L_CURLY) { | 221 | block(p); |
222 | p.expect(L_CURLY); | 222 | |
223 | fn block(p: &mut Parser) { | ||
224 | if !p.at(L_CURLY) { | ||
225 | p.error("expected block"); | ||
226 | } | ||
227 | let m = p.start(); | ||
228 | p.bump(); | ||
229 | while !p.at(EOF) && !p.at(R_CURLY) { | ||
230 | match p.current() { | ||
231 | LET_KW => let_stmt(p), | ||
232 | _ => p.err_and_bump("expected statement"), | ||
233 | } | ||
234 | } | ||
223 | p.expect(R_CURLY); | 235 | p.expect(R_CURLY); |
236 | m.complete(p, BLOCK); | ||
237 | } | ||
238 | |||
239 | fn let_stmt(p: &mut Parser) { | ||
240 | assert!(p.at(LET_KW)); | ||
241 | let m = p.start(); | ||
242 | p.bump(); | ||
243 | patterns::pattern(p); | ||
244 | p.expect(EQ); | ||
245 | expressions::expr(p); | ||
246 | p.expect(SEMI); | ||
247 | m.complete(p, LET_STMT); | ||
224 | } | 248 | } |
225 | } | 249 | } |
226 | 250 | ||
diff --git a/src/parser/grammar/mod.rs b/src/parser/grammar/mod.rs index ee0263203..54a63a547 100644 --- a/src/parser/grammar/mod.rs +++ b/src/parser/grammar/mod.rs | |||
@@ -30,6 +30,7 @@ mod items; | |||
30 | mod attributes; | 30 | mod attributes; |
31 | mod expressions; | 31 | mod expressions; |
32 | mod types; | 32 | mod types; |
33 | mod patterns; | ||
33 | mod paths; | 34 | mod paths; |
34 | mod type_params; | 35 | mod type_params; |
35 | 36 | ||
@@ -85,10 +86,29 @@ fn abi(p: &mut Parser) { | |||
85 | abi.complete(p, ABI); | 86 | abi.complete(p, ABI); |
86 | } | 87 | } |
87 | 88 | ||
89 | // test fn_value_parameters | ||
90 | // fn a() {} | ||
91 | // fn b(x: i32) {} | ||
92 | // fn c(x: i32, ) {} | ||
93 | // fn d(x: i32, y: ()) {} | ||
88 | fn fn_value_parameters(p: &mut Parser) { | 94 | fn fn_value_parameters(p: &mut Parser) { |
89 | assert!(p.at(L_PAREN)); | 95 | assert!(p.at(L_PAREN)); |
90 | p.bump(); | 96 | p.bump(); |
97 | while !p.at(EOF) && !p.at(R_PAREN) { | ||
98 | value_parameter(p); | ||
99 | if !p.at(R_PAREN) { | ||
100 | p.expect(COMMA); | ||
101 | } | ||
102 | } | ||
91 | p.expect(R_PAREN); | 103 | p.expect(R_PAREN); |
104 | |||
105 | fn value_parameter(p: &mut Parser) { | ||
106 | let m = p.start(); | ||
107 | patterns::pattern(p); | ||
108 | p.expect(COLON); | ||
109 | types::type_(p); | ||
110 | m.complete(p, VALUE_PARAMETER); | ||
111 | } | ||
92 | } | 112 | } |
93 | 113 | ||
94 | fn fn_ret_type(p: &mut Parser) { | 114 | fn fn_ret_type(p: &mut Parser) { |
diff --git a/src/parser/grammar/patterns.rs b/src/parser/grammar/patterns.rs new file mode 100644 index 000000000..6e4f2236b --- /dev/null +++ b/src/parser/grammar/patterns.rs | |||
@@ -0,0 +1,52 @@ | |||
1 | use super::*; | ||
2 | |||
3 | pub(super) fn pattern(p: &mut Parser) { | ||
4 | match p.current() { | ||
5 | UNDERSCORE => placeholder_pat(p), | ||
6 | AMPERSAND => ref_pat(p), | ||
7 | IDENT | REF_KW => bind_pat(p), | ||
8 | _ => p.err_and_bump("expected pattern"), | ||
9 | } | ||
10 | } | ||
11 | |||
12 | // test placeholder_pat | ||
13 | // fn main() { let _ = (); } | ||
14 | fn placeholder_pat(p: &mut Parser) { | ||
15 | assert!(p.at(UNDERSCORE)); | ||
16 | let m = p.start(); | ||
17 | p.bump(); | ||
18 | m.complete(p, PLACEHOLDER_PAT); | ||
19 | } | ||
20 | |||
21 | // test ref_pat | ||
22 | // fn main() { | ||
23 | // let &a = (); | ||
24 | // let &mut b = (); | ||
25 | // } | ||
26 | fn ref_pat(p: &mut Parser) { | ||
27 | assert!(p.at(AMPERSAND)); | ||
28 | let m = p.start(); | ||
29 | p.bump(); | ||
30 | p.eat(MUT_KW); | ||
31 | pattern(p); | ||
32 | m.complete(p, REF_PAT); | ||
33 | } | ||
34 | |||
35 | // test bind_pat | ||
36 | // fn main() { | ||
37 | // let a = (); | ||
38 | // let ref b = (); | ||
39 | // let ref mut c = (); | ||
40 | // let d @ _ = (); | ||
41 | // } | ||
42 | fn bind_pat(p: &mut Parser) { | ||
43 | let m = p.start(); | ||
44 | if p.eat(REF_KW) { | ||
45 | p.eat(MUT_KW); | ||
46 | } | ||
47 | name(p); | ||
48 | if p.eat(AT) { | ||
49 | pattern(p); | ||
50 | } | ||
51 | m.complete(p, BIND_PAT); | ||
52 | } | ||
diff --git a/src/syntax_kinds.rs b/src/syntax_kinds.rs index 537a80417..1cc29bb61 100644 --- a/src/syntax_kinds.rs +++ b/src/syntax_kinds.rs | |||
@@ -84,6 +84,8 @@ pub enum SyntaxKind { | |||
84 | MUT_KW, | 84 | MUT_KW, |
85 | UNSAFE_KW, | 85 | UNSAFE_KW, |
86 | TYPE_KW, | 86 | TYPE_KW, |
87 | REF_KW, | ||
88 | LET_KW, | ||
87 | AUTO_KW, | 89 | AUTO_KW, |
88 | DEFAULT_KW, | 90 | DEFAULT_KW, |
89 | UNION_KW, | 91 | UNION_KW, |
@@ -110,6 +112,10 @@ pub enum SyntaxKind { | |||
110 | PLACEHOLDER_TYPE, | 112 | PLACEHOLDER_TYPE, |
111 | FN_POINTER_TYPE, | 113 | FN_POINTER_TYPE, |
112 | FOR_TYPE, | 114 | FOR_TYPE, |
115 | REF_PAT, | ||
116 | BIND_PAT, | ||
117 | PLACEHOLDER_PAT, | ||
118 | TUPLE_EXPR, | ||
113 | EXTERN_BLOCK, | 119 | EXTERN_BLOCK, |
114 | ENUM_VARIANT, | 120 | ENUM_VARIANT, |
115 | NAMED_FIELD, | 121 | NAMED_FIELD, |
@@ -129,6 +135,9 @@ pub enum SyntaxKind { | |||
129 | ABI, | 135 | ABI, |
130 | NAME, | 136 | NAME, |
131 | NAME_REF, | 137 | NAME_REF, |
138 | VALUE_PARAMETER, | ||
139 | BLOCK, | ||
140 | LET_STMT, | ||
132 | 141 | ||
133 | // Technical SyntaxKinds: they appear temporally during parsing, | 142 | // Technical SyntaxKinds: they appear temporally during parsing, |
134 | // but never end up in the final tree | 143 | // but never end up in the final tree |
@@ -220,6 +229,8 @@ impl SyntaxKind { | |||
220 | MUT_KW => &SyntaxInfo { name: "MUT_KW" }, | 229 | MUT_KW => &SyntaxInfo { name: "MUT_KW" }, |
221 | UNSAFE_KW => &SyntaxInfo { name: "UNSAFE_KW" }, | 230 | UNSAFE_KW => &SyntaxInfo { name: "UNSAFE_KW" }, |
222 | TYPE_KW => &SyntaxInfo { name: "TYPE_KW" }, | 231 | TYPE_KW => &SyntaxInfo { name: "TYPE_KW" }, |
232 | REF_KW => &SyntaxInfo { name: "REF_KW" }, | ||
233 | LET_KW => &SyntaxInfo { name: "LET_KW" }, | ||
223 | AUTO_KW => &SyntaxInfo { name: "AUTO_KW" }, | 234 | AUTO_KW => &SyntaxInfo { name: "AUTO_KW" }, |
224 | DEFAULT_KW => &SyntaxInfo { name: "DEFAULT_KW" }, | 235 | DEFAULT_KW => &SyntaxInfo { name: "DEFAULT_KW" }, |
225 | UNION_KW => &SyntaxInfo { name: "UNION_KW" }, | 236 | UNION_KW => &SyntaxInfo { name: "UNION_KW" }, |
@@ -246,6 +257,10 @@ impl SyntaxKind { | |||
246 | PLACEHOLDER_TYPE => &SyntaxInfo { name: "PLACEHOLDER_TYPE" }, | 257 | PLACEHOLDER_TYPE => &SyntaxInfo { name: "PLACEHOLDER_TYPE" }, |
247 | FN_POINTER_TYPE => &SyntaxInfo { name: "FN_POINTER_TYPE" }, | 258 | FN_POINTER_TYPE => &SyntaxInfo { name: "FN_POINTER_TYPE" }, |
248 | FOR_TYPE => &SyntaxInfo { name: "FOR_TYPE" }, | 259 | FOR_TYPE => &SyntaxInfo { name: "FOR_TYPE" }, |
260 | REF_PAT => &SyntaxInfo { name: "REF_PAT" }, | ||
261 | BIND_PAT => &SyntaxInfo { name: "BIND_PAT" }, | ||
262 | PLACEHOLDER_PAT => &SyntaxInfo { name: "PLACEHOLDER_PAT" }, | ||
263 | TUPLE_EXPR => &SyntaxInfo { name: "TUPLE_EXPR" }, | ||
249 | EXTERN_BLOCK => &SyntaxInfo { name: "EXTERN_BLOCK" }, | 264 | EXTERN_BLOCK => &SyntaxInfo { name: "EXTERN_BLOCK" }, |
250 | ENUM_VARIANT => &SyntaxInfo { name: "ENUM_VARIANT" }, | 265 | ENUM_VARIANT => &SyntaxInfo { name: "ENUM_VARIANT" }, |
251 | NAMED_FIELD => &SyntaxInfo { name: "NAMED_FIELD" }, | 266 | NAMED_FIELD => &SyntaxInfo { name: "NAMED_FIELD" }, |
@@ -265,6 +280,9 @@ impl SyntaxKind { | |||
265 | ABI => &SyntaxInfo { name: "ABI" }, | 280 | ABI => &SyntaxInfo { name: "ABI" }, |
266 | NAME => &SyntaxInfo { name: "NAME" }, | 281 | NAME => &SyntaxInfo { name: "NAME" }, |
267 | NAME_REF => &SyntaxInfo { name: "NAME_REF" }, | 282 | NAME_REF => &SyntaxInfo { name: "NAME_REF" }, |
283 | VALUE_PARAMETER => &SyntaxInfo { name: "VALUE_PARAMETER" }, | ||
284 | BLOCK => &SyntaxInfo { name: "BLOCK" }, | ||
285 | LET_STMT => &SyntaxInfo { name: "LET_STMT" }, | ||
268 | 286 | ||
269 | TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" }, | 287 | TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" }, |
270 | EOF => &SyntaxInfo { name: "EOF" }, | 288 | EOF => &SyntaxInfo { name: "EOF" }, |
@@ -301,6 +319,8 @@ pub(crate) fn ident_to_keyword(ident: &str) -> Option<SyntaxKind> { | |||
301 | "mut" => Some(MUT_KW), | 319 | "mut" => Some(MUT_KW), |
302 | "unsafe" => Some(UNSAFE_KW), | 320 | "unsafe" => Some(UNSAFE_KW), |
303 | "type" => Some(TYPE_KW), | 321 | "type" => Some(TYPE_KW), |
322 | "ref" => Some(REF_KW), | ||
323 | "let" => Some(LET_KW), | ||
304 | _ => None, | 324 | _ => None, |
305 | } | 325 | } |
306 | } | 326 | } |
diff --git a/tests/data/lexer/0011_keywords.rs b/tests/data/lexer/0011_keywords.rs index 7a9509f3c..97ff3f954 100644 --- a/tests/data/lexer/0011_keywords.rs +++ b/tests/data/lexer/0011_keywords.rs | |||
@@ -1,3 +1,3 @@ | |||
1 | fn use struct trait enum impl true false as extern crate | 1 | fn use struct trait enum impl true false as extern crate |
2 | mod pub self super in where for loop while if match const | 2 | mod pub self super in where for loop while if match const |
3 | static mut type | 3 | static mut type ref let |
diff --git a/tests/data/lexer/0011_keywords.txt b/tests/data/lexer/0011_keywords.txt index 96528952b..851a671f5 100644 --- a/tests/data/lexer/0011_keywords.txt +++ b/tests/data/lexer/0011_keywords.txt | |||
@@ -49,4 +49,8 @@ WHITESPACE 1 " " | |||
49 | MUT_KW 3 "mut" | 49 | MUT_KW 3 "mut" |
50 | WHITESPACE 1 " " | 50 | WHITESPACE 1 " " |
51 | TYPE_KW 4 "type" | 51 | TYPE_KW 4 "type" |
52 | WHITESPACE 1 " " | ||
53 | REF_KW 3 "ref" | ||
54 | WHITESPACE 1 " " | ||
55 | LET_KW 3 "let" | ||
52 | WHITESPACE 1 "\n" | 56 | WHITESPACE 1 "\n" |
diff --git a/tests/data/parser/err/0005_attribute_recover.txt b/tests/data/parser/err/0005_attribute_recover.txt index 15e77f63b..731f5f2f8 100644 --- a/tests/data/parser/err/0005_attribute_recover.txt +++ b/tests/data/parser/err/0005_attribute_recover.txt | |||
@@ -28,11 +28,12 @@ FILE@[0; 54) | |||
28 | IDENT@[22; 25) "foo" | 28 | IDENT@[22; 25) "foo" |
29 | L_PAREN@[25; 26) | 29 | L_PAREN@[25; 26) |
30 | R_PAREN@[26; 27) | 30 | R_PAREN@[26; 27) |
31 | WHITESPACE@[27; 28) | 31 | BLOCK@[27; 34) |
32 | L_CURLY@[28; 29) | 32 | WHITESPACE@[27; 28) |
33 | WHITESPACE@[29; 30) | 33 | L_CURLY@[28; 29) |
34 | R_CURLY@[30; 31) | 34 | WHITESPACE@[29; 30) |
35 | WHITESPACE@[31; 34) | 35 | R_CURLY@[30; 31) |
36 | WHITESPACE@[31; 34) | ||
36 | FN_ITEM@[34; 54) | 37 | FN_ITEM@[34; 54) |
37 | ATTR@[34; 41) | 38 | ATTR@[34; 41) |
38 | POUND@[34; 35) | 39 | POUND@[34; 35) |
@@ -49,8 +50,9 @@ FILE@[0; 54) | |||
49 | IDENT@[44; 47) "foo" | 50 | IDENT@[44; 47) "foo" |
50 | L_PAREN@[47; 48) | 51 | L_PAREN@[47; 48) |
51 | R_PAREN@[48; 49) | 52 | R_PAREN@[48; 49) |
52 | WHITESPACE@[49; 50) | 53 | BLOCK@[49; 54) |
53 | L_CURLY@[50; 51) | 54 | WHITESPACE@[49; 50) |
54 | WHITESPACE@[51; 52) | 55 | L_CURLY@[50; 51) |
55 | R_CURLY@[52; 53) | 56 | WHITESPACE@[51; 52) |
56 | WHITESPACE@[53; 54) | 57 | R_CURLY@[52; 53) |
58 | WHITESPACE@[53; 54) | ||
diff --git a/tests/data/parser/err/0007_stray_curly_in_file.txt b/tests/data/parser/err/0007_stray_curly_in_file.txt index f20807bfe..8a3cb5096 100644 --- a/tests/data/parser/err/0007_stray_curly_in_file.txt +++ b/tests/data/parser/err/0007_stray_curly_in_file.txt | |||
@@ -21,9 +21,10 @@ FILE@[0; 31) | |||
21 | IDENT@[20; 23) "foo" | 21 | IDENT@[20; 23) "foo" |
22 | L_PAREN@[23; 24) | 22 | L_PAREN@[23; 24) |
23 | R_PAREN@[24; 25) | 23 | R_PAREN@[24; 25) |
24 | L_CURLY@[25; 26) | 24 | BLOCK@[25; 29) |
25 | R_CURLY@[26; 27) | 25 | L_CURLY@[25; 26) |
26 | WHITESPACE@[27; 29) | 26 | R_CURLY@[26; 27) |
27 | WHITESPACE@[27; 29) | ||
27 | ERROR@[29; 31) | 28 | ERROR@[29; 31) |
28 | err: `expected item` | 29 | err: `expected item` |
29 | R_CURLY@[29; 30) | 30 | R_CURLY@[29; 30) |
diff --git a/tests/data/parser/err/0008_item_block_recovery.txt b/tests/data/parser/err/0008_item_block_recovery.txt index ddfb4b4dc..0e2aae7cc 100644 --- a/tests/data/parser/err/0008_item_block_recovery.txt +++ b/tests/data/parser/err/0008_item_block_recovery.txt | |||
@@ -6,11 +6,12 @@ FILE@[0; 95) | |||
6 | IDENT@[3; 6) "foo" | 6 | IDENT@[3; 6) "foo" |
7 | L_PAREN@[6; 7) | 7 | L_PAREN@[6; 7) |
8 | R_PAREN@[7; 8) | 8 | R_PAREN@[7; 8) |
9 | WHITESPACE@[8; 9) | 9 | BLOCK@[8; 14) |
10 | L_CURLY@[9; 10) | 10 | WHITESPACE@[8; 9) |
11 | WHITESPACE@[10; 11) | 11 | L_CURLY@[9; 10) |
12 | R_CURLY@[11; 12) | 12 | WHITESPACE@[10; 11) |
13 | WHITESPACE@[12; 14) | 13 | R_CURLY@[11; 12) |
14 | WHITESPACE@[12; 14) | ||
14 | ERROR@[14; 17) | 15 | ERROR@[14; 17) |
15 | err: `expected item` | 16 | err: `expected item` |
16 | IDENT@[14; 17) "bar" | 17 | IDENT@[14; 17) "bar" |
@@ -56,8 +57,9 @@ FILE@[0; 95) | |||
56 | IDENT@[85; 88) "baz" | 57 | IDENT@[85; 88) "baz" |
57 | L_PAREN@[88; 89) | 58 | L_PAREN@[88; 89) |
58 | R_PAREN@[89; 90) | 59 | R_PAREN@[89; 90) |
59 | WHITESPACE@[90; 91) | 60 | BLOCK@[90; 95) |
60 | L_CURLY@[91; 92) | 61 | WHITESPACE@[90; 91) |
61 | WHITESPACE@[92; 93) | 62 | L_CURLY@[91; 92) |
62 | R_CURLY@[93; 94) | 63 | WHITESPACE@[92; 93) |
63 | WHITESPACE@[94; 95) | 64 | R_CURLY@[93; 94) |
65 | WHITESPACE@[94; 95) | ||
diff --git a/tests/data/parser/inline/0001_const_unsafe_fn.txt b/tests/data/parser/inline/0001_const_unsafe_fn.txt index 59bf89ddb..48de02284 100644 --- a/tests/data/parser/inline/0001_const_unsafe_fn.txt +++ b/tests/data/parser/inline/0001_const_unsafe_fn.txt | |||
@@ -10,7 +10,8 @@ FILE@[0; 25) | |||
10 | IDENT@[16; 19) "foo" | 10 | IDENT@[16; 19) "foo" |
11 | L_PAREN@[19; 20) | 11 | L_PAREN@[19; 20) |
12 | R_PAREN@[20; 21) | 12 | R_PAREN@[20; 21) |
13 | WHITESPACE@[21; 22) | 13 | BLOCK@[21; 25) |
14 | L_CURLY@[22; 23) | 14 | WHITESPACE@[21; 22) |
15 | R_CURLY@[23; 24) | 15 | L_CURLY@[22; 23) |
16 | WHITESPACE@[24; 25) | 16 | R_CURLY@[23; 24) |
17 | WHITESPACE@[24; 25) | ||
diff --git a/tests/data/parser/inline/0002_const_fn.txt b/tests/data/parser/inline/0002_const_fn.txt index 2e9d18f7f..733e47656 100644 --- a/tests/data/parser/inline/0002_const_fn.txt +++ b/tests/data/parser/inline/0002_const_fn.txt | |||
@@ -8,7 +8,8 @@ FILE@[0; 18) | |||
8 | IDENT@[9; 12) "foo" | 8 | IDENT@[9; 12) "foo" |
9 | L_PAREN@[12; 13) | 9 | L_PAREN@[12; 13) |
10 | R_PAREN@[13; 14) | 10 | R_PAREN@[13; 14) |
11 | WHITESPACE@[14; 15) | 11 | BLOCK@[14; 18) |
12 | L_CURLY@[15; 16) | 12 | WHITESPACE@[14; 15) |
13 | R_CURLY@[16; 17) | 13 | L_CURLY@[15; 16) |
14 | WHITESPACE@[17; 18) | 14 | R_CURLY@[16; 17) |
15 | WHITESPACE@[17; 18) | ||
diff --git a/tests/data/parser/inline/0004_extern_fn.txt b/tests/data/parser/inline/0004_extern_fn.txt index 70a909ccf..1caeffe3b 100644 --- a/tests/data/parser/inline/0004_extern_fn.txt +++ b/tests/data/parser/inline/0004_extern_fn.txt | |||
@@ -9,7 +9,8 @@ FILE@[0; 19) | |||
9 | IDENT@[10; 13) "foo" | 9 | IDENT@[10; 13) "foo" |
10 | L_PAREN@[13; 14) | 10 | L_PAREN@[13; 14) |
11 | R_PAREN@[14; 15) | 11 | R_PAREN@[14; 15) |
12 | WHITESPACE@[15; 16) | 12 | BLOCK@[15; 19) |
13 | L_CURLY@[16; 17) | 13 | WHITESPACE@[15; 16) |
14 | R_CURLY@[17; 18) | 14 | L_CURLY@[16; 17) |
15 | WHITESPACE@[18; 19) | 15 | R_CURLY@[17; 18) |
16 | WHITESPACE@[18; 19) | ||
diff --git a/tests/data/parser/inline/0011_unsafe_fn.txt b/tests/data/parser/inline/0011_unsafe_fn.txt index ed790fe22..d89ad451f 100644 --- a/tests/data/parser/inline/0011_unsafe_fn.txt +++ b/tests/data/parser/inline/0011_unsafe_fn.txt | |||
@@ -8,7 +8,8 @@ FILE@[0; 19) | |||
8 | IDENT@[10; 13) "foo" | 8 | IDENT@[10; 13) "foo" |
9 | L_PAREN@[13; 14) | 9 | L_PAREN@[13; 14) |
10 | R_PAREN@[14; 15) | 10 | R_PAREN@[14; 15) |
11 | WHITESPACE@[15; 16) | 11 | BLOCK@[15; 19) |
12 | L_CURLY@[16; 17) | 12 | WHITESPACE@[15; 16) |
13 | R_CURLY@[17; 18) | 13 | L_CURLY@[16; 17) |
14 | WHITESPACE@[18; 19) | 14 | R_CURLY@[17; 18) |
15 | WHITESPACE@[18; 19) | ||
diff --git a/tests/data/parser/inline/0012_unsafe_extern_fn.txt b/tests/data/parser/inline/0012_unsafe_extern_fn.txt index 3c8a15d12..b4c602380 100644 --- a/tests/data/parser/inline/0012_unsafe_extern_fn.txt +++ b/tests/data/parser/inline/0012_unsafe_extern_fn.txt | |||
@@ -13,7 +13,8 @@ FILE@[0; 30) | |||
13 | IDENT@[21; 24) "foo" | 13 | IDENT@[21; 24) "foo" |
14 | L_PAREN@[24; 25) | 14 | L_PAREN@[24; 25) |
15 | R_PAREN@[25; 26) | 15 | R_PAREN@[25; 26) |
16 | WHITESPACE@[26; 27) | 16 | BLOCK@[26; 30) |
17 | L_CURLY@[27; 28) | 17 | WHITESPACE@[26; 27) |
18 | R_CURLY@[28; 29) | 18 | L_CURLY@[27; 28) |
19 | WHITESPACE@[29; 30) | 19 | R_CURLY@[28; 29) |
20 | WHITESPACE@[29; 30) | ||
diff --git a/tests/data/parser/inline/0013_unsafe_block_in_mod.txt b/tests/data/parser/inline/0013_unsafe_block_in_mod.txt index 305e3058d..5ddc1736c 100644 --- a/tests/data/parser/inline/0013_unsafe_block_in_mod.txt +++ b/tests/data/parser/inline/0013_unsafe_block_in_mod.txt | |||
@@ -6,9 +6,10 @@ FILE@[0; 33) | |||
6 | IDENT@[3; 6) "foo" | 6 | IDENT@[3; 6) "foo" |
7 | L_PAREN@[6; 7) | 7 | L_PAREN@[6; 7) |
8 | R_PAREN@[7; 8) | 8 | R_PAREN@[7; 8) |
9 | L_CURLY@[8; 9) | 9 | BLOCK@[8; 11) |
10 | R_CURLY@[9; 10) | 10 | L_CURLY@[8; 9) |
11 | WHITESPACE@[10; 11) | 11 | R_CURLY@[9; 10) |
12 | WHITESPACE@[10; 11) | ||
12 | UNSAFE_KW@[11; 17) | 13 | UNSAFE_KW@[11; 17) |
13 | ERROR@[17; 22) | 14 | ERROR@[17; 22) |
14 | err: `expected `trait`, `impl` or `fn`` | 15 | err: `expected `trait`, `impl` or `fn`` |
@@ -24,6 +25,7 @@ FILE@[0; 33) | |||
24 | IDENT@[25; 28) "bar" | 25 | IDENT@[25; 28) "bar" |
25 | L_PAREN@[28; 29) | 26 | L_PAREN@[28; 29) |
26 | R_PAREN@[29; 30) | 27 | R_PAREN@[29; 30) |
27 | L_CURLY@[30; 31) | 28 | BLOCK@[30; 33) |
28 | R_CURLY@[31; 32) | 29 | L_CURLY@[30; 31) |
29 | WHITESPACE@[32; 33) | 30 | R_CURLY@[31; 32) |
31 | WHITESPACE@[32; 33) | ||
diff --git a/tests/data/parser/inline/0033_fn_value_parameters.rs b/tests/data/parser/inline/0033_fn_value_parameters.rs new file mode 100644 index 000000000..9d55bedbb --- /dev/null +++ b/tests/data/parser/inline/0033_fn_value_parameters.rs | |||
@@ -0,0 +1,4 @@ | |||
1 | fn a() {} | ||
2 | fn b(x: i32) {} | ||
3 | fn c(x: i32, ) {} | ||
4 | fn d(x: i32, y: ()) {} | ||
diff --git a/tests/data/parser/inline/0033_fn_value_parameters.txt b/tests/data/parser/inline/0033_fn_value_parameters.txt new file mode 100644 index 000000000..b0a5ff6b4 --- /dev/null +++ b/tests/data/parser/inline/0033_fn_value_parameters.txt | |||
@@ -0,0 +1,95 @@ | |||
1 | FILE@[0; 67) | ||
2 | FN_ITEM@[0; 10) | ||
3 | FN_KW@[0; 2) | ||
4 | NAME@[2; 4) | ||
5 | WHITESPACE@[2; 3) | ||
6 | IDENT@[3; 4) "a" | ||
7 | L_PAREN@[4; 5) | ||
8 | R_PAREN@[5; 6) | ||
9 | BLOCK@[6; 10) | ||
10 | WHITESPACE@[6; 7) | ||
11 | L_CURLY@[7; 8) | ||
12 | R_CURLY@[8; 9) | ||
13 | WHITESPACE@[9; 10) | ||
14 | FN_ITEM@[10; 26) | ||
15 | FN_KW@[10; 12) | ||
16 | NAME@[12; 14) | ||
17 | WHITESPACE@[12; 13) | ||
18 | IDENT@[13; 14) "b" | ||
19 | L_PAREN@[14; 15) | ||
20 | VALUE_PARAMETER@[15; 21) | ||
21 | BIND_PAT@[15; 16) | ||
22 | NAME@[15; 16) | ||
23 | IDENT@[15; 16) "x" | ||
24 | COLON@[16; 17) | ||
25 | PATH_TYPE@[17; 21) | ||
26 | PATH@[17; 21) | ||
27 | PATH_SEGMENT@[17; 21) | ||
28 | NAME_REF@[17; 21) | ||
29 | WHITESPACE@[17; 18) | ||
30 | IDENT@[18; 21) "i32" | ||
31 | R_PAREN@[21; 22) | ||
32 | BLOCK@[22; 26) | ||
33 | WHITESPACE@[22; 23) | ||
34 | L_CURLY@[23; 24) | ||
35 | R_CURLY@[24; 25) | ||
36 | WHITESPACE@[25; 26) | ||
37 | FN_ITEM@[26; 44) | ||
38 | FN_KW@[26; 28) | ||
39 | NAME@[28; 30) | ||
40 | WHITESPACE@[28; 29) | ||
41 | IDENT@[29; 30) "c" | ||
42 | L_PAREN@[30; 31) | ||
43 | VALUE_PARAMETER@[31; 37) | ||
44 | BIND_PAT@[31; 32) | ||
45 | NAME@[31; 32) | ||
46 | IDENT@[31; 32) "x" | ||
47 | COLON@[32; 33) | ||
48 | PATH_TYPE@[33; 37) | ||
49 | PATH@[33; 37) | ||
50 | PATH_SEGMENT@[33; 37) | ||
51 | NAME_REF@[33; 37) | ||
52 | WHITESPACE@[33; 34) | ||
53 | IDENT@[34; 37) "i32" | ||
54 | COMMA@[37; 38) | ||
55 | WHITESPACE@[38; 39) | ||
56 | R_PAREN@[39; 40) | ||
57 | BLOCK@[40; 44) | ||
58 | WHITESPACE@[40; 41) | ||
59 | L_CURLY@[41; 42) | ||
60 | R_CURLY@[42; 43) | ||
61 | WHITESPACE@[43; 44) | ||
62 | FN_ITEM@[44; 67) | ||
63 | FN_KW@[44; 46) | ||
64 | NAME@[46; 48) | ||
65 | WHITESPACE@[46; 47) | ||
66 | IDENT@[47; 48) "d" | ||
67 | L_PAREN@[48; 49) | ||
68 | VALUE_PARAMETER@[49; 55) | ||
69 | BIND_PAT@[49; 50) | ||
70 | NAME@[49; 50) | ||
71 | IDENT@[49; 50) "x" | ||
72 | COLON@[50; 51) | ||
73 | PATH_TYPE@[51; 55) | ||
74 | PATH@[51; 55) | ||
75 | PATH_SEGMENT@[51; 55) | ||
76 | NAME_REF@[51; 55) | ||
77 | WHITESPACE@[51; 52) | ||
78 | IDENT@[52; 55) "i32" | ||
79 | COMMA@[55; 56) | ||
80 | VALUE_PARAMETER@[56; 62) | ||
81 | BIND_PAT@[56; 58) | ||
82 | NAME@[56; 58) | ||
83 | WHITESPACE@[56; 57) | ||
84 | IDENT@[57; 58) "y" | ||
85 | COLON@[58; 59) | ||
86 | TUPLE_TYPE@[59; 62) | ||
87 | WHITESPACE@[59; 60) | ||
88 | L_PAREN@[60; 61) | ||
89 | R_PAREN@[61; 62) | ||
90 | R_PAREN@[62; 63) | ||
91 | BLOCK@[63; 67) | ||
92 | WHITESPACE@[63; 64) | ||
93 | L_CURLY@[64; 65) | ||
94 | R_CURLY@[65; 66) | ||
95 | WHITESPACE@[66; 67) | ||
diff --git a/tests/data/parser/inline/0034_bind_pat.rs b/tests/data/parser/inline/0034_bind_pat.rs new file mode 100644 index 000000000..604db2407 --- /dev/null +++ b/tests/data/parser/inline/0034_bind_pat.rs | |||
@@ -0,0 +1,6 @@ | |||
1 | fn main() { | ||
2 | let a = (); | ||
3 | let ref b = (); | ||
4 | let ref mut c = (); | ||
5 | let d @ _ = (); | ||
6 | } | ||
diff --git a/tests/data/parser/inline/0034_bind_pat.txt b/tests/data/parser/inline/0034_bind_pat.txt new file mode 100644 index 000000000..426e37e97 --- /dev/null +++ b/tests/data/parser/inline/0034_bind_pat.txt | |||
@@ -0,0 +1,81 @@ | |||
1 | FILE@[0; 94) | ||
2 | FN_ITEM@[0; 94) | ||
3 | FN_KW@[0; 2) | ||
4 | NAME@[2; 7) | ||
5 | WHITESPACE@[2; 3) | ||
6 | IDENT@[3; 7) "main" | ||
7 | L_PAREN@[7; 8) | ||
8 | R_PAREN@[8; 9) | ||
9 | BLOCK@[9; 94) | ||
10 | WHITESPACE@[9; 10) | ||
11 | L_CURLY@[10; 11) | ||
12 | LET_STMT@[11; 32) | ||
13 | WHITESPACE@[11; 16) | ||
14 | LET_KW@[16; 19) | ||
15 | BIND_PAT@[19; 22) | ||
16 | NAME@[19; 22) | ||
17 | WHITESPACE@[19; 20) | ||
18 | IDENT@[20; 21) "a" | ||
19 | WHITESPACE@[21; 22) | ||
20 | EQ@[22; 23) | ||
21 | TUPLE_EXPR@[23; 26) | ||
22 | WHITESPACE@[23; 24) | ||
23 | L_PAREN@[24; 25) | ||
24 | R_PAREN@[25; 26) | ||
25 | SEMI@[26; 27) | ||
26 | WHITESPACE@[27; 32) | ||
27 | LET_STMT@[32; 52) | ||
28 | LET_KW@[32; 35) | ||
29 | BIND_PAT@[35; 42) | ||
30 | WHITESPACE@[35; 36) | ||
31 | REF_KW@[36; 39) | ||
32 | NAME@[39; 42) | ||
33 | WHITESPACE@[39; 40) | ||
34 | IDENT@[40; 41) "b" | ||
35 | WHITESPACE@[41; 42) | ||
36 | EQ@[42; 43) | ||
37 | TUPLE_EXPR@[43; 46) | ||
38 | WHITESPACE@[43; 44) | ||
39 | L_PAREN@[44; 45) | ||
40 | R_PAREN@[45; 46) | ||
41 | SEMI@[46; 47) | ||
42 | WHITESPACE@[47; 52) | ||
43 | LET_STMT@[52; 76) | ||
44 | LET_KW@[52; 55) | ||
45 | BIND_PAT@[55; 66) | ||
46 | WHITESPACE@[55; 56) | ||
47 | REF_KW@[56; 59) | ||
48 | WHITESPACE@[59; 60) | ||
49 | MUT_KW@[60; 63) | ||
50 | NAME@[63; 66) | ||
51 | WHITESPACE@[63; 64) | ||
52 | IDENT@[64; 65) "c" | ||
53 | WHITESPACE@[65; 66) | ||
54 | EQ@[66; 67) | ||
55 | TUPLE_EXPR@[67; 70) | ||
56 | WHITESPACE@[67; 68) | ||
57 | L_PAREN@[68; 69) | ||
58 | R_PAREN@[69; 70) | ||
59 | SEMI@[70; 71) | ||
60 | WHITESPACE@[71; 76) | ||
61 | LET_STMT@[76; 92) | ||
62 | LET_KW@[76; 79) | ||
63 | BIND_PAT@[79; 86) | ||
64 | NAME@[79; 82) | ||
65 | WHITESPACE@[79; 80) | ||
66 | IDENT@[80; 81) "d" | ||
67 | WHITESPACE@[81; 82) | ||
68 | AT@[82; 83) | ||
69 | PLACEHOLDER_PAT@[83; 86) | ||
70 | WHITESPACE@[83; 84) | ||
71 | UNDERSCORE@[84; 85) | ||
72 | WHITESPACE@[85; 86) | ||
73 | EQ@[86; 87) | ||
74 | TUPLE_EXPR@[87; 90) | ||
75 | WHITESPACE@[87; 88) | ||
76 | L_PAREN@[88; 89) | ||
77 | R_PAREN@[89; 90) | ||
78 | SEMI@[90; 91) | ||
79 | WHITESPACE@[91; 92) | ||
80 | R_CURLY@[92; 93) | ||
81 | WHITESPACE@[93; 94) | ||
diff --git a/tests/data/parser/inline/0035_ref_pat.rs b/tests/data/parser/inline/0035_ref_pat.rs new file mode 100644 index 000000000..de41f5cae --- /dev/null +++ b/tests/data/parser/inline/0035_ref_pat.rs | |||
@@ -0,0 +1,4 @@ | |||
1 | fn main() { | ||
2 | let &a = (); | ||
3 | let &mut b = (); | ||
4 | } | ||
diff --git a/tests/data/parser/inline/0035_ref_pat.txt b/tests/data/parser/inline/0035_ref_pat.txt new file mode 100644 index 000000000..57623f31c --- /dev/null +++ b/tests/data/parser/inline/0035_ref_pat.txt | |||
@@ -0,0 +1,48 @@ | |||
1 | FILE@[0; 52) | ||
2 | FN_ITEM@[0; 52) | ||
3 | FN_KW@[0; 2) | ||
4 | NAME@[2; 7) | ||
5 | WHITESPACE@[2; 3) | ||
6 | IDENT@[3; 7) "main" | ||
7 | L_PAREN@[7; 8) | ||
8 | R_PAREN@[8; 9) | ||
9 | BLOCK@[9; 52) | ||
10 | WHITESPACE@[9; 10) | ||
11 | L_CURLY@[10; 11) | ||
12 | LET_STMT@[11; 33) | ||
13 | WHITESPACE@[11; 16) | ||
14 | LET_KW@[16; 19) | ||
15 | REF_PAT@[19; 23) | ||
16 | WHITESPACE@[19; 20) | ||
17 | AMPERSAND@[20; 21) | ||
18 | BIND_PAT@[21; 23) | ||
19 | NAME@[21; 23) | ||
20 | IDENT@[21; 22) "a" | ||
21 | WHITESPACE@[22; 23) | ||
22 | EQ@[23; 24) | ||
23 | TUPLE_EXPR@[24; 27) | ||
24 | WHITESPACE@[24; 25) | ||
25 | L_PAREN@[25; 26) | ||
26 | R_PAREN@[26; 27) | ||
27 | SEMI@[27; 28) | ||
28 | WHITESPACE@[28; 33) | ||
29 | LET_STMT@[33; 50) | ||
30 | LET_KW@[33; 36) | ||
31 | REF_PAT@[36; 44) | ||
32 | WHITESPACE@[36; 37) | ||
33 | AMPERSAND@[37; 38) | ||
34 | MUT_KW@[38; 41) | ||
35 | BIND_PAT@[41; 44) | ||
36 | NAME@[41; 44) | ||
37 | WHITESPACE@[41; 42) | ||
38 | IDENT@[42; 43) "b" | ||
39 | WHITESPACE@[43; 44) | ||
40 | EQ@[44; 45) | ||
41 | TUPLE_EXPR@[45; 48) | ||
42 | WHITESPACE@[45; 46) | ||
43 | L_PAREN@[46; 47) | ||
44 | R_PAREN@[47; 48) | ||
45 | SEMI@[48; 49) | ||
46 | WHITESPACE@[49; 50) | ||
47 | R_CURLY@[50; 51) | ||
48 | WHITESPACE@[51; 52) | ||
diff --git a/tests/data/parser/inline/0036_placeholder_pat.rs b/tests/data/parser/inline/0036_placeholder_pat.rs new file mode 100644 index 000000000..4d719c433 --- /dev/null +++ b/tests/data/parser/inline/0036_placeholder_pat.rs | |||
@@ -0,0 +1 @@ | |||
fn main() { let _ = (); } | |||
diff --git a/tests/data/parser/inline/0036_placeholder_pat.txt b/tests/data/parser/inline/0036_placeholder_pat.txt new file mode 100644 index 000000000..06b84c2b5 --- /dev/null +++ b/tests/data/parser/inline/0036_placeholder_pat.txt | |||
@@ -0,0 +1,27 @@ | |||
1 | FILE@[0; 26) | ||
2 | FN_ITEM@[0; 26) | ||
3 | FN_KW@[0; 2) | ||
4 | NAME@[2; 7) | ||
5 | WHITESPACE@[2; 3) | ||
6 | IDENT@[3; 7) "main" | ||
7 | L_PAREN@[7; 8) | ||
8 | R_PAREN@[8; 9) | ||
9 | BLOCK@[9; 26) | ||
10 | WHITESPACE@[9; 10) | ||
11 | L_CURLY@[10; 11) | ||
12 | LET_STMT@[11; 24) | ||
13 | WHITESPACE@[11; 12) | ||
14 | LET_KW@[12; 15) | ||
15 | PLACEHOLDER_PAT@[15; 18) | ||
16 | WHITESPACE@[15; 16) | ||
17 | UNDERSCORE@[16; 17) | ||
18 | WHITESPACE@[17; 18) | ||
19 | EQ@[18; 19) | ||
20 | TUPLE_EXPR@[19; 22) | ||
21 | WHITESPACE@[19; 20) | ||
22 | L_PAREN@[20; 21) | ||
23 | R_PAREN@[21; 22) | ||
24 | SEMI@[22; 23) | ||
25 | WHITESPACE@[23; 24) | ||
26 | R_CURLY@[24; 25) | ||
27 | WHITESPACE@[25; 26) | ||
diff --git a/tests/data/parser/ok/0005_fn_item.txt b/tests/data/parser/ok/0005_fn_item.txt index 0324ae3ee..b9d049b79 100644 --- a/tests/data/parser/ok/0005_fn_item.txt +++ b/tests/data/parser/ok/0005_fn_item.txt | |||
@@ -6,8 +6,9 @@ FILE@[0; 13) | |||
6 | IDENT@[3; 6) "foo" | 6 | IDENT@[3; 6) "foo" |
7 | L_PAREN@[6; 7) | 7 | L_PAREN@[6; 7) |
8 | R_PAREN@[7; 8) | 8 | R_PAREN@[7; 8) |
9 | WHITESPACE@[8; 9) | 9 | BLOCK@[8; 13) |
10 | L_CURLY@[9; 10) | 10 | WHITESPACE@[8; 9) |
11 | WHITESPACE@[10; 11) | 11 | L_CURLY@[9; 10) |
12 | R_CURLY@[11; 12) | 12 | WHITESPACE@[10; 11) |
13 | WHITESPACE@[12; 13) | 13 | R_CURLY@[11; 12) |
14 | WHITESPACE@[12; 13) | ||
diff --git a/tests/data/parser/ok/0008_mod_item.txt b/tests/data/parser/ok/0008_mod_item.txt index 20321051c..70ba5ac73 100644 --- a/tests/data/parser/ok/0008_mod_item.txt +++ b/tests/data/parser/ok/0008_mod_item.txt | |||
@@ -31,11 +31,12 @@ FILE@[0; 118) | |||
31 | IDENT@[34; 37) "foo" | 31 | IDENT@[34; 37) "foo" |
32 | L_PAREN@[37; 38) | 32 | L_PAREN@[37; 38) |
33 | R_PAREN@[38; 39) | 33 | R_PAREN@[38; 39) |
34 | WHITESPACE@[39; 40) | 34 | BLOCK@[39; 52) |
35 | L_CURLY@[40; 41) | 35 | WHITESPACE@[39; 40) |
36 | WHITESPACE@[41; 46) | 36 | L_CURLY@[40; 41) |
37 | R_CURLY@[46; 47) | 37 | WHITESPACE@[41; 46) |
38 | WHITESPACE@[47; 52) | 38 | R_CURLY@[46; 47) |
39 | WHITESPACE@[47; 52) | ||
39 | STRUCT_ITEM@[52; 64) | 40 | STRUCT_ITEM@[52; 64) |
40 | STRUCT_KW@[52; 58) | 41 | STRUCT_KW@[52; 58) |
41 | NAME@[58; 61) | 42 | NAME@[58; 61) |
diff --git a/tests/data/parser/ok/0011_outer_attribute.txt b/tests/data/parser/ok/0011_outer_attribute.txt index 49023e7f3..3f685ebe2 100644 --- a/tests/data/parser/ok/0011_outer_attribute.txt +++ b/tests/data/parser/ok/0011_outer_attribute.txt | |||
@@ -24,7 +24,8 @@ FILE@[0; 35) | |||
24 | IDENT@[26; 29) "foo" | 24 | IDENT@[26; 29) "foo" |
25 | L_PAREN@[29; 30) | 25 | L_PAREN@[29; 30) |
26 | R_PAREN@[30; 31) | 26 | R_PAREN@[30; 31) |
27 | WHITESPACE@[31; 32) | 27 | BLOCK@[31; 35) |
28 | L_CURLY@[32; 33) | 28 | WHITESPACE@[31; 32) |
29 | R_CURLY@[33; 34) | 29 | L_CURLY@[32; 33) |
30 | WHITESPACE@[34; 35) | 30 | R_CURLY@[33; 34) |
31 | WHITESPACE@[34; 35) | ||
diff --git a/tests/data/parser/ok/0012_visibility.txt b/tests/data/parser/ok/0012_visibility.txt index c138b73f3..664582a30 100644 --- a/tests/data/parser/ok/0012_visibility.txt +++ b/tests/data/parser/ok/0012_visibility.txt | |||
@@ -6,10 +6,11 @@ FILE@[0; 98) | |||
6 | IDENT@[3; 4) "a" | 6 | IDENT@[3; 4) "a" |
7 | L_PAREN@[4; 5) | 7 | L_PAREN@[4; 5) |
8 | R_PAREN@[5; 6) | 8 | R_PAREN@[5; 6) |
9 | WHITESPACE@[6; 7) | 9 | BLOCK@[6; 10) |
10 | L_CURLY@[7; 8) | 10 | WHITESPACE@[6; 7) |
11 | R_CURLY@[8; 9) | 11 | L_CURLY@[7; 8) |
12 | WHITESPACE@[9; 10) | 12 | R_CURLY@[8; 9) |
13 | WHITESPACE@[9; 10) | ||
13 | FN_ITEM@[10; 24) | 14 | FN_ITEM@[10; 24) |
14 | VISIBILITY@[10; 14) | 15 | VISIBILITY@[10; 14) |
15 | PUB_KW@[10; 13) | 16 | PUB_KW@[10; 13) |
@@ -20,10 +21,11 @@ FILE@[0; 98) | |||
20 | IDENT@[17; 18) "b" | 21 | IDENT@[17; 18) "b" |
21 | L_PAREN@[18; 19) | 22 | L_PAREN@[18; 19) |
22 | R_PAREN@[19; 20) | 23 | R_PAREN@[19; 20) |
23 | WHITESPACE@[20; 21) | 24 | BLOCK@[20; 24) |
24 | L_CURLY@[21; 22) | 25 | WHITESPACE@[20; 21) |
25 | R_CURLY@[22; 23) | 26 | L_CURLY@[21; 22) |
26 | WHITESPACE@[23; 24) | 27 | R_CURLY@[22; 23) |
28 | WHITESPACE@[23; 24) | ||
27 | FN_ITEM@[24; 45) | 29 | FN_ITEM@[24; 45) |
28 | VISIBILITY@[24; 35) | 30 | VISIBILITY@[24; 35) |
29 | PUB_KW@[24; 27) | 31 | PUB_KW@[24; 27) |
@@ -37,10 +39,11 @@ FILE@[0; 98) | |||
37 | IDENT@[38; 39) "c" | 39 | IDENT@[38; 39) "c" |
38 | L_PAREN@[39; 40) | 40 | L_PAREN@[39; 40) |
39 | R_PAREN@[40; 41) | 41 | R_PAREN@[40; 41) |
40 | WHITESPACE@[41; 42) | 42 | BLOCK@[41; 45) |
41 | L_CURLY@[42; 43) | 43 | WHITESPACE@[41; 42) |
42 | R_CURLY@[43; 44) | 44 | L_CURLY@[42; 43) |
43 | WHITESPACE@[44; 45) | 45 | R_CURLY@[43; 44) |
46 | WHITESPACE@[44; 45) | ||
44 | FN_ITEM@[45; 66) | 47 | FN_ITEM@[45; 66) |
45 | VISIBILITY@[45; 56) | 48 | VISIBILITY@[45; 56) |
46 | PUB_KW@[45; 48) | 49 | PUB_KW@[45; 48) |
@@ -54,10 +57,11 @@ FILE@[0; 98) | |||
54 | IDENT@[59; 60) "d" | 57 | IDENT@[59; 60) "d" |
55 | L_PAREN@[60; 61) | 58 | L_PAREN@[60; 61) |
56 | R_PAREN@[61; 62) | 59 | R_PAREN@[61; 62) |
57 | WHITESPACE@[62; 63) | 60 | BLOCK@[62; 66) |
58 | L_CURLY@[63; 64) | 61 | WHITESPACE@[62; 63) |
59 | R_CURLY@[64; 65) | 62 | L_CURLY@[63; 64) |
60 | WHITESPACE@[65; 66) | 63 | R_CURLY@[64; 65) |
64 | WHITESPACE@[65; 66) | ||
61 | FN_ITEM@[66; 98) | 65 | FN_ITEM@[66; 98) |
62 | VISIBILITY@[66; 88) | 66 | VISIBILITY@[66; 88) |
63 | PUB_KW@[66; 69) | 67 | PUB_KW@[66; 69) |
@@ -86,7 +90,8 @@ FILE@[0; 98) | |||
86 | IDENT@[91; 92) "e" | 90 | IDENT@[91; 92) "e" |
87 | L_PAREN@[92; 93) | 91 | L_PAREN@[92; 93) |
88 | R_PAREN@[93; 94) | 92 | R_PAREN@[93; 94) |
89 | WHITESPACE@[94; 95) | 93 | BLOCK@[94; 98) |
90 | L_CURLY@[95; 96) | 94 | WHITESPACE@[94; 95) |
91 | R_CURLY@[96; 97) | 95 | L_CURLY@[95; 96) |
92 | WHITESPACE@[97; 98) | 96 | R_CURLY@[96; 97) |
97 | WHITESPACE@[97; 98) | ||
diff --git a/tests/data/parser/ok/0017_attr_trailing_comma.txt b/tests/data/parser/ok/0017_attr_trailing_comma.txt index a4a6b8807..792633eae 100644 --- a/tests/data/parser/ok/0017_attr_trailing_comma.txt +++ b/tests/data/parser/ok/0017_attr_trailing_comma.txt | |||
@@ -18,7 +18,8 @@ FILE@[0; 23) | |||
18 | IDENT@[14; 17) "foo" | 18 | IDENT@[14; 17) "foo" |
19 | L_PAREN@[17; 18) | 19 | L_PAREN@[17; 18) |
20 | R_PAREN@[18; 19) | 20 | R_PAREN@[18; 19) |
21 | WHITESPACE@[19; 20) | 21 | BLOCK@[19; 23) |
22 | L_CURLY@[20; 21) | 22 | WHITESPACE@[19; 20) |
23 | R_CURLY@[21; 22) | 23 | L_CURLY@[20; 21) |
24 | WHITESPACE@[22; 23) | 24 | R_CURLY@[21; 22) |
25 | WHITESPACE@[22; 23) | ||
diff --git a/tests/data/parser/ok/0021_extern_fn.txt b/tests/data/parser/ok/0021_extern_fn.txt index 8ed7f2a25..b4456af84 100644 --- a/tests/data/parser/ok/0021_extern_fn.txt +++ b/tests/data/parser/ok/0021_extern_fn.txt | |||
@@ -9,11 +9,12 @@ FILE@[0; 71) | |||
9 | IDENT@[10; 13) "foo" | 9 | IDENT@[10; 13) "foo" |
10 | L_PAREN@[13; 14) | 10 | L_PAREN@[13; 14) |
11 | R_PAREN@[14; 15) | 11 | R_PAREN@[14; 15) |
12 | WHITESPACE@[15; 16) | 12 | BLOCK@[15; 21) |
13 | L_CURLY@[16; 17) | 13 | WHITESPACE@[15; 16) |
14 | WHITESPACE@[17; 18) | 14 | L_CURLY@[16; 17) |
15 | R_CURLY@[18; 19) | 15 | WHITESPACE@[17; 18) |
16 | WHITESPACE@[19; 21) | 16 | R_CURLY@[18; 19) |
17 | WHITESPACE@[19; 21) | ||
17 | FN_ITEM@[21; 46) | 18 | FN_ITEM@[21; 46) |
18 | ABI@[21; 32) | 19 | ABI@[21; 32) |
19 | EXTERN_KW@[21; 27) | 20 | EXTERN_KW@[21; 27) |
@@ -26,11 +27,12 @@ FILE@[0; 71) | |||
26 | IDENT@[35; 38) "bar" | 27 | IDENT@[35; 38) "bar" |
27 | L_PAREN@[38; 39) | 28 | L_PAREN@[38; 39) |
28 | R_PAREN@[39; 40) | 29 | R_PAREN@[39; 40) |
29 | WHITESPACE@[40; 41) | 30 | BLOCK@[40; 46) |
30 | L_CURLY@[41; 42) | 31 | WHITESPACE@[40; 41) |
31 | WHITESPACE@[42; 43) | 32 | L_CURLY@[41; 42) |
32 | R_CURLY@[43; 44) | 33 | WHITESPACE@[42; 43) |
33 | WHITESPACE@[44; 46) | 34 | R_CURLY@[43; 44) |
35 | WHITESPACE@[44; 46) | ||
34 | FN_ITEM@[46; 71) | 36 | FN_ITEM@[46; 71) |
35 | ABI@[46; 58) | 37 | ABI@[46; 58) |
36 | EXTERN_KW@[46; 52) | 38 | EXTERN_KW@[46; 52) |
@@ -43,8 +45,9 @@ FILE@[0; 71) | |||
43 | IDENT@[61; 64) "baz" | 45 | IDENT@[61; 64) "baz" |
44 | L_PAREN@[64; 65) | 46 | L_PAREN@[64; 65) |
45 | R_PAREN@[65; 66) | 47 | R_PAREN@[65; 66) |
46 | WHITESPACE@[66; 67) | 48 | BLOCK@[66; 71) |
47 | L_CURLY@[67; 68) | 49 | WHITESPACE@[66; 67) |
48 | WHITESPACE@[68; 69) | 50 | L_CURLY@[67; 68) |
49 | R_CURLY@[69; 70) | 51 | WHITESPACE@[68; 69) |
50 | WHITESPACE@[70; 71) | 52 | R_CURLY@[69; 70) |
53 | WHITESPACE@[70; 71) | ||