aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/expr/lower.rs1
-rw-r--r--crates/ra_parser/src/grammar/patterns.rs52
-rw-r--r--crates/ra_parser/src/syntax_kind/generated.rs1
-rw-r--r--crates/ra_syntax/src/ast/generated.rs37
-rw-r--r--crates/ra_syntax/src/grammar.ron3
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.txt3
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0024_slice_pat.txt3
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.txt3
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0111_tuple_pat.txt3
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rs25
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.txt456
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.txt3
12 files changed, 573 insertions, 17 deletions
diff --git a/crates/ra_hir/src/expr/lower.rs b/crates/ra_hir/src/expr/lower.rs
index 2be6f5421..61535d24f 100644
--- a/crates/ra_hir/src/expr/lower.rs
+++ b/crates/ra_hir/src/expr/lower.rs
@@ -573,6 +573,7 @@ where
573 } 573 }
574 574
575 // FIXME: implement 575 // FIXME: implement
576 ast::Pat::DotDotPat(_) => Pat::Missing,
576 ast::Pat::BoxPat(_) => Pat::Missing, 577 ast::Pat::BoxPat(_) => Pat::Missing,
577 ast::Pat::LiteralPat(_) => Pat::Missing, 578 ast::Pat::LiteralPat(_) => Pat::Missing,
578 ast::Pat::SlicePat(_) | ast::Pat::RangePat(_) => Pat::Missing, 579 ast::Pat::SlicePat(_) | ast::Pat::RangePat(_) => Pat::Missing,
diff --git a/crates/ra_parser/src/grammar/patterns.rs b/crates/ra_parser/src/grammar/patterns.rs
index dd1d25b07..919b0f37d 100644
--- a/crates/ra_parser/src/grammar/patterns.rs
+++ b/crates/ra_parser/src/grammar/patterns.rs
@@ -2,7 +2,7 @@ use super::*;
2 2
3pub(super) const PATTERN_FIRST: TokenSet = expressions::LITERAL_FIRST 3pub(super) const PATTERN_FIRST: TokenSet = expressions::LITERAL_FIRST
4 .union(paths::PATH_FIRST) 4 .union(paths::PATH_FIRST)
5 .union(token_set![BOX_KW, REF_KW, MUT_KW, L_PAREN, L_BRACK, AMP, UNDERSCORE, MINUS]); 5 .union(token_set![BOX_KW, REF_KW, MUT_KW, L_PAREN, L_BRACK, AMP, UNDERSCORE, MINUS, DOT]);
6 6
7pub(crate) fn pattern(p: &mut Parser) { 7pub(crate) fn pattern(p: &mut Parser) {
8 pattern_r(p, PAT_RECOVERY_SET); 8 pattern_r(p, PAT_RECOVERY_SET);
@@ -73,6 +73,7 @@ fn atom_pat(p: &mut Parser, recovery_set: TokenSet) -> Option<CompletedMarker> {
73 _ if paths::is_use_path_start(p) => path_pat(p), 73 _ if paths::is_use_path_start(p) => path_pat(p),
74 _ if is_literal_pat_start(p) => literal_pat(p), 74 _ if is_literal_pat_start(p) => literal_pat(p),
75 75
76 T![.] if p.at(T![..]) => dot_dot_pat(p),
76 T![_] => placeholder_pat(p), 77 T![_] => placeholder_pat(p),
77 T![&] => ref_pat(p), 78 T![&] => ref_pat(p),
78 T!['('] => tuple_pat(p), 79 T!['('] => tuple_pat(p),
@@ -163,7 +164,9 @@ fn record_field_pat_list(p: &mut Parser) {
163 p.bump_any(); 164 p.bump_any();
164 while !p.at(EOF) && !p.at(T!['}']) { 165 while !p.at(EOF) && !p.at(T!['}']) {
165 match p.current() { 166 match p.current() {
167 // A trailing `..` is *not* treated as a DOT_DOT_PAT.
166 T![.] if p.at(T![..]) => p.bump(T![..]), 168 T![.] if p.at(T![..]) => p.bump(T![..]),
169
167 IDENT if p.nth(1) == T![:] => record_field_pat(p), 170 IDENT if p.nth(1) == T![:] => record_field_pat(p),
168 T!['{'] => error_block(p, "expected ident"), 171 T!['{'] => error_block(p, "expected ident"),
169 T![box] => { 172 T![box] => {
@@ -201,6 +204,39 @@ fn placeholder_pat(p: &mut Parser) -> CompletedMarker {
201 m.complete(p, PLACEHOLDER_PAT) 204 m.complete(p, PLACEHOLDER_PAT)
202} 205}
203 206
207// test dot_dot_pat
208// fn main() {
209// let .. = ();
210// //
211// // Tuples
212// //
213// let (a, ..) = ();
214// let (a, ..,) = ();
215// let Tuple(a, ..) = ();
216// let Tuple(a, ..,) = ();
217// let (.., ..) = ();
218// let Tuple(.., ..) = ();
219// let (.., a, ..) = ();
220// let Tuple(.., a, ..) = ();
221// //
222// // Slices
223// //
224// let [..] = ();
225// let [head, ..] = ();
226// let [head, tail @ ..] = ();
227// let [head, .., cons] = ();
228// let [head, mid @ .., cons] = ();
229// let [head, .., .., cons] = ();
230// let [head, .., mid, tail @ ..] = ();
231// let [head, .., mid, .., cons] = ();
232// }
233fn dot_dot_pat(p: &mut Parser) -> CompletedMarker {
234 assert!(p.at(T![..]));
235 let m = p.start();
236 p.bump(T![..]);
237 m.complete(p, DOT_DOT_PAT)
238}
239
204// test ref_pat 240// test ref_pat
205// fn main() { 241// fn main() {
206// let &a = (); 242// let &a = ();
@@ -241,16 +277,12 @@ fn slice_pat(p: &mut Parser) -> CompletedMarker {
241 277
242fn pat_list(p: &mut Parser, ket: SyntaxKind) { 278fn pat_list(p: &mut Parser, ket: SyntaxKind) {
243 while !p.at(EOF) && !p.at(ket) { 279 while !p.at(EOF) && !p.at(ket) {
244 match p.current() { 280 if !p.at_ts(PATTERN_FIRST) {
245 T![.] if p.at(T![..]) => p.bump(T![..]), 281 p.error("expected a pattern");
246 _ => { 282 break;
247 if !p.at_ts(PATTERN_FIRST) {
248 p.error("expected a pattern");
249 break;
250 }
251 pattern(p)
252 }
253 } 283 }
284
285 pattern(p);
254 if !p.at(ket) { 286 if !p.at(ket) {
255 p.expect(T![,]); 287 p.expect(T![,]);
256 } 288 }
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs
index 8ba29ebf8..23eb3c9cb 100644
--- a/crates/ra_parser/src/syntax_kind/generated.rs
+++ b/crates/ra_parser/src/syntax_kind/generated.rs
@@ -152,6 +152,7 @@ pub enum SyntaxKind {
152 BOX_PAT, 152 BOX_PAT,
153 BIND_PAT, 153 BIND_PAT,
154 PLACEHOLDER_PAT, 154 PLACEHOLDER_PAT,
155 DOT_DOT_PAT,
155 PATH_PAT, 156 PATH_PAT,
156 RECORD_PAT, 157 RECORD_PAT,
157 RECORD_FIELD_PAT_LIST, 158 RECORD_FIELD_PAT_LIST,
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index a8a231ef3..591ac8ca3 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -532,6 +532,29 @@ impl AstNode for ContinueExpr {
532} 532}
533impl ContinueExpr {} 533impl ContinueExpr {}
534#[derive(Debug, Clone, PartialEq, Eq, Hash)] 534#[derive(Debug, Clone, PartialEq, Eq, Hash)]
535pub struct DotDotPat {
536 pub(crate) syntax: SyntaxNode,
537}
538impl AstNode for DotDotPat {
539 fn can_cast(kind: SyntaxKind) -> bool {
540 match kind {
541 DOT_DOT_PAT => true,
542 _ => false,
543 }
544 }
545 fn cast(syntax: SyntaxNode) -> Option<Self> {
546 if Self::can_cast(syntax.kind()) {
547 Some(Self { syntax })
548 } else {
549 None
550 }
551 }
552 fn syntax(&self) -> &SyntaxNode {
553 &self.syntax
554 }
555}
556impl DotDotPat {}
557#[derive(Debug, Clone, PartialEq, Eq, Hash)]
535pub struct DynTraitType { 558pub struct DynTraitType {
536 pub(crate) syntax: SyntaxNode, 559 pub(crate) syntax: SyntaxNode,
537} 560}
@@ -2128,6 +2151,7 @@ pub enum Pat {
2128 BoxPat(BoxPat), 2151 BoxPat(BoxPat),
2129 BindPat(BindPat), 2152 BindPat(BindPat),
2130 PlaceholderPat(PlaceholderPat), 2153 PlaceholderPat(PlaceholderPat),
2154 DotDotPat(DotDotPat),
2131 PathPat(PathPat), 2155 PathPat(PathPat),
2132 RecordPat(RecordPat), 2156 RecordPat(RecordPat),
2133 TupleStructPat(TupleStructPat), 2157 TupleStructPat(TupleStructPat),
@@ -2156,6 +2180,11 @@ impl From<PlaceholderPat> for Pat {
2156 Pat::PlaceholderPat(node) 2180 Pat::PlaceholderPat(node)
2157 } 2181 }
2158} 2182}
2183impl From<DotDotPat> for Pat {
2184 fn from(node: DotDotPat) -> Pat {
2185 Pat::DotDotPat(node)
2186 }
2187}
2159impl From<PathPat> for Pat { 2188impl From<PathPat> for Pat {
2160 fn from(node: PathPat) -> Pat { 2189 fn from(node: PathPat) -> Pat {
2161 Pat::PathPat(node) 2190 Pat::PathPat(node)
@@ -2194,8 +2223,10 @@ impl From<LiteralPat> for Pat {
2194impl AstNode for Pat { 2223impl AstNode for Pat {
2195 fn can_cast(kind: SyntaxKind) -> bool { 2224 fn can_cast(kind: SyntaxKind) -> bool {
2196 match kind { 2225 match kind {
2197 REF_PAT | BOX_PAT | BIND_PAT | PLACEHOLDER_PAT | PATH_PAT | RECORD_PAT 2226 REF_PAT | BOX_PAT | BIND_PAT | PLACEHOLDER_PAT | DOT_DOT_PAT | PATH_PAT
2198 | TUPLE_STRUCT_PAT | TUPLE_PAT | SLICE_PAT | RANGE_PAT | LITERAL_PAT => true, 2227 | RECORD_PAT | TUPLE_STRUCT_PAT | TUPLE_PAT | SLICE_PAT | RANGE_PAT | LITERAL_PAT => {
2228 true
2229 }
2199 _ => false, 2230 _ => false,
2200 } 2231 }
2201 } 2232 }
@@ -2205,6 +2236,7 @@ impl AstNode for Pat {
2205 BOX_PAT => Pat::BoxPat(BoxPat { syntax }), 2236 BOX_PAT => Pat::BoxPat(BoxPat { syntax }),
2206 BIND_PAT => Pat::BindPat(BindPat { syntax }), 2237 BIND_PAT => Pat::BindPat(BindPat { syntax }),
2207 PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }), 2238 PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }),
2239 DOT_DOT_PAT => Pat::DotDotPat(DotDotPat { syntax }),
2208 PATH_PAT => Pat::PathPat(PathPat { syntax }), 2240 PATH_PAT => Pat::PathPat(PathPat { syntax }),
2209 RECORD_PAT => Pat::RecordPat(RecordPat { syntax }), 2241 RECORD_PAT => Pat::RecordPat(RecordPat { syntax }),
2210 TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }), 2242 TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }),
@@ -2222,6 +2254,7 @@ impl AstNode for Pat {
2222 Pat::BoxPat(it) => &it.syntax, 2254 Pat::BoxPat(it) => &it.syntax,
2223 Pat::BindPat(it) => &it.syntax, 2255 Pat::BindPat(it) => &it.syntax,
2224 Pat::PlaceholderPat(it) => &it.syntax, 2256 Pat::PlaceholderPat(it) => &it.syntax,
2257 Pat::DotDotPat(it) => &it.syntax,
2225 Pat::PathPat(it) => &it.syntax, 2258 Pat::PathPat(it) => &it.syntax,
2226 Pat::RecordPat(it) => &it.syntax, 2259 Pat::RecordPat(it) => &it.syntax,
2227 Pat::TupleStructPat(it) => &it.syntax, 2260 Pat::TupleStructPat(it) => &it.syntax,
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index 8f064711d..08cc6eeea 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -161,6 +161,7 @@ Grammar(
161 "BOX_PAT", 161 "BOX_PAT",
162 "BIND_PAT", 162 "BIND_PAT",
163 "PLACEHOLDER_PAT", 163 "PLACEHOLDER_PAT",
164 "DOT_DOT_PAT",
164 "PATH_PAT", 165 "PATH_PAT",
165 "RECORD_PAT", 166 "RECORD_PAT",
166 "RECORD_FIELD_PAT_LIST", 167 "RECORD_FIELD_PAT_LIST",
@@ -532,6 +533,7 @@ Grammar(
532 traits: ["NameOwner"] 533 traits: ["NameOwner"]
533 ), 534 ),
534 "PlaceholderPat": (), 535 "PlaceholderPat": (),
536 "DotDotPat": (),
535 "PathPat": ( options: [ "Path" ] ), 537 "PathPat": ( options: [ "Path" ] ),
536 "RecordPat": ( options: ["RecordFieldPatList", "Path"] ), 538 "RecordPat": ( options: ["RecordFieldPatList", "Path"] ),
537 "RecordFieldPatList": ( 539 "RecordFieldPatList": (
@@ -559,6 +561,7 @@ Grammar(
559 "BoxPat", 561 "BoxPat",
560 "BindPat", 562 "BindPat",
561 "PlaceholderPat", 563 "PlaceholderPat",
564 "DotDotPat",
562 "PathPat", 565 "PathPat",
563 "RecordPat", 566 "RecordPat",
564 "TupleStructPat", 567 "TupleStructPat",
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.txt b/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.txt
index 80bb7733c..3812adc9e 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.txt
@@ -82,7 +82,8 @@ SOURCE_FILE@[0; 103)
82 NAME_REF@[87; 90) 82 NAME_REF@[87; 90)
83 IDENT@[87; 90) "Bar" 83 IDENT@[87; 90) "Bar"
84 L_PAREN@[90; 91) "(" 84 L_PAREN@[90; 91) "("
85 DOTDOT@[91; 93) ".." 85 DOT_DOT_PAT@[91; 93)
86 DOTDOT@[91; 93) ".."
86 R_PAREN@[93; 94) ")" 87 R_PAREN@[93; 94) ")"
87 WHITESPACE@[94; 95) " " 88 WHITESPACE@[94; 95) " "
88 EQ@[95; 96) "=" 89 EQ@[95; 96) "="
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0024_slice_pat.txt b/crates/ra_syntax/test_data/parser/inline/ok/0024_slice_pat.txt
index c1d669e54..48aaeaf07 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0024_slice_pat.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0024_slice_pat.txt
@@ -27,7 +27,8 @@ SOURCE_FILE@[0; 39)
27 IDENT@[24; 25) "b" 27 IDENT@[24; 25) "b"
28 COMMA@[25; 26) "," 28 COMMA@[25; 26) ","
29 WHITESPACE@[26; 27) " " 29 WHITESPACE@[26; 27) " "
30 DOTDOT@[27; 29) ".." 30 DOT_DOT_PAT@[27; 29)
31 DOTDOT@[27; 29) ".."
31 R_BRACK@[29; 30) "]" 32 R_BRACK@[29; 30) "]"
32 WHITESPACE@[30; 31) " " 33 WHITESPACE@[30; 31) " "
33 EQ@[31; 32) "=" 34 EQ@[31; 32) "="
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.txt b/crates/ra_syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.txt
index adc8931e2..666386d31 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.txt
@@ -84,7 +84,8 @@ SOURCE_FILE@[0; 97)
84 UNDERSCORE@[78; 79) "_" 84 UNDERSCORE@[78; 79) "_"
85 COMMA@[79; 80) "," 85 COMMA@[79; 80) ","
86 WHITESPACE@[80; 81) " " 86 WHITESPACE@[80; 81) " "
87 DOTDOT@[81; 83) ".." 87 DOT_DOT_PAT@[81; 83)
88 DOTDOT@[81; 83) ".."
88 WHITESPACE@[83; 84) " " 89 WHITESPACE@[83; 84) " "
89 COMMA@[84; 85) "," 90 COMMA@[84; 85) ","
90 WHITESPACE@[85; 86) " " 91 WHITESPACE@[85; 86) " "
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0111_tuple_pat.txt b/crates/ra_syntax/test_data/parser/inline/ok/0111_tuple_pat.txt
index 3fee3a1cf..674dec493 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0111_tuple_pat.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0111_tuple_pat.txt
@@ -27,7 +27,8 @@ SOURCE_FILE@[0; 39)
27 IDENT@[24; 25) "b" 27 IDENT@[24; 25) "b"
28 COMMA@[25; 26) "," 28 COMMA@[25; 26) ","
29 WHITESPACE@[26; 27) " " 29 WHITESPACE@[26; 27) " "
30 DOTDOT@[27; 29) ".." 30 DOT_DOT_PAT@[27; 29)
31 DOTDOT@[27; 29) ".."
31 R_PAREN@[29; 30) ")" 32 R_PAREN@[29; 30) ")"
32 WHITESPACE@[30; 31) " " 33 WHITESPACE@[30; 31) " "
33 EQ@[31; 32) "=" 34 EQ@[31; 32) "="
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rs b/crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rs
new file mode 100644
index 000000000..3262f27e1
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rs
@@ -0,0 +1,25 @@
1fn main() {
2 let .. = ();
3 //
4 // Tuples
5 //
6 let (a, ..) = ();
7 let (a, ..,) = ();
8 let Tuple(a, ..) = ();
9 let Tuple(a, ..,) = ();
10 let (.., ..) = ();
11 let Tuple(.., ..) = ();
12 let (.., a, ..) = ();
13 let Tuple(.., a, ..) = ();
14 //
15 // Slices
16 //
17 let [..] = ();
18 let [head, ..] = ();
19 let [head, tail @ ..] = ();
20 let [head, .., cons] = ();
21 let [head, mid @ .., cons] = ();
22 let [head, .., .., cons] = ();
23 let [head, .., mid, tail @ ..] = ();
24 let [head, .., mid, .., cons] = ();
25}
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.txt b/crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.txt
new file mode 100644
index 000000000..325b1bd08
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.txt
@@ -0,0 +1,456 @@
1SOURCE_FILE@[0; 555)
2 FN_DEF@[0; 554)
3 FN_KW@[0; 2) "fn"
4 WHITESPACE@[2; 3) " "
5 NAME@[3; 7)
6 IDENT@[3; 7) "main"
7 PARAM_LIST@[7; 9)
8 L_PAREN@[7; 8) "("
9 R_PAREN@[8; 9) ")"
10 WHITESPACE@[9; 10) " "
11 BLOCK_EXPR@[10; 554)
12 BLOCK@[10; 554)
13 L_CURLY@[10; 11) "{"
14 WHITESPACE@[11; 16) "\n "
15 LET_STMT@[16; 28)
16 LET_KW@[16; 19) "let"
17 WHITESPACE@[19; 20) " "
18 DOT_DOT_PAT@[20; 22)
19 DOTDOT@[20; 22) ".."
20 WHITESPACE@[22; 23) " "
21 EQ@[23; 24) "="
22 WHITESPACE@[24; 25) " "
23 TUPLE_EXPR@[25; 27)
24 L_PAREN@[25; 26) "("
25 R_PAREN@[26; 27) ")"
26 SEMI@[27; 28) ";"
27 WHITESPACE@[28; 33) "\n "
28 COMMENT@[33; 35) "//"
29 WHITESPACE@[35; 40) "\n "
30 COMMENT@[40; 49) "// Tuples"
31 WHITESPACE@[49; 54) "\n "
32 COMMENT@[54; 56) "//"
33 WHITESPACE@[56; 61) "\n "
34 LET_STMT@[61; 78)
35 LET_KW@[61; 64) "let"
36 WHITESPACE@[64; 65) " "
37 TUPLE_PAT@[65; 72)
38 L_PAREN@[65; 66) "("
39 BIND_PAT@[66; 67)
40 NAME@[66; 67)
41 IDENT@[66; 67) "a"
42 COMMA@[67; 68) ","
43 WHITESPACE@[68; 69) " "
44 DOT_DOT_PAT@[69; 71)
45 DOTDOT@[69; 71) ".."
46 R_PAREN@[71; 72) ")"
47 WHITESPACE@[72; 73) " "
48 EQ@[73; 74) "="
49 WHITESPACE@[74; 75) " "
50 TUPLE_EXPR@[75; 77)
51 L_PAREN@[75; 76) "("
52 R_PAREN@[76; 77) ")"
53 SEMI@[77; 78) ";"
54 WHITESPACE@[78; 83) "\n "
55 LET_STMT@[83; 101)
56 LET_KW@[83; 86) "let"
57 WHITESPACE@[86; 87) " "
58 TUPLE_PAT@[87; 95)
59 L_PAREN@[87; 88) "("
60 BIND_PAT@[88; 89)
61 NAME@[88; 89)
62 IDENT@[88; 89) "a"
63 COMMA@[89; 90) ","
64 WHITESPACE@[90; 91) " "
65 DOT_DOT_PAT@[91; 93)
66 DOTDOT@[91; 93) ".."
67 COMMA@[93; 94) ","
68 R_PAREN@[94; 95) ")"
69 WHITESPACE@[95; 96) " "
70 EQ@[96; 97) "="
71 WHITESPACE@[97; 98) " "
72 TUPLE_EXPR@[98; 100)
73 L_PAREN@[98; 99) "("
74 R_PAREN@[99; 100) ")"
75 SEMI@[100; 101) ";"
76 WHITESPACE@[101; 106) "\n "
77 LET_STMT@[106; 128)
78 LET_KW@[106; 109) "let"
79 WHITESPACE@[109; 110) " "
80 TUPLE_STRUCT_PAT@[110; 122)
81 PATH@[110; 115)
82 PATH_SEGMENT@[110; 115)
83 NAME_REF@[110; 115)
84 IDENT@[110; 115) "Tuple"
85 L_PAREN@[115; 116) "("
86 BIND_PAT@[116; 117)
87 NAME@[116; 117)
88 IDENT@[116; 117) "a"
89 COMMA@[117; 118) ","
90 WHITESPACE@[118; 119) " "
91 DOT_DOT_PAT@[119; 121)
92 DOTDOT@[119; 121) ".."
93 R_PAREN@[121; 122) ")"
94 WHITESPACE@[122; 123) " "
95 EQ@[123; 124) "="
96 WHITESPACE@[124; 125) " "
97 TUPLE_EXPR@[125; 127)
98 L_PAREN@[125; 126) "("
99 R_PAREN@[126; 127) ")"
100 SEMI@[127; 128) ";"
101 WHITESPACE@[128; 133) "\n "
102 LET_STMT@[133; 156)
103 LET_KW@[133; 136) "let"
104 WHITESPACE@[136; 137) " "
105 TUPLE_STRUCT_PAT@[137; 150)
106 PATH@[137; 142)
107 PATH_SEGMENT@[137; 142)
108 NAME_REF@[137; 142)
109 IDENT@[137; 142) "Tuple"
110 L_PAREN@[142; 143) "("
111 BIND_PAT@[143; 144)
112 NAME@[143; 144)
113 IDENT@[143; 144) "a"
114 COMMA@[144; 145) ","
115 WHITESPACE@[145; 146) " "
116 DOT_DOT_PAT@[146; 148)
117 DOTDOT@[146; 148) ".."
118 COMMA@[148; 149) ","
119 R_PAREN@[149; 150) ")"
120 WHITESPACE@[150; 151) " "
121 EQ@[151; 152) "="
122 WHITESPACE@[152; 153) " "
123 TUPLE_EXPR@[153; 155)
124 L_PAREN@[153; 154) "("
125 R_PAREN@[154; 155) ")"
126 SEMI@[155; 156) ";"
127 WHITESPACE@[156; 161) "\n "
128 LET_STMT@[161; 179)
129 LET_KW@[161; 164) "let"
130 WHITESPACE@[164; 165) " "
131 TUPLE_PAT@[165; 173)
132 L_PAREN@[165; 166) "("
133 DOT_DOT_PAT@[166; 168)
134 DOTDOT@[166; 168) ".."
135 COMMA@[168; 169) ","
136 WHITESPACE@[169; 170) " "
137 DOT_DOT_PAT@[170; 172)
138 DOTDOT@[170; 172) ".."
139 R_PAREN@[172; 173) ")"
140 WHITESPACE@[173; 174) " "
141 EQ@[174; 175) "="
142 WHITESPACE@[175; 176) " "
143 TUPLE_EXPR@[176; 178)
144 L_PAREN@[176; 177) "("
145 R_PAREN@[177; 178) ")"
146 SEMI@[178; 179) ";"
147 WHITESPACE@[179; 184) "\n "
148 LET_STMT@[184; 207)
149 LET_KW@[184; 187) "let"
150 WHITESPACE@[187; 188) " "
151 TUPLE_STRUCT_PAT@[188; 201)
152 PATH@[188; 193)
153 PATH_SEGMENT@[188; 193)
154 NAME_REF@[188; 193)
155 IDENT@[188; 193) "Tuple"
156 L_PAREN@[193; 194) "("
157 DOT_DOT_PAT@[194; 196)
158 DOTDOT@[194; 196) ".."
159 COMMA@[196; 197) ","
160 WHITESPACE@[197; 198) " "
161 DOT_DOT_PAT@[198; 200)
162 DOTDOT@[198; 200) ".."
163 R_PAREN@[200; 201) ")"
164 WHITESPACE@[201; 202) " "
165 EQ@[202; 203) "="
166 WHITESPACE@[203; 204) " "
167 TUPLE_EXPR@[204; 206)
168 L_PAREN@[204; 205) "("
169 R_PAREN@[205; 206) ")"
170 SEMI@[206; 207) ";"
171 WHITESPACE@[207; 212) "\n "
172 LET_STMT@[212; 233)
173 LET_KW@[212; 215) "let"
174 WHITESPACE@[215; 216) " "
175 TUPLE_PAT@[216; 227)
176 L_PAREN@[216; 217) "("
177 DOT_DOT_PAT@[217; 219)
178 DOTDOT@[217; 219) ".."
179 COMMA@[219; 220) ","
180 WHITESPACE@[220; 221) " "
181 BIND_PAT@[221; 222)
182 NAME@[221; 222)
183 IDENT@[221; 222) "a"
184 COMMA@[222; 223) ","
185 WHITESPACE@[223; 224) " "
186 DOT_DOT_PAT@[224; 226)
187 DOTDOT@[224; 226) ".."
188 R_PAREN@[226; 227) ")"
189 WHITESPACE@[227; 228) " "
190 EQ@[228; 229) "="
191 WHITESPACE@[229; 230) " "
192 TUPLE_EXPR@[230; 232)
193 L_PAREN@[230; 231) "("
194 R_PAREN@[231; 232) ")"
195 SEMI@[232; 233) ";"
196 WHITESPACE@[233; 238) "\n "
197 LET_STMT@[238; 264)
198 LET_KW@[238; 241) "let"
199 WHITESPACE@[241; 242) " "
200 TUPLE_STRUCT_PAT@[242; 258)
201 PATH@[242; 247)
202 PATH_SEGMENT@[242; 247)
203 NAME_REF@[242; 247)
204 IDENT@[242; 247) "Tuple"
205 L_PAREN@[247; 248) "("
206 DOT_DOT_PAT@[248; 250)
207 DOTDOT@[248; 250) ".."
208 COMMA@[250; 251) ","
209 WHITESPACE@[251; 252) " "
210 BIND_PAT@[252; 253)
211 NAME@[252; 253)
212 IDENT@[252; 253) "a"
213 COMMA@[253; 254) ","
214 WHITESPACE@[254; 255) " "
215 DOT_DOT_PAT@[255; 257)
216 DOTDOT@[255; 257) ".."
217 R_PAREN@[257; 258) ")"
218 WHITESPACE@[258; 259) " "
219 EQ@[259; 260) "="
220 WHITESPACE@[260; 261) " "
221 TUPLE_EXPR@[261; 263)
222 L_PAREN@[261; 262) "("
223 R_PAREN@[262; 263) ")"
224 SEMI@[263; 264) ";"
225 WHITESPACE@[264; 269) "\n "
226 COMMENT@[269; 271) "//"
227 WHITESPACE@[271; 276) "\n "
228 COMMENT@[276; 285) "// Slices"
229 WHITESPACE@[285; 290) "\n "
230 COMMENT@[290; 292) "//"
231 WHITESPACE@[292; 297) "\n "
232 LET_STMT@[297; 311)
233 LET_KW@[297; 300) "let"
234 WHITESPACE@[300; 301) " "
235 SLICE_PAT@[301; 305)
236 L_BRACK@[301; 302) "["
237 DOT_DOT_PAT@[302; 304)
238 DOTDOT@[302; 304) ".."
239 R_BRACK@[304; 305) "]"
240 WHITESPACE@[305; 306) " "
241 EQ@[306; 307) "="
242 WHITESPACE@[307; 308) " "
243 TUPLE_EXPR@[308; 310)
244 L_PAREN@[308; 309) "("
245 R_PAREN@[309; 310) ")"
246 SEMI@[310; 311) ";"
247 WHITESPACE@[311; 316) "\n "
248 LET_STMT@[316; 336)
249 LET_KW@[316; 319) "let"
250 WHITESPACE@[319; 320) " "
251 SLICE_PAT@[320; 330)
252 L_BRACK@[320; 321) "["
253 BIND_PAT@[321; 325)
254 NAME@[321; 325)
255 IDENT@[321; 325) "head"
256 COMMA@[325; 326) ","
257 WHITESPACE@[326; 327) " "
258 DOT_DOT_PAT@[327; 329)
259 DOTDOT@[327; 329) ".."
260 R_BRACK@[329; 330) "]"
261 WHITESPACE@[330; 331) " "
262 EQ@[331; 332) "="
263 WHITESPACE@[332; 333) " "
264 TUPLE_EXPR@[333; 335)
265 L_PAREN@[333; 334) "("
266 R_PAREN@[334; 335) ")"
267 SEMI@[335; 336) ";"
268 WHITESPACE@[336; 341) "\n "
269 LET_STMT@[341; 368)
270 LET_KW@[341; 344) "let"
271 WHITESPACE@[344; 345) " "
272 SLICE_PAT@[345; 362)
273 L_BRACK@[345; 346) "["
274 BIND_PAT@[346; 350)
275 NAME@[346; 350)
276 IDENT@[346; 350) "head"
277 COMMA@[350; 351) ","
278 WHITESPACE@[351; 352) " "
279 BIND_PAT@[352; 361)
280 NAME@[352; 356)
281 IDENT@[352; 356) "tail"
282 WHITESPACE@[356; 357) " "
283 AT@[357; 358) "@"
284 WHITESPACE@[358; 359) " "
285 DOT_DOT_PAT@[359; 361)
286 DOTDOT@[359; 361) ".."
287 R_BRACK@[361; 362) "]"
288 WHITESPACE@[362; 363) " "
289 EQ@[363; 364) "="
290 WHITESPACE@[364; 365) " "
291 TUPLE_EXPR@[365; 367)
292 L_PAREN@[365; 366) "("
293 R_PAREN@[366; 367) ")"
294 SEMI@[367; 368) ";"
295 WHITESPACE@[368; 373) "\n "
296 LET_STMT@[373; 399)
297 LET_KW@[373; 376) "let"
298 WHITESPACE@[376; 377) " "
299 SLICE_PAT@[377; 393)
300 L_BRACK@[377; 378) "["
301 BIND_PAT@[378; 382)
302 NAME@[378; 382)
303 IDENT@[378; 382) "head"
304 COMMA@[382; 383) ","
305 WHITESPACE@[383; 384) " "
306 DOT_DOT_PAT@[384; 386)
307 DOTDOT@[384; 386) ".."
308 COMMA@[386; 387) ","
309 WHITESPACE@[387; 388) " "
310 BIND_PAT@[388; 392)
311 NAME@[388; 392)
312 IDENT@[388; 392) "cons"
313 R_BRACK@[392; 393) "]"
314 WHITESPACE@[393; 394) " "
315 EQ@[394; 395) "="
316 WHITESPACE@[395; 396) " "
317 TUPLE_EXPR@[396; 398)
318 L_PAREN@[396; 397) "("
319 R_PAREN@[397; 398) ")"
320 SEMI@[398; 399) ";"
321 WHITESPACE@[399; 404) "\n "
322 LET_STMT@[404; 436)
323 LET_KW@[404; 407) "let"
324 WHITESPACE@[407; 408) " "
325 SLICE_PAT@[408; 430)
326 L_BRACK@[408; 409) "["
327 BIND_PAT@[409; 413)
328 NAME@[409; 413)
329 IDENT@[409; 413) "head"
330 COMMA@[413; 414) ","
331 WHITESPACE@[414; 415) " "
332 BIND_PAT@[415; 423)
333 NAME@[415; 418)
334 IDENT@[415; 418) "mid"
335 WHITESPACE@[418; 419) " "
336 AT@[419; 420) "@"
337 WHITESPACE@[420; 421) " "
338 DOT_DOT_PAT@[421; 423)
339 DOTDOT@[421; 423) ".."
340 COMMA@[423; 424) ","
341 WHITESPACE@[424; 425) " "
342 BIND_PAT@[425; 429)
343 NAME@[425; 429)
344 IDENT@[425; 429) "cons"
345 R_BRACK@[429; 430) "]"
346 WHITESPACE@[430; 431) " "
347 EQ@[431; 432) "="
348 WHITESPACE@[432; 433) " "
349 TUPLE_EXPR@[433; 435)
350 L_PAREN@[433; 434) "("
351 R_PAREN@[434; 435) ")"
352 SEMI@[435; 436) ";"
353 WHITESPACE@[436; 441) "\n "
354 LET_STMT@[441; 471)
355 LET_KW@[441; 444) "let"
356 WHITESPACE@[444; 445) " "
357 SLICE_PAT@[445; 465)
358 L_BRACK@[445; 446) "["
359 BIND_PAT@[446; 450)
360 NAME@[446; 450)
361 IDENT@[446; 450) "head"
362 COMMA@[450; 451) ","
363 WHITESPACE@[451; 452) " "
364 DOT_DOT_PAT@[452; 454)
365 DOTDOT@[452; 454) ".."
366 COMMA@[454; 455) ","
367 WHITESPACE@[455; 456) " "
368 DOT_DOT_PAT@[456; 458)
369 DOTDOT@[456; 458) ".."
370 COMMA@[458; 459) ","
371 WHITESPACE@[459; 460) " "
372 BIND_PAT@[460; 464)
373 NAME@[460; 464)
374 IDENT@[460; 464) "cons"
375 R_BRACK@[464; 465) "]"
376 WHITESPACE@[465; 466) " "
377 EQ@[466; 467) "="
378 WHITESPACE@[467; 468) " "
379 TUPLE_EXPR@[468; 470)
380 L_PAREN@[468; 469) "("
381 R_PAREN@[469; 470) ")"
382 SEMI@[470; 471) ";"
383 WHITESPACE@[471; 476) "\n "
384 LET_STMT@[476; 512)
385 LET_KW@[476; 479) "let"
386 WHITESPACE@[479; 480) " "
387 SLICE_PAT@[480; 506)
388 L_BRACK@[480; 481) "["
389 BIND_PAT@[481; 485)
390 NAME@[481; 485)
391 IDENT@[481; 485) "head"
392 COMMA@[485; 486) ","
393 WHITESPACE@[486; 487) " "
394 DOT_DOT_PAT@[487; 489)
395 DOTDOT@[487; 489) ".."
396 COMMA@[489; 490) ","
397 WHITESPACE@[490; 491) " "
398 BIND_PAT@[491; 494)
399 NAME@[491; 494)
400 IDENT@[491; 494) "mid"
401 COMMA@[494; 495) ","
402 WHITESPACE@[495; 496) " "
403 BIND_PAT@[496; 505)
404 NAME@[496; 500)
405 IDENT@[496; 500) "tail"
406 WHITESPACE@[500; 501) " "
407 AT@[501; 502) "@"
408 WHITESPACE@[502; 503) " "
409 DOT_DOT_PAT@[503; 505)
410 DOTDOT@[503; 505) ".."
411 R_BRACK@[505; 506) "]"
412 WHITESPACE@[506; 507) " "
413 EQ@[507; 508) "="
414 WHITESPACE@[508; 509) " "
415 TUPLE_EXPR@[509; 511)
416 L_PAREN@[509; 510) "("
417 R_PAREN@[510; 511) ")"
418 SEMI@[511; 512) ";"
419 WHITESPACE@[512; 517) "\n "
420 LET_STMT@[517; 552)
421 LET_KW@[517; 520) "let"
422 WHITESPACE@[520; 521) " "
423 SLICE_PAT@[521; 546)
424 L_BRACK@[521; 522) "["
425 BIND_PAT@[522; 526)
426 NAME@[522; 526)
427 IDENT@[522; 526) "head"
428 COMMA@[526; 527) ","
429 WHITESPACE@[527; 528) " "
430 DOT_DOT_PAT@[528; 530)
431 DOTDOT@[528; 530) ".."
432 COMMA@[530; 531) ","
433 WHITESPACE@[531; 532) " "
434 BIND_PAT@[532; 535)
435 NAME@[532; 535)
436 IDENT@[532; 535) "mid"
437 COMMA@[535; 536) ","
438 WHITESPACE@[536; 537) " "
439 DOT_DOT_PAT@[537; 539)
440 DOTDOT@[537; 539) ".."
441 COMMA@[539; 540) ","
442 WHITESPACE@[540; 541) " "
443 BIND_PAT@[541; 545)
444 NAME@[541; 545)
445 IDENT@[541; 545) "cons"
446 R_BRACK@[545; 546) "]"
447 WHITESPACE@[546; 547) " "
448 EQ@[547; 548) "="
449 WHITESPACE@[548; 549) " "
450 TUPLE_EXPR@[549; 551)
451 L_PAREN@[549; 550) "("
452 R_PAREN@[550; 551) ")"
453 SEMI@[551; 552) ";"
454 WHITESPACE@[552; 553) "\n"
455 R_CURLY@[553; 554) "}"
456 WHITESPACE@[554; 555) "\n"
diff --git a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.txt b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.txt
index c18e3c329..3326ab2ae 100644
--- a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.txt
+++ b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.txt
@@ -1656,7 +1656,8 @@ SOURCE_FILE@[0; 3813)
1656 PARAM@[2952; 2962) 1656 PARAM@[2952; 2962)
1657 TUPLE_PAT@[2952; 2956) 1657 TUPLE_PAT@[2952; 2956)
1658 L_PAREN@[2952; 2953) "(" 1658 L_PAREN@[2952; 2953) "("
1659 DOTDOT@[2953; 2955) ".." 1659 DOT_DOT_PAT@[2953; 2955)
1660 DOTDOT@[2953; 2955) ".."
1660 R_PAREN@[2955; 2956) ")" 1661 R_PAREN@[2955; 2956) ")"
1661 COLON@[2956; 2957) ":" 1662 COLON@[2956; 2957) ":"
1662 TUPLE_TYPE@[2957; 2962) 1663 TUPLE_TYPE@[2957; 2962)