diff options
288 files changed, 3920 insertions, 5418 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 02a3b6228..00f299ff1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml | |||
@@ -20,25 +20,14 @@ jobs: | |||
20 | name: Audit Rust vulnerabilities | 20 | name: Audit Rust vulnerabilities |
21 | runs-on: ubuntu-latest | 21 | runs-on: ubuntu-latest |
22 | steps: | 22 | steps: |
23 | - name: Install Rust toolchain | ||
24 | uses: actions-rs/toolchain@v1 | ||
25 | with: | ||
26 | toolchain: stable | ||
27 | profile: minimal | ||
28 | override: true | ||
29 | |||
30 | - name: Checkout repository | 23 | - name: Checkout repository |
31 | uses: actions/checkout@v2 | 24 | uses: actions/checkout@v2 |
32 | 25 | ||
33 | - run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/ | 26 | - uses: actions-rs/[email protected] |
34 | |||
35 | - name: Cache cargo | ||
36 | uses: actions/cache@v1 | ||
37 | with: | 27 | with: |
38 | path: ~/.cargo/ | 28 | crate: cargo-audit |
39 | key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | 29 | use-tool-cache: true |
40 | 30 | ||
41 | - run: cargo install cargo-audit | ||
42 | - run: cargo audit | 31 | - run: cargo audit |
43 | 32 | ||
44 | rust: | 33 | rust: |
diff --git a/Cargo.lock b/Cargo.lock index 34f05e83a..975c1aef8 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -425,6 +425,17 @@ dependencies = [ | |||
425 | ] | 425 | ] |
426 | 426 | ||
427 | [[package]] | 427 | [[package]] |
428 | name = "goblin" | ||
429 | version = "0.2.1" | ||
430 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
431 | checksum = "ddd5e3132801a1ac34ac53b97acde50c4685414dd2f291b9ea52afa6f07468c8" | ||
432 | dependencies = [ | ||
433 | "log", | ||
434 | "plain", | ||
435 | "scroll", | ||
436 | ] | ||
437 | |||
438 | [[package]] | ||
428 | name = "heck" | 439 | name = "heck" |
429 | version = "0.3.1" | 440 | version = "0.3.1" |
430 | source = "registry+https://github.com/rust-lang/crates.io-index" | 441 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -587,6 +598,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
587 | checksum = "dea0c0405123bba743ee3f91f49b1c7cfb684eef0da0a50110f758ccf24cdff0" | 598 | checksum = "dea0c0405123bba743ee3f91f49b1c7cfb684eef0da0a50110f758ccf24cdff0" |
588 | 599 | ||
589 | [[package]] | 600 | [[package]] |
601 | name = "libloading" | ||
602 | version = "0.6.0" | ||
603 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
604 | checksum = "2c979a19ffb457f0273965c333053f3d586bf759bf7b683fbebc37f9a9ebedc4" | ||
605 | dependencies = [ | ||
606 | "winapi 0.3.8", | ||
607 | ] | ||
608 | |||
609 | [[package]] | ||
590 | name = "linked-hash-map" | 610 | name = "linked-hash-map" |
591 | version = "0.5.2" | 611 | version = "0.5.2" |
592 | source = "registry+https://github.com/rust-lang/crates.io-index" | 612 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -594,9 +614,9 @@ checksum = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" | |||
594 | 614 | ||
595 | [[package]] | 615 | [[package]] |
596 | name = "lock_api" | 616 | name = "lock_api" |
597 | version = "0.3.3" | 617 | version = "0.3.4" |
598 | source = "registry+https://github.com/rust-lang/crates.io-index" | 618 | source = "registry+https://github.com/rust-lang/crates.io-index" |
599 | checksum = "79b2de95ecb4691949fea4716ca53cdbcfccb2c612e19644a8bad05edcf9f47b" | 619 | checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" |
600 | dependencies = [ | 620 | dependencies = [ |
601 | "scopeguard", | 621 | "scopeguard", |
602 | ] | 622 | ] |
@@ -759,9 +779,9 @@ checksum = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" | |||
759 | 779 | ||
760 | [[package]] | 780 | [[package]] |
761 | name = "parking_lot" | 781 | name = "parking_lot" |
762 | version = "0.10.0" | 782 | version = "0.10.1" |
763 | source = "registry+https://github.com/rust-lang/crates.io-index" | 783 | source = "registry+https://github.com/rust-lang/crates.io-index" |
764 | checksum = "92e98c49ab0b7ce5b222f2cc9193fc4efe11c6d0bd4f648e374684a6857b1cfc" | 784 | checksum = "6fdfcb5f20930a79e326f7ec992a9fdb5b7bd809254b1e735bdd5a99f78bee0d" |
765 | dependencies = [ | 785 | dependencies = [ |
766 | "lock_api", | 786 | "lock_api", |
767 | "parking_lot_core", | 787 | "parking_lot_core", |
@@ -769,9 +789,9 @@ dependencies = [ | |||
769 | 789 | ||
770 | [[package]] | 790 | [[package]] |
771 | name = "parking_lot_core" | 791 | name = "parking_lot_core" |
772 | version = "0.7.0" | 792 | version = "0.7.1" |
773 | source = "registry+https://github.com/rust-lang/crates.io-index" | 793 | source = "registry+https://github.com/rust-lang/crates.io-index" |
774 | checksum = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1" | 794 | checksum = "0e136c1904604defe99ce5fd71a28d473fa60a12255d511aa78a9ddf11237aeb" |
775 | dependencies = [ | 795 | dependencies = [ |
776 | "cfg-if", | 796 | "cfg-if", |
777 | "cloudabi", | 797 | "cloudabi", |
@@ -826,6 +846,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
826 | checksum = "3ad1f1b834a05d42dae330066e9699a173b28185b3bdc3dbf14ca239585de8cc" | 846 | checksum = "3ad1f1b834a05d42dae330066e9699a173b28185b3bdc3dbf14ca239585de8cc" |
827 | 847 | ||
828 | [[package]] | 848 | [[package]] |
849 | name = "plain" | ||
850 | version = "0.2.3" | ||
851 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
852 | checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" | ||
853 | |||
854 | [[package]] | ||
829 | name = "ppv-lite86" | 855 | name = "ppv-lite86" |
830 | version = "0.2.6" | 856 | version = "0.2.6" |
831 | source = "registry+https://github.com/rust-lang/crates.io-index" | 857 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -995,6 +1021,7 @@ dependencies = [ | |||
995 | "ra_prof", | 1021 | "ra_prof", |
996 | "ra_syntax", | 1022 | "ra_syntax", |
997 | "rustc-hash", | 1023 | "rustc-hash", |
1024 | "scoped-tls", | ||
998 | "smallvec", | 1025 | "smallvec", |
999 | "stdx", | 1026 | "stdx", |
1000 | "test_utils", | 1027 | "test_utils", |
@@ -1081,10 +1108,13 @@ version = "0.1.0" | |||
1081 | dependencies = [ | 1108 | dependencies = [ |
1082 | "cargo_metadata", | 1109 | "cargo_metadata", |
1083 | "difference", | 1110 | "difference", |
1111 | "goblin", | ||
1112 | "libloading", | ||
1084 | "ra_mbe", | 1113 | "ra_mbe", |
1085 | "ra_proc_macro", | 1114 | "ra_proc_macro", |
1086 | "ra_tt", | 1115 | "ra_tt", |
1087 | "serde_derive", | 1116 | "serde_derive", |
1117 | "test_utils", | ||
1088 | ] | 1118 | ] |
1089 | 1119 | ||
1090 | [[package]] | 1120 | [[package]] |
@@ -1391,12 +1421,38 @@ dependencies = [ | |||
1391 | ] | 1421 | ] |
1392 | 1422 | ||
1393 | [[package]] | 1423 | [[package]] |
1424 | name = "scoped-tls" | ||
1425 | version = "1.0.0" | ||
1426 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1427 | checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" | ||
1428 | |||
1429 | [[package]] | ||
1394 | name = "scopeguard" | 1430 | name = "scopeguard" |
1395 | version = "1.1.0" | 1431 | version = "1.1.0" |
1396 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1432 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1397 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" | 1433 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" |
1398 | 1434 | ||
1399 | [[package]] | 1435 | [[package]] |
1436 | name = "scroll" | ||
1437 | version = "0.10.1" | ||
1438 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1439 | checksum = "abb2332cb595d33f7edd5700f4cbf94892e680c7f0ae56adab58a35190b66cb1" | ||
1440 | dependencies = [ | ||
1441 | "scroll_derive", | ||
1442 | ] | ||
1443 | |||
1444 | [[package]] | ||
1445 | name = "scroll_derive" | ||
1446 | version = "0.10.1" | ||
1447 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1448 | checksum = "f8584eea9b9ff42825b46faf46a8c24d2cff13ec152fa2a50df788b87c07ee28" | ||
1449 | dependencies = [ | ||
1450 | "proc-macro2", | ||
1451 | "quote", | ||
1452 | "syn", | ||
1453 | ] | ||
1454 | |||
1455 | [[package]] | ||
1400 | name = "semver" | 1456 | name = "semver" |
1401 | version = "0.9.0" | 1457 | version = "0.9.0" |
1402 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1458 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1474,9 +1530,9 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" | |||
1474 | 1530 | ||
1475 | [[package]] | 1531 | [[package]] |
1476 | name = "smallvec" | 1532 | name = "smallvec" |
1477 | version = "1.2.0" | 1533 | version = "1.3.0" |
1478 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1534 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1479 | checksum = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc" | 1535 | checksum = "05720e22615919e4734f6a99ceae50d00226c3c5aca406e102ebc33298214e0a" |
1480 | 1536 | ||
1481 | [[package]] | 1537 | [[package]] |
1482 | name = "smol_str" | 1538 | name = "smol_str" |
@@ -1524,9 +1580,9 @@ dependencies = [ | |||
1524 | 1580 | ||
1525 | [[package]] | 1581 | [[package]] |
1526 | name = "termios" | 1582 | name = "termios" |
1527 | version = "0.3.1" | 1583 | version = "0.3.2" |
1528 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1584 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1529 | checksum = "72b620c5ea021d75a735c943269bb07d30c9b77d6ac6b236bc8b5c496ef05625" | 1585 | checksum = "6f0fcee7b24a25675de40d5bb4de6e41b0df07bc9856295e7e2b3a3600c400c2" |
1530 | dependencies = [ | 1586 | dependencies = [ |
1531 | "libc", | 1587 | "libc", |
1532 | ] | 1588 | ] |
diff --git a/crates/ra_assists/src/doc_tests/generated.rs b/crates/ra_assists/src/doc_tests/generated.rs index 64444ee3a..b63b4d81a 100644 --- a/crates/ra_assists/src/doc_tests/generated.rs +++ b/crates/ra_assists/src/doc_tests/generated.rs | |||
@@ -180,7 +180,7 @@ trait Trait<T> { | |||
180 | } | 180 | } |
181 | 181 | ||
182 | impl Trait<u32> for () { | 182 | impl Trait<u32> for () { |
183 | fn foo(&self) -> u32 { unimplemented!() } | 183 | fn foo(&self) -> u32 { todo!() } |
184 | 184 | ||
185 | } | 185 | } |
186 | "#####, | 186 | "#####, |
@@ -607,6 +607,21 @@ impl Walrus { | |||
607 | } | 607 | } |
608 | 608 | ||
609 | #[test] | 609 | #[test] |
610 | fn doctest_reorder_fields() { | ||
611 | check( | ||
612 | "reorder_fields", | ||
613 | r#####" | ||
614 | struct Foo {foo: i32, bar: i32}; | ||
615 | const test: Foo = <|>Foo {bar: 0, foo: 1} | ||
616 | "#####, | ||
617 | r#####" | ||
618 | struct Foo {foo: i32, bar: i32}; | ||
619 | const test: Foo = Foo {foo: 1, bar: 0} | ||
620 | "#####, | ||
621 | ) | ||
622 | } | ||
623 | |||
624 | #[test] | ||
610 | fn doctest_replace_if_let_with_match() { | 625 | fn doctest_replace_if_let_with_match() { |
611 | check( | 626 | check( |
612 | "replace_if_let_with_match", | 627 | "replace_if_let_with_match", |
diff --git a/crates/ra_assists/src/handlers/add_impl.rs b/crates/ra_assists/src/handlers/add_impl.rs index 72a201b6d..6622eadb2 100644 --- a/crates/ra_assists/src/handlers/add_impl.rs +++ b/crates/ra_assists/src/handlers/add_impl.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use ra_syntax::{ | 1 | use ra_syntax::{ |
2 | ast::{self, AstNode, AstToken, NameOwner, TypeParamsOwner}, | 2 | ast::{self, AstNode, NameOwner, TypeParamsOwner}, |
3 | TextUnit, | 3 | TextUnit, |
4 | }; | 4 | }; |
5 | use stdx::{format_to, SepBy}; | 5 | use stdx::{format_to, SepBy}; |
@@ -42,7 +42,7 @@ pub(crate) fn add_impl(ctx: AssistCtx) -> Option<Assist> { | |||
42 | if let Some(type_params) = type_params { | 42 | if let Some(type_params) = type_params { |
43 | let lifetime_params = type_params | 43 | let lifetime_params = type_params |
44 | .lifetime_params() | 44 | .lifetime_params() |
45 | .filter_map(|it| it.lifetime()) | 45 | .filter_map(|it| it.lifetime_token()) |
46 | .map(|it| it.text().clone()); | 46 | .map(|it| it.text().clone()); |
47 | let type_params = | 47 | let type_params = |
48 | type_params.type_params().filter_map(|it| it.name()).map(|it| it.text().clone()); | 48 | type_params.type_params().filter_map(|it| it.name()).map(|it| it.text().clone()); |
diff --git a/crates/ra_assists/src/handlers/add_missing_impl_members.rs b/crates/ra_assists/src/handlers/add_missing_impl_members.rs index 722f207e2..2d6d44980 100644 --- a/crates/ra_assists/src/handlers/add_missing_impl_members.rs +++ b/crates/ra_assists/src/handlers/add_missing_impl_members.rs | |||
@@ -40,7 +40,7 @@ enum AddMissingImplMembersMode { | |||
40 | // } | 40 | // } |
41 | // | 41 | // |
42 | // impl Trait<u32> for () { | 42 | // impl Trait<u32> for () { |
43 | // fn foo(&self) -> u32 { unimplemented!() } | 43 | // fn foo(&self) -> u32 { todo!() } |
44 | // | 44 | // |
45 | // } | 45 | // } |
46 | // ``` | 46 | // ``` |
@@ -165,7 +165,7 @@ fn add_missing_impl_members_inner( | |||
165 | 165 | ||
166 | fn add_body(fn_def: ast::FnDef) -> ast::FnDef { | 166 | fn add_body(fn_def: ast::FnDef) -> ast::FnDef { |
167 | if fn_def.body().is_none() { | 167 | if fn_def.body().is_none() { |
168 | fn_def.with_body(make::block_from_expr(make::expr_unimplemented())) | 168 | fn_def.with_body(make::block_from_expr(make::expr_todo())) |
169 | } else { | 169 | } else { |
170 | fn_def | 170 | fn_def |
171 | } | 171 | } |
@@ -215,8 +215,8 @@ impl Foo for S { | |||
215 | fn bar(&self) {} | 215 | fn bar(&self) {} |
216 | <|>type Output; | 216 | <|>type Output; |
217 | const CONST: usize = 42; | 217 | const CONST: usize = 42; |
218 | fn foo(&self) { unimplemented!() } | 218 | fn foo(&self) { todo!() } |
219 | fn baz(&self) { unimplemented!() } | 219 | fn baz(&self) { todo!() } |
220 | 220 | ||
221 | }", | 221 | }", |
222 | ); | 222 | ); |
@@ -250,7 +250,7 @@ struct S; | |||
250 | 250 | ||
251 | impl Foo for S { | 251 | impl Foo for S { |
252 | fn bar(&self) {} | 252 | fn bar(&self) {} |
253 | <|>fn foo(&self) { unimplemented!() } | 253 | <|>fn foo(&self) { todo!() } |
254 | 254 | ||
255 | }", | 255 | }", |
256 | ); | 256 | ); |
@@ -268,7 +268,7 @@ impl Foo for S { <|> }", | |||
268 | trait Foo { fn foo(&self); } | 268 | trait Foo { fn foo(&self); } |
269 | struct S; | 269 | struct S; |
270 | impl Foo for S { | 270 | impl Foo for S { |
271 | <|>fn foo(&self) { unimplemented!() } | 271 | <|>fn foo(&self) { todo!() } |
272 | }", | 272 | }", |
273 | ); | 273 | ); |
274 | } | 274 | } |
@@ -285,7 +285,7 @@ impl Foo<u32> for S { <|> }", | |||
285 | trait Foo<T> { fn foo(&self, t: T) -> &T; } | 285 | trait Foo<T> { fn foo(&self, t: T) -> &T; } |
286 | struct S; | 286 | struct S; |
287 | impl Foo<u32> for S { | 287 | impl Foo<u32> for S { |
288 | <|>fn foo(&self, t: u32) -> &u32 { unimplemented!() } | 288 | <|>fn foo(&self, t: u32) -> &u32 { todo!() } |
289 | }", | 289 | }", |
290 | ); | 290 | ); |
291 | } | 291 | } |
@@ -302,7 +302,7 @@ impl<U> Foo<U> for S { <|> }", | |||
302 | trait Foo<T> { fn foo(&self, t: T) -> &T; } | 302 | trait Foo<T> { fn foo(&self, t: T) -> &T; } |
303 | struct S; | 303 | struct S; |
304 | impl<U> Foo<U> for S { | 304 | impl<U> Foo<U> for S { |
305 | <|>fn foo(&self, t: U) -> &U { unimplemented!() } | 305 | <|>fn foo(&self, t: U) -> &U { todo!() } |
306 | }", | 306 | }", |
307 | ); | 307 | ); |
308 | } | 308 | } |
@@ -319,7 +319,7 @@ impl Foo for S {}<|>", | |||
319 | trait Foo { fn foo(&self); } | 319 | trait Foo { fn foo(&self); } |
320 | struct S; | 320 | struct S; |
321 | impl Foo for S { | 321 | impl Foo for S { |
322 | <|>fn foo(&self) { unimplemented!() } | 322 | <|>fn foo(&self) { todo!() } |
323 | }", | 323 | }", |
324 | ) | 324 | ) |
325 | } | 325 | } |
@@ -342,7 +342,7 @@ mod foo { | |||
342 | } | 342 | } |
343 | struct S; | 343 | struct S; |
344 | impl foo::Foo for S { | 344 | impl foo::Foo for S { |
345 | <|>fn foo(&self, bar: foo::Bar) { unimplemented!() } | 345 | <|>fn foo(&self, bar: foo::Bar) { todo!() } |
346 | }", | 346 | }", |
347 | ); | 347 | ); |
348 | } | 348 | } |
@@ -365,7 +365,7 @@ mod foo { | |||
365 | } | 365 | } |
366 | struct S; | 366 | struct S; |
367 | impl foo::Foo for S { | 367 | impl foo::Foo for S { |
368 | <|>fn foo(&self, bar: foo::Bar<u32>) { unimplemented!() } | 368 | <|>fn foo(&self, bar: foo::Bar<u32>) { todo!() } |
369 | }", | 369 | }", |
370 | ); | 370 | ); |
371 | } | 371 | } |
@@ -388,7 +388,7 @@ mod foo { | |||
388 | } | 388 | } |
389 | struct S; | 389 | struct S; |
390 | impl foo::Foo<u32> for S { | 390 | impl foo::Foo<u32> for S { |
391 | <|>fn foo(&self, bar: foo::Bar<u32>) { unimplemented!() } | 391 | <|>fn foo(&self, bar: foo::Bar<u32>) { todo!() } |
392 | }", | 392 | }", |
393 | ); | 393 | ); |
394 | } | 394 | } |
@@ -414,7 +414,7 @@ mod foo { | |||
414 | struct Param; | 414 | struct Param; |
415 | struct S; | 415 | struct S; |
416 | impl foo::Foo<Param> for S { | 416 | impl foo::Foo<Param> for S { |
417 | <|>fn foo(&self, bar: Param) { unimplemented!() } | 417 | <|>fn foo(&self, bar: Param) { todo!() } |
418 | }", | 418 | }", |
419 | ); | 419 | ); |
420 | } | 420 | } |
@@ -439,7 +439,7 @@ mod foo { | |||
439 | } | 439 | } |
440 | struct S; | 440 | struct S; |
441 | impl foo::Foo for S { | 441 | impl foo::Foo for S { |
442 | <|>fn foo(&self, bar: foo::Bar<u32>::Assoc) { unimplemented!() } | 442 | <|>fn foo(&self, bar: foo::Bar<u32>::Assoc) { todo!() } |
443 | }", | 443 | }", |
444 | ); | 444 | ); |
445 | } | 445 | } |
@@ -464,7 +464,7 @@ mod foo { | |||
464 | } | 464 | } |
465 | struct S; | 465 | struct S; |
466 | impl foo::Foo for S { | 466 | impl foo::Foo for S { |
467 | <|>fn foo(&self, bar: foo::Bar<foo::Baz>) { unimplemented!() } | 467 | <|>fn foo(&self, bar: foo::Bar<foo::Baz>) { todo!() } |
468 | }", | 468 | }", |
469 | ); | 469 | ); |
470 | } | 470 | } |
@@ -487,7 +487,7 @@ mod foo { | |||
487 | } | 487 | } |
488 | struct S; | 488 | struct S; |
489 | impl foo::Foo for S { | 489 | impl foo::Foo for S { |
490 | <|>fn foo(&self, bar: dyn Fn(u32) -> i32) { unimplemented!() } | 490 | <|>fn foo(&self, bar: dyn Fn(u32) -> i32) { todo!() } |
491 | }", | 491 | }", |
492 | ); | 492 | ); |
493 | } | 493 | } |
@@ -544,7 +544,7 @@ trait Foo { | |||
544 | struct S; | 544 | struct S; |
545 | impl Foo for S { | 545 | impl Foo for S { |
546 | <|>type Output; | 546 | <|>type Output; |
547 | fn foo(&self) { unimplemented!() } | 547 | fn foo(&self) { todo!() } |
548 | }"#, | 548 | }"#, |
549 | ) | 549 | ) |
550 | } | 550 | } |
diff --git a/crates/ra_assists/src/handlers/add_new.rs b/crates/ra_assists/src/handlers/add_new.rs index c10397249..240b19fa3 100644 --- a/crates/ra_assists/src/handlers/add_new.rs +++ b/crates/ra_assists/src/handlers/add_new.rs | |||
@@ -1,8 +1,7 @@ | |||
1 | use hir::Adt; | 1 | use hir::Adt; |
2 | use ra_syntax::{ | 2 | use ra_syntax::{ |
3 | ast::{ | 3 | ast::{ |
4 | self, AstNode, AstToken, NameOwner, StructKind, TypeAscriptionOwner, TypeParamsOwner, | 4 | self, AstNode, NameOwner, StructKind, TypeAscriptionOwner, TypeParamsOwner, VisibilityOwner, |
5 | VisibilityOwner, | ||
6 | }, | 5 | }, |
7 | TextUnit, T, | 6 | TextUnit, T, |
8 | }; | 7 | }; |
@@ -106,7 +105,7 @@ fn generate_impl_text(strukt: &ast::StructDef, code: &str) -> String { | |||
106 | if let Some(type_params) = type_params { | 105 | if let Some(type_params) = type_params { |
107 | let lifetime_params = type_params | 106 | let lifetime_params = type_params |
108 | .lifetime_params() | 107 | .lifetime_params() |
109 | .filter_map(|it| it.lifetime()) | 108 | .filter_map(|it| it.lifetime_token()) |
110 | .map(|it| it.text().clone()); | 109 | .map(|it| it.text().clone()); |
111 | let type_params = | 110 | let type_params = |
112 | type_params.type_params().filter_map(|it| it.name()).map(|it| it.text().clone()); | 111 | type_params.type_params().filter_map(|it| it.name()).map(|it| it.text().clone()); |
diff --git a/crates/ra_assists/src/handlers/inline_local_variable.rs b/crates/ra_assists/src/handlers/inline_local_variable.rs index 3bfcba8ff..c4fb425b0 100644 --- a/crates/ra_assists/src/handlers/inline_local_variable.rs +++ b/crates/ra_assists/src/handlers/inline_local_variable.rs | |||
@@ -29,7 +29,7 @@ pub(crate) fn inline_local_variable(ctx: AssistCtx) -> Option<Assist> { | |||
29 | ast::Pat::BindPat(pat) => pat, | 29 | ast::Pat::BindPat(pat) => pat, |
30 | _ => return None, | 30 | _ => return None, |
31 | }; | 31 | }; |
32 | if bind_pat.is_mutable() { | 32 | if bind_pat.mut_token().is_some() { |
33 | tested_by!(test_not_inline_mut_variable); | 33 | tested_by!(test_not_inline_mut_variable); |
34 | return None; | 34 | return None; |
35 | } | 35 | } |
diff --git a/crates/ra_assists/src/handlers/introduce_variable.rs b/crates/ra_assists/src/handlers/introduce_variable.rs index 8a02f1a32..8d0f7e922 100644 --- a/crates/ra_assists/src/handlers/introduce_variable.rs +++ b/crates/ra_assists/src/handlers/introduce_variable.rs | |||
@@ -61,7 +61,7 @@ pub(crate) fn introduce_variable(ctx: AssistCtx) -> Option<Assist> { | |||
61 | }; | 61 | }; |
62 | if is_full_stmt { | 62 | if is_full_stmt { |
63 | tested_by!(test_introduce_var_expr_stmt); | 63 | tested_by!(test_introduce_var_expr_stmt); |
64 | if !full_stmt.unwrap().has_semi() { | 64 | if full_stmt.unwrap().semicolon_token().is_none() { |
65 | buf.push_str(";"); | 65 | buf.push_str(";"); |
66 | } | 66 | } |
67 | edit.replace(expr.syntax().text_range(), buf); | 67 | edit.replace(expr.syntax().text_range(), buf); |
diff --git a/crates/ra_assists/src/handlers/merge_imports.rs b/crates/ra_assists/src/handlers/merge_imports.rs index f8b3ddb4e..0958f52f1 100644 --- a/crates/ra_assists/src/handlers/merge_imports.rs +++ b/crates/ra_assists/src/handlers/merge_imports.rs | |||
@@ -3,7 +3,7 @@ use std::iter::successors; | |||
3 | use ra_syntax::{ | 3 | use ra_syntax::{ |
4 | algo::{neighbor, SyntaxRewriter}, | 4 | algo::{neighbor, SyntaxRewriter}, |
5 | ast::{self, edit::AstNodeEdit, make}, | 5 | ast::{self, edit::AstNodeEdit, make}, |
6 | AstNode, AstToken, Direction, InsertPosition, SyntaxElement, T, | 6 | AstNode, Direction, InsertPosition, SyntaxElement, T, |
7 | }; | 7 | }; |
8 | 8 | ||
9 | use crate::{Assist, AssistCtx, AssistId}; | 9 | use crate::{Assist, AssistCtx, AssistId}; |
@@ -82,7 +82,7 @@ fn try_merge_trees(old: &ast::UseTree, new: &ast::UseTree) -> Option<ast::UseTre | |||
82 | .filter(|it| it.kind() != T!['{'] && it.kind() != T!['}']), | 82 | .filter(|it| it.kind() != T!['{'] && it.kind() != T!['}']), |
83 | ); | 83 | ); |
84 | let use_tree_list = lhs.use_tree_list()?; | 84 | let use_tree_list = lhs.use_tree_list()?; |
85 | let pos = InsertPosition::Before(use_tree_list.r_curly()?.syntax().clone().into()); | 85 | let pos = InsertPosition::Before(use_tree_list.r_curly_token()?.into()); |
86 | let use_tree_list = use_tree_list.insert_children(pos, to_insert); | 86 | let use_tree_list = use_tree_list.insert_children(pos, to_insert); |
87 | Some(lhs.with_use_tree_list(use_tree_list)) | 87 | Some(lhs.with_use_tree_list(use_tree_list)) |
88 | } | 88 | } |
diff --git a/crates/ra_assists/src/handlers/move_bounds.rs b/crates/ra_assists/src/handlers/move_bounds.rs index 93f26f51a..0f26884dc 100644 --- a/crates/ra_assists/src/handlers/move_bounds.rs +++ b/crates/ra_assists/src/handlers/move_bounds.rs | |||
@@ -2,6 +2,7 @@ use ra_syntax::{ | |||
2 | ast::{self, edit::AstNodeEdit, make, AstNode, NameOwner, TypeBoundsOwner}, | 2 | ast::{self, edit::AstNodeEdit, make, AstNode, NameOwner, TypeBoundsOwner}, |
3 | match_ast, | 3 | match_ast, |
4 | SyntaxKind::*, | 4 | SyntaxKind::*, |
5 | T, | ||
5 | }; | 6 | }; |
6 | 7 | ||
7 | use crate::{Assist, AssistCtx, AssistId}; | 8 | use crate::{Assist, AssistCtx, AssistId}; |
@@ -42,7 +43,7 @@ pub(crate) fn move_bounds_to_where_clause(ctx: AssistCtx) -> Option<Assist> { | |||
42 | ast::EnumDef(it) => it.variant_list()?.syntax().clone().into(), | 43 | ast::EnumDef(it) => it.variant_list()?.syntax().clone().into(), |
43 | ast::StructDef(it) => { | 44 | ast::StructDef(it) => { |
44 | it.syntax().children_with_tokens() | 45 | it.syntax().children_with_tokens() |
45 | .find(|it| it.kind() == RECORD_FIELD_DEF_LIST || it.kind() == SEMI)? | 46 | .find(|it| it.kind() == RECORD_FIELD_DEF_LIST || it.kind() == T![;])? |
46 | }, | 47 | }, |
47 | _ => return None | 48 | _ => return None |
48 | } | 49 | } |
diff --git a/crates/ra_assists/src/handlers/reorder_fields.rs b/crates/ra_assists/src/handlers/reorder_fields.rs new file mode 100644 index 000000000..692dd1315 --- /dev/null +++ b/crates/ra_assists/src/handlers/reorder_fields.rs | |||
@@ -0,0 +1,230 @@ | |||
1 | use std::collections::HashMap; | ||
2 | |||
3 | use itertools::Itertools; | ||
4 | |||
5 | use hir::{Adt, ModuleDef, PathResolution, Semantics, Struct}; | ||
6 | use ra_ide_db::RootDatabase; | ||
7 | use ra_syntax::{ | ||
8 | algo, ast, | ||
9 | ast::{Name, Path, RecordLit, RecordPat}, | ||
10 | AstNode, SyntaxKind, SyntaxNode, | ||
11 | }; | ||
12 | |||
13 | use crate::{ | ||
14 | assist_ctx::{Assist, AssistCtx}, | ||
15 | AssistId, | ||
16 | }; | ||
17 | use ra_syntax::ast::{Expr, NameRef}; | ||
18 | |||
19 | // Assist: reorder_fields | ||
20 | // | ||
21 | // Reorder the fields of record literals and record patterns in the same order as in | ||
22 | // the definition. | ||
23 | // | ||
24 | // ``` | ||
25 | // struct Foo {foo: i32, bar: i32}; | ||
26 | // const test: Foo = <|>Foo {bar: 0, foo: 1} | ||
27 | // ``` | ||
28 | // -> | ||
29 | // ``` | ||
30 | // struct Foo {foo: i32, bar: i32}; | ||
31 | // const test: Foo = Foo {foo: 1, bar: 0} | ||
32 | // ``` | ||
33 | // | ||
34 | pub(crate) fn reorder_fields(ctx: AssistCtx) -> Option<Assist> { | ||
35 | reorder::<RecordLit>(ctx.clone()).or_else(|| reorder::<RecordPat>(ctx)) | ||
36 | } | ||
37 | |||
38 | fn reorder<R: AstNode>(ctx: AssistCtx) -> Option<Assist> { | ||
39 | let record = ctx.find_node_at_offset::<R>()?; | ||
40 | let path = record.syntax().children().find_map(Path::cast)?; | ||
41 | |||
42 | let ranks = compute_fields_ranks(&path, &ctx)?; | ||
43 | |||
44 | let fields = get_fields(&record.syntax()); | ||
45 | let sorted_fields = sorted_by_rank(&fields, |node| { | ||
46 | *ranks.get(&get_field_name(node)).unwrap_or(&usize::max_value()) | ||
47 | }); | ||
48 | |||
49 | if sorted_fields == fields { | ||
50 | return None; | ||
51 | } | ||
52 | |||
53 | ctx.add_assist(AssistId("reorder_fields"), "Reorder record fields", |edit| { | ||
54 | for (old, new) in fields.iter().zip(&sorted_fields) { | ||
55 | algo::diff(old, new).into_text_edit(edit.text_edit_builder()); | ||
56 | } | ||
57 | edit.target(record.syntax().text_range()) | ||
58 | }) | ||
59 | } | ||
60 | |||
61 | fn get_fields_kind(node: &SyntaxNode) -> Vec<SyntaxKind> { | ||
62 | use SyntaxKind::*; | ||
63 | match node.kind() { | ||
64 | RECORD_LIT => vec![RECORD_FIELD], | ||
65 | RECORD_PAT => vec![RECORD_FIELD_PAT, BIND_PAT], | ||
66 | _ => vec![], | ||
67 | } | ||
68 | } | ||
69 | |||
70 | fn get_field_name(node: &SyntaxNode) -> String { | ||
71 | use SyntaxKind::*; | ||
72 | match node.kind() { | ||
73 | RECORD_FIELD => { | ||
74 | if let Some(name) = node.children().find_map(NameRef::cast) { | ||
75 | return name.to_string(); | ||
76 | } | ||
77 | node.children().find_map(Expr::cast).map(|expr| expr.to_string()).unwrap_or_default() | ||
78 | } | ||
79 | BIND_PAT | RECORD_FIELD_PAT => { | ||
80 | node.children().find_map(Name::cast).map(|n| n.to_string()).unwrap_or_default() | ||
81 | } | ||
82 | _ => String::new(), | ||
83 | } | ||
84 | } | ||
85 | |||
86 | fn get_fields(record: &SyntaxNode) -> Vec<SyntaxNode> { | ||
87 | let kinds = get_fields_kind(record); | ||
88 | record.children().flat_map(|n| n.children()).filter(|n| kinds.contains(&n.kind())).collect() | ||
89 | } | ||
90 | |||
91 | fn sorted_by_rank( | ||
92 | fields: &[SyntaxNode], | ||
93 | get_rank: impl Fn(&SyntaxNode) -> usize, | ||
94 | ) -> Vec<SyntaxNode> { | ||
95 | fields.iter().cloned().sorted_by_key(get_rank).collect() | ||
96 | } | ||
97 | |||
98 | fn struct_definition(path: &ast::Path, sema: &Semantics<RootDatabase>) -> Option<Struct> { | ||
99 | match sema.resolve_path(path) { | ||
100 | Some(PathResolution::Def(ModuleDef::Adt(Adt::Struct(s)))) => Some(s), | ||
101 | _ => None, | ||
102 | } | ||
103 | } | ||
104 | |||
105 | fn compute_fields_ranks(path: &Path, ctx: &AssistCtx) -> Option<HashMap<String, usize>> { | ||
106 | Some( | ||
107 | struct_definition(path, ctx.sema)? | ||
108 | .fields(ctx.db) | ||
109 | .iter() | ||
110 | .enumerate() | ||
111 | .map(|(idx, field)| (field.name(ctx.db).to_string(), idx)) | ||
112 | .collect(), | ||
113 | ) | ||
114 | } | ||
115 | |||
116 | #[cfg(test)] | ||
117 | mod tests { | ||
118 | use crate::helpers::{check_assist, check_assist_not_applicable}; | ||
119 | |||
120 | use super::*; | ||
121 | |||
122 | #[test] | ||
123 | fn not_applicable_if_sorted() { | ||
124 | check_assist_not_applicable( | ||
125 | reorder_fields, | ||
126 | r#" | ||
127 | struct Foo { | ||
128 | foo: i32, | ||
129 | bar: i32, | ||
130 | } | ||
131 | |||
132 | const test: Foo = <|>Foo { foo: 0, bar: 0 }; | ||
133 | "#, | ||
134 | ) | ||
135 | } | ||
136 | |||
137 | #[test] | ||
138 | fn trivial_empty_fields() { | ||
139 | check_assist_not_applicable( | ||
140 | reorder_fields, | ||
141 | r#" | ||
142 | struct Foo {}; | ||
143 | const test: Foo = <|>Foo {} | ||
144 | "#, | ||
145 | ) | ||
146 | } | ||
147 | |||
148 | #[test] | ||
149 | fn reorder_struct_fields() { | ||
150 | check_assist( | ||
151 | reorder_fields, | ||
152 | r#" | ||
153 | struct Foo {foo: i32, bar: i32}; | ||
154 | const test: Foo = <|>Foo {bar: 0, foo: 1} | ||
155 | "#, | ||
156 | r#" | ||
157 | struct Foo {foo: i32, bar: i32}; | ||
158 | const test: Foo = <|>Foo {foo: 1, bar: 0} | ||
159 | "#, | ||
160 | ) | ||
161 | } | ||
162 | |||
163 | #[test] | ||
164 | fn reorder_struct_pattern() { | ||
165 | check_assist( | ||
166 | reorder_fields, | ||
167 | r#" | ||
168 | struct Foo { foo: i64, bar: i64, baz: i64 } | ||
169 | |||
170 | fn f(f: Foo) -> { | ||
171 | match f { | ||
172 | <|>Foo { baz: 0, ref mut bar, .. } => (), | ||
173 | _ => () | ||
174 | } | ||
175 | } | ||
176 | "#, | ||
177 | r#" | ||
178 | struct Foo { foo: i64, bar: i64, baz: i64 } | ||
179 | |||
180 | fn f(f: Foo) -> { | ||
181 | match f { | ||
182 | <|>Foo { ref mut bar, baz: 0, .. } => (), | ||
183 | _ => () | ||
184 | } | ||
185 | } | ||
186 | "#, | ||
187 | ) | ||
188 | } | ||
189 | |||
190 | #[test] | ||
191 | fn reorder_with_extra_field() { | ||
192 | check_assist( | ||
193 | reorder_fields, | ||
194 | r#" | ||
195 | struct Foo { | ||
196 | foo: String, | ||
197 | bar: String, | ||
198 | } | ||
199 | |||
200 | impl Foo { | ||
201 | fn new() -> Foo { | ||
202 | let foo = String::new(); | ||
203 | <|>Foo { | ||
204 | bar: foo.clone(), | ||
205 | extra: "Extra field", | ||
206 | foo, | ||
207 | } | ||
208 | } | ||
209 | } | ||
210 | "#, | ||
211 | r#" | ||
212 | struct Foo { | ||
213 | foo: String, | ||
214 | bar: String, | ||
215 | } | ||
216 | |||
217 | impl Foo { | ||
218 | fn new() -> Foo { | ||
219 | let foo = String::new(); | ||
220 | <|>Foo { | ||
221 | foo, | ||
222 | bar: foo.clone(), | ||
223 | extra: "Extra field", | ||
224 | } | ||
225 | } | ||
226 | } | ||
227 | "#, | ||
228 | ) | ||
229 | } | ||
230 | } | ||
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs index 5ba5254fd..a00136da1 100644 --- a/crates/ra_assists/src/lib.rs +++ b/crates/ra_assists/src/lib.rs | |||
@@ -129,6 +129,7 @@ mod handlers { | |||
129 | mod replace_unwrap_with_match; | 129 | mod replace_unwrap_with_match; |
130 | mod split_import; | 130 | mod split_import; |
131 | mod add_from_impl_for_enum; | 131 | mod add_from_impl_for_enum; |
132 | mod reorder_fields; | ||
132 | 133 | ||
133 | pub(crate) fn all() -> &'static [AssistHandler] { | 134 | pub(crate) fn all() -> &'static [AssistHandler] { |
134 | &[ | 135 | &[ |
@@ -170,6 +171,7 @@ mod handlers { | |||
170 | // These are manually sorted for better priorities | 171 | // These are manually sorted for better priorities |
171 | add_missing_impl_members::add_missing_impl_members, | 172 | add_missing_impl_members::add_missing_impl_members, |
172 | add_missing_impl_members::add_missing_default_members, | 173 | add_missing_impl_members::add_missing_default_members, |
174 | reorder_fields::reorder_fields, | ||
173 | ] | 175 | ] |
174 | } | 176 | } |
175 | } | 177 | } |
diff --git a/crates/ra_hir/src/source_analyzer.rs b/crates/ra_hir/src/source_analyzer.rs index 45631f8fd..58ae6ce41 100644 --- a/crates/ra_hir/src/source_analyzer.rs +++ b/crates/ra_hir/src/source_analyzer.rs | |||
@@ -139,7 +139,7 @@ impl SourceAnalyzer { | |||
139 | &self, | 139 | &self, |
140 | db: &dyn HirDatabase, | 140 | db: &dyn HirDatabase, |
141 | field: &ast::FieldExpr, | 141 | field: &ast::FieldExpr, |
142 | ) -> Option<crate::StructField> { | 142 | ) -> Option<StructField> { |
143 | let expr_id = self.expr_id(db, &field.clone().into())?; | 143 | let expr_id = self.expr_id(db, &field.clone().into())?; |
144 | self.infer.as_ref()?.field_resolution(expr_id).map(|it| it.into()) | 144 | self.infer.as_ref()?.field_resolution(expr_id).map(|it| it.into()) |
145 | } | 145 | } |
@@ -148,21 +148,19 @@ impl SourceAnalyzer { | |||
148 | &self, | 148 | &self, |
149 | db: &dyn HirDatabase, | 149 | db: &dyn HirDatabase, |
150 | field: &ast::RecordField, | 150 | field: &ast::RecordField, |
151 | ) -> Option<(crate::StructField, Option<Local>)> { | 151 | ) -> Option<(StructField, Option<Local>)> { |
152 | let (expr_id, local) = match field.expr() { | 152 | let expr = field.expr()?; |
153 | Some(it) => (self.expr_id(db, &it)?, None), | 153 | let expr_id = self.expr_id(db, &expr)?; |
154 | None => { | 154 | let local = if field.name_ref().is_some() { |
155 | let src = InFile { file_id: self.file_id, value: field }; | 155 | None |
156 | let expr_id = self.body_source_map.as_ref()?.field_init_shorthand_expr(src)?; | 156 | } else { |
157 | let local_name = field.name_ref()?.as_name(); | 157 | let local_name = field.field_name()?.as_name(); |
158 | let path = ModPath::from_segments(PathKind::Plain, once(local_name)); | 158 | let path = ModPath::from_segments(PathKind::Plain, once(local_name)); |
159 | let local = match self.resolver.resolve_path_in_value_ns_fully(db.upcast(), &path) { | 159 | match self.resolver.resolve_path_in_value_ns_fully(db.upcast(), &path) { |
160 | Some(ValueNs::LocalBinding(pat_id)) => { | 160 | Some(ValueNs::LocalBinding(pat_id)) => { |
161 | Some(Local { pat_id, parent: self.resolver.body_owner()? }) | 161 | Some(Local { pat_id, parent: self.resolver.body_owner()? }) |
162 | } | 162 | } |
163 | _ => None, | 163 | _ => None, |
164 | }; | ||
165 | (expr_id, local) | ||
166 | } | 164 | } |
167 | }; | 165 | }; |
168 | let struct_field = self.infer.as_ref()?.record_field_resolution(expr_id)?; | 166 | let struct_field = self.infer.as_ref()?.record_field_resolution(expr_id)?; |
@@ -255,7 +253,7 @@ impl SourceAnalyzer { | |||
255 | _ => return None, | 253 | _ => return None, |
256 | }; | 254 | }; |
257 | 255 | ||
258 | let (variant, missing_fields) = | 256 | let (variant, missing_fields, _exhaustive) = |
259 | record_pattern_missing_fields(db, infer, pat_id, &body[pat_id])?; | 257 | record_pattern_missing_fields(db, infer, pat_id, &body[pat_id])?; |
260 | let res = self.missing_fields(db, krate, substs, variant, missing_fields); | 258 | let res = self.missing_fields(db, krate, substs, variant, missing_fields); |
261 | Some(res) | 259 | Some(res) |
@@ -319,8 +317,7 @@ fn scope_for_offset( | |||
319 | if source.file_id != offset.file_id { | 317 | if source.file_id != offset.file_id { |
320 | return None; | 318 | return None; |
321 | } | 319 | } |
322 | let syntax_node_ptr = | 320 | let syntax_node_ptr = source.value.syntax_node_ptr(); |
323 | source.value.either(|it| it.syntax_node_ptr(), |it| it.syntax_node_ptr()); | ||
324 | Some((syntax_node_ptr, scope)) | 321 | Some((syntax_node_ptr, scope)) |
325 | }) | 322 | }) |
326 | // find containing scope | 323 | // find containing scope |
@@ -399,8 +396,7 @@ fn adjust( | |||
399 | if source.file_id != file_id { | 396 | if source.file_id != file_id { |
400 | return None; | 397 | return None; |
401 | } | 398 | } |
402 | let syntax_node_ptr = | 399 | let syntax_node_ptr = source.value.syntax_node_ptr(); |
403 | source.value.either(|it| it.syntax_node_ptr(), |it| it.syntax_node_ptr()); | ||
404 | Some((syntax_node_ptr, scope)) | 400 | Some((syntax_node_ptr, scope)) |
405 | }) | 401 | }) |
406 | .map(|(ptr, scope)| (ptr.range(), scope)) | 402 | .map(|(ptr, scope)| (ptr.range(), scope)) |
diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs index be4b0accb..7c0d93691 100644 --- a/crates/ra_hir_def/src/adt.rs +++ b/crates/ra_hir_def/src/adt.rs | |||
@@ -4,7 +4,6 @@ use std::sync::Arc; | |||
4 | 4 | ||
5 | use either::Either; | 5 | use either::Either; |
6 | use hir_expand::{ | 6 | use hir_expand::{ |
7 | hygiene::Hygiene, | ||
8 | name::{AsName, Name}, | 7 | name::{AsName, Name}, |
9 | InFile, | 8 | InFile, |
10 | }; | 9 | }; |
@@ -13,7 +12,7 @@ use ra_prof::profile; | |||
13 | use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner, VisibilityOwner}; | 12 | use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner, VisibilityOwner}; |
14 | 13 | ||
15 | use crate::{ | 14 | use crate::{ |
16 | attr::Attrs, db::DefDatabase, src::HasChildSource, src::HasSource, trace::Trace, | 15 | body::CfgExpander, db::DefDatabase, src::HasChildSource, src::HasSource, trace::Trace, |
17 | type_ref::TypeRef, visibility::RawVisibility, EnumId, HasModule, LocalEnumVariantId, | 16 | type_ref::TypeRef, visibility::RawVisibility, EnumId, HasModule, LocalEnumVariantId, |
18 | LocalStructFieldId, Lookup, ModuleId, StructId, UnionId, VariantId, | 17 | LocalStructFieldId, Lookup, ModuleId, StructId, UnionId, VariantId, |
19 | }; | 18 | }; |
@@ -125,8 +124,9 @@ fn lower_enum( | |||
125 | 124 | ||
126 | impl VariantData { | 125 | impl VariantData { |
127 | fn new(db: &dyn DefDatabase, flavor: InFile<ast::StructKind>, module_id: ModuleId) -> Self { | 126 | fn new(db: &dyn DefDatabase, flavor: InFile<ast::StructKind>, module_id: ModuleId) -> Self { |
127 | let mut expander = CfgExpander::new(db, flavor.file_id, module_id.krate); | ||
128 | let mut trace = Trace::new_for_arena(); | 128 | let mut trace = Trace::new_for_arena(); |
129 | match lower_struct(db, &mut trace, &flavor, module_id) { | 129 | match lower_struct(db, &mut expander, &mut trace, &flavor) { |
130 | StructKind::Tuple => VariantData::Tuple(trace.into_arena()), | 130 | StructKind::Tuple => VariantData::Tuple(trace.into_arena()), |
131 | StructKind::Record => VariantData::Record(trace.into_arena()), | 131 | StructKind::Record => VariantData::Record(trace.into_arena()), |
132 | StructKind::Unit => VariantData::Unit, | 132 | StructKind::Unit => VariantData::Unit, |
@@ -178,8 +178,9 @@ impl HasChildSource for VariantId { | |||
178 | it.lookup(db).container.module(db), | 178 | it.lookup(db).container.module(db), |
179 | ), | 179 | ), |
180 | }; | 180 | }; |
181 | let mut expander = CfgExpander::new(db, src.file_id, module_id.krate); | ||
181 | let mut trace = Trace::new_for_map(); | 182 | let mut trace = Trace::new_for_map(); |
182 | lower_struct(db, &mut trace, &src, module_id); | 183 | lower_struct(db, &mut expander, &mut trace, &src); |
183 | src.with_value(trace.into_map()) | 184 | src.with_value(trace.into_map()) |
184 | } | 185 | } |
185 | } | 186 | } |
@@ -193,16 +194,15 @@ pub enum StructKind { | |||
193 | 194 | ||
194 | fn lower_struct( | 195 | fn lower_struct( |
195 | db: &dyn DefDatabase, | 196 | db: &dyn DefDatabase, |
197 | expander: &mut CfgExpander, | ||
196 | trace: &mut Trace<StructFieldData, Either<ast::TupleFieldDef, ast::RecordFieldDef>>, | 198 | trace: &mut Trace<StructFieldData, Either<ast::TupleFieldDef, ast::RecordFieldDef>>, |
197 | ast: &InFile<ast::StructKind>, | 199 | ast: &InFile<ast::StructKind>, |
198 | module_id: ModuleId, | ||
199 | ) -> StructKind { | 200 | ) -> StructKind { |
200 | let crate_graph = db.crate_graph(); | ||
201 | match &ast.value { | 201 | match &ast.value { |
202 | ast::StructKind::Tuple(fl) => { | 202 | ast::StructKind::Tuple(fl) => { |
203 | for (i, fd) in fl.fields().enumerate() { | 203 | for (i, fd) in fl.fields().enumerate() { |
204 | let attrs = Attrs::new(&fd, &Hygiene::new(db.upcast(), ast.file_id)); | 204 | let attrs = expander.parse_attrs(&fd); |
205 | if !attrs.is_cfg_enabled(&crate_graph[module_id.krate].cfg_options) { | 205 | if !expander.is_cfg_enabled(&attrs) { |
206 | continue; | 206 | continue; |
207 | } | 207 | } |
208 | 208 | ||
@@ -219,8 +219,8 @@ fn lower_struct( | |||
219 | } | 219 | } |
220 | ast::StructKind::Record(fl) => { | 220 | ast::StructKind::Record(fl) => { |
221 | for fd in fl.fields() { | 221 | for fd in fl.fields() { |
222 | let attrs = Attrs::new(&fd, &Hygiene::new(db.upcast(), ast.file_id)); | 222 | let attrs = expander.parse_attrs(&fd); |
223 | if !attrs.is_cfg_enabled(&crate_graph[module_id.krate].cfg_options) { | 223 | if !expander.is_cfg_enabled(&attrs) { |
224 | continue; | 224 | continue; |
225 | } | 225 | } |
226 | 226 | ||
diff --git a/crates/ra_hir_def/src/attr.rs b/crates/ra_hir_def/src/attr.rs index 7b0c506b1..2f2e3e5ba 100644 --- a/crates/ra_hir_def/src/attr.rs +++ b/crates/ra_hir_def/src/attr.rs | |||
@@ -93,6 +93,7 @@ impl Attrs { | |||
93 | } | 93 | } |
94 | 94 | ||
95 | pub(crate) fn is_cfg_enabled(&self, cfg_options: &CfgOptions) -> bool { | 95 | pub(crate) fn is_cfg_enabled(&self, cfg_options: &CfgOptions) -> bool { |
96 | // FIXME: handle cfg_attr :-) | ||
96 | self.by_key("cfg").tt_values().all(|tt| cfg_options.is_cfg_enabled(tt) != Some(false)) | 97 | self.by_key("cfg").tt_values().all(|tt| cfg_options.is_cfg_enabled(tt) != Some(false)) |
97 | } | 98 | } |
98 | } | 99 | } |
diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs index 5f9d53ecb..eafaf48c1 100644 --- a/crates/ra_hir_def/src/body.rs +++ b/crates/ra_hir_def/src/body.rs | |||
@@ -9,11 +9,14 @@ use drop_bomb::DropBomb; | |||
9 | use either::Either; | 9 | use either::Either; |
10 | use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, AstId, HirFileId, InFile, MacroDefId}; | 10 | use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, AstId, HirFileId, InFile, MacroDefId}; |
11 | use ra_arena::{map::ArenaMap, Arena}; | 11 | use ra_arena::{map::ArenaMap, Arena}; |
12 | use ra_cfg::CfgOptions; | ||
13 | use ra_db::CrateId; | ||
12 | use ra_prof::profile; | 14 | use ra_prof::profile; |
13 | use ra_syntax::{ast, AstNode, AstPtr}; | 15 | use ra_syntax::{ast, AstNode, AstPtr}; |
14 | use rustc_hash::FxHashMap; | 16 | use rustc_hash::FxHashMap; |
15 | 17 | ||
16 | use crate::{ | 18 | use crate::{ |
19 | attr::Attrs, | ||
17 | db::DefDatabase, | 20 | db::DefDatabase, |
18 | expr::{Expr, ExprId, Pat, PatId}, | 21 | expr::{Expr, ExprId, Pat, PatId}, |
19 | item_scope::BuiltinShadowMode, | 22 | item_scope::BuiltinShadowMode, |
@@ -24,25 +27,59 @@ use crate::{ | |||
24 | AsMacroCall, DefWithBodyId, HasModule, Lookup, ModuleId, | 27 | AsMacroCall, DefWithBodyId, HasModule, Lookup, ModuleId, |
25 | }; | 28 | }; |
26 | 29 | ||
30 | /// A subser of Exander that only deals with cfg attributes. We only need it to | ||
31 | /// avoid cyclic queries in crate def map during enum processing. | ||
32 | pub(crate) struct CfgExpander { | ||
33 | cfg_options: CfgOptions, | ||
34 | hygiene: Hygiene, | ||
35 | } | ||
36 | |||
27 | pub(crate) struct Expander { | 37 | pub(crate) struct Expander { |
38 | cfg_expander: CfgExpander, | ||
28 | crate_def_map: Arc<CrateDefMap>, | 39 | crate_def_map: Arc<CrateDefMap>, |
29 | current_file_id: HirFileId, | 40 | current_file_id: HirFileId, |
30 | hygiene: Hygiene, | ||
31 | ast_id_map: Arc<AstIdMap>, | 41 | ast_id_map: Arc<AstIdMap>, |
32 | module: ModuleId, | 42 | module: ModuleId, |
33 | recursive_limit: usize, | 43 | recursive_limit: usize, |
34 | } | 44 | } |
35 | 45 | ||
46 | impl CfgExpander { | ||
47 | pub(crate) fn new( | ||
48 | db: &dyn DefDatabase, | ||
49 | current_file_id: HirFileId, | ||
50 | krate: CrateId, | ||
51 | ) -> CfgExpander { | ||
52 | let hygiene = Hygiene::new(db.upcast(), current_file_id); | ||
53 | let cfg_options = db.crate_graph()[krate].cfg_options.clone(); | ||
54 | CfgExpander { cfg_options, hygiene } | ||
55 | } | ||
56 | |||
57 | pub(crate) fn parse_attrs(&self, owner: &dyn ast::AttrsOwner) -> Attrs { | ||
58 | Attrs::new(owner, &self.hygiene) | ||
59 | } | ||
60 | |||
61 | pub(crate) fn is_cfg_enabled(&self, attrs: &Attrs) -> bool { | ||
62 | attrs.is_cfg_enabled(&self.cfg_options) | ||
63 | } | ||
64 | } | ||
65 | |||
36 | impl Expander { | 66 | impl Expander { |
37 | pub(crate) fn new( | 67 | pub(crate) fn new( |
38 | db: &dyn DefDatabase, | 68 | db: &dyn DefDatabase, |
39 | current_file_id: HirFileId, | 69 | current_file_id: HirFileId, |
40 | module: ModuleId, | 70 | module: ModuleId, |
41 | ) -> Expander { | 71 | ) -> Expander { |
72 | let cfg_expander = CfgExpander::new(db, current_file_id, module.krate); | ||
42 | let crate_def_map = db.crate_def_map(module.krate); | 73 | let crate_def_map = db.crate_def_map(module.krate); |
43 | let hygiene = Hygiene::new(db.upcast(), current_file_id); | ||
44 | let ast_id_map = db.ast_id_map(current_file_id); | 74 | let ast_id_map = db.ast_id_map(current_file_id); |
45 | Expander { crate_def_map, current_file_id, hygiene, ast_id_map, module, recursive_limit: 0 } | 75 | Expander { |
76 | cfg_expander, | ||
77 | crate_def_map, | ||
78 | current_file_id, | ||
79 | ast_id_map, | ||
80 | module, | ||
81 | recursive_limit: 0, | ||
82 | } | ||
46 | } | 83 | } |
47 | 84 | ||
48 | pub(crate) fn enter_expand<T: ast::AstNode>( | 85 | pub(crate) fn enter_expand<T: ast::AstNode>( |
@@ -75,7 +112,7 @@ impl Expander { | |||
75 | ast_id_map: mem::take(&mut self.ast_id_map), | 112 | ast_id_map: mem::take(&mut self.ast_id_map), |
76 | bomb: DropBomb::new("expansion mark dropped"), | 113 | bomb: DropBomb::new("expansion mark dropped"), |
77 | }; | 114 | }; |
78 | self.hygiene = Hygiene::new(db.upcast(), file_id); | 115 | self.cfg_expander.hygiene = Hygiene::new(db.upcast(), file_id); |
79 | self.current_file_id = file_id; | 116 | self.current_file_id = file_id; |
80 | self.ast_id_map = db.ast_id_map(file_id); | 117 | self.ast_id_map = db.ast_id_map(file_id); |
81 | self.recursive_limit += 1; | 118 | self.recursive_limit += 1; |
@@ -91,7 +128,7 @@ impl Expander { | |||
91 | } | 128 | } |
92 | 129 | ||
93 | pub(crate) fn exit(&mut self, db: &dyn DefDatabase, mut mark: Mark) { | 130 | pub(crate) fn exit(&mut self, db: &dyn DefDatabase, mut mark: Mark) { |
94 | self.hygiene = Hygiene::new(db.upcast(), mark.file_id); | 131 | self.cfg_expander.hygiene = Hygiene::new(db.upcast(), mark.file_id); |
95 | self.current_file_id = mark.file_id; | 132 | self.current_file_id = mark.file_id; |
96 | self.ast_id_map = mem::take(&mut mark.ast_id_map); | 133 | self.ast_id_map = mem::take(&mut mark.ast_id_map); |
97 | self.recursive_limit -= 1; | 134 | self.recursive_limit -= 1; |
@@ -102,8 +139,16 @@ impl Expander { | |||
102 | InFile { file_id: self.current_file_id, value } | 139 | InFile { file_id: self.current_file_id, value } |
103 | } | 140 | } |
104 | 141 | ||
142 | pub(crate) fn parse_attrs(&self, owner: &dyn ast::AttrsOwner) -> Attrs { | ||
143 | self.cfg_expander.parse_attrs(owner) | ||
144 | } | ||
145 | |||
146 | pub(crate) fn is_cfg_enabled(&self, attrs: &Attrs) -> bool { | ||
147 | self.cfg_expander.is_cfg_enabled(attrs) | ||
148 | } | ||
149 | |||
105 | fn parse_path(&mut self, path: ast::Path) -> Option<Path> { | 150 | fn parse_path(&mut self, path: ast::Path) -> Option<Path> { |
106 | Path::from_src(path, &self.hygiene) | 151 | Path::from_src(path, &self.cfg_expander.hygiene) |
107 | } | 152 | } |
108 | 153 | ||
109 | fn resolve_path_as_macro(&self, db: &dyn DefDatabase, path: &ModPath) -> Option<MacroDefId> { | 154 | fn resolve_path_as_macro(&self, db: &dyn DefDatabase, path: &ModPath) -> Option<MacroDefId> { |
@@ -142,7 +187,7 @@ pub struct Body { | |||
142 | pub item_scope: ItemScope, | 187 | pub item_scope: ItemScope, |
143 | } | 188 | } |
144 | 189 | ||
145 | pub type ExprPtr = Either<AstPtr<ast::Expr>, AstPtr<ast::RecordField>>; | 190 | pub type ExprPtr = AstPtr<ast::Expr>; |
146 | pub type ExprSource = InFile<ExprPtr>; | 191 | pub type ExprSource = InFile<ExprPtr>; |
147 | 192 | ||
148 | pub type PatPtr = Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>; | 193 | pub type PatPtr = Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>; |
@@ -236,11 +281,11 @@ impl Index<PatId> for Body { | |||
236 | 281 | ||
237 | impl BodySourceMap { | 282 | impl BodySourceMap { |
238 | pub fn expr_syntax(&self, expr: ExprId) -> Result<ExprSource, SyntheticSyntax> { | 283 | pub fn expr_syntax(&self, expr: ExprId) -> Result<ExprSource, SyntheticSyntax> { |
239 | self.expr_map_back[expr] | 284 | self.expr_map_back[expr].clone() |
240 | } | 285 | } |
241 | 286 | ||
242 | pub fn node_expr(&self, node: InFile<&ast::Expr>) -> Option<ExprId> { | 287 | pub fn node_expr(&self, node: InFile<&ast::Expr>) -> Option<ExprId> { |
243 | let src = node.map(|it| Either::Left(AstPtr::new(it))); | 288 | let src = node.map(|it| AstPtr::new(it)); |
244 | self.expr_map.get(&src).cloned() | 289 | self.expr_map.get(&src).cloned() |
245 | } | 290 | } |
246 | 291 | ||
@@ -249,13 +294,8 @@ impl BodySourceMap { | |||
249 | self.expansions.get(&src).cloned() | 294 | self.expansions.get(&src).cloned() |
250 | } | 295 | } |
251 | 296 | ||
252 | pub fn field_init_shorthand_expr(&self, node: InFile<&ast::RecordField>) -> Option<ExprId> { | ||
253 | let src = node.map(|it| Either::Right(AstPtr::new(it))); | ||
254 | self.expr_map.get(&src).cloned() | ||
255 | } | ||
256 | |||
257 | pub fn pat_syntax(&self, pat: PatId) -> Result<PatSource, SyntheticSyntax> { | 297 | pub fn pat_syntax(&self, pat: PatId) -> Result<PatSource, SyntheticSyntax> { |
258 | self.pat_map_back[pat] | 298 | self.pat_map_back[pat].clone() |
259 | } | 299 | } |
260 | 300 | ||
261 | pub fn node_pat(&self, node: InFile<&ast::Pat>) -> Option<PatId> { | 301 | pub fn node_pat(&self, node: InFile<&ast::Pat>) -> Option<PatId> { |
@@ -264,6 +304,6 @@ impl BodySourceMap { | |||
264 | } | 304 | } |
265 | 305 | ||
266 | pub fn field_syntax(&self, expr: ExprId, field: usize) -> AstPtr<ast::RecordField> { | 306 | pub fn field_syntax(&self, expr: ExprId, field: usize) -> AstPtr<ast::RecordField> { |
267 | self.field_map[&(expr, field)] | 307 | self.field_map[&(expr, field)].clone() |
268 | } | 308 | } |
269 | } | 309 | } |
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 032037c8c..c057dc8f2 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -2,9 +2,7 @@ | |||
2 | //! representation. | 2 | //! representation. |
3 | 3 | ||
4 | use either::Either; | 4 | use either::Either; |
5 | |||
6 | use hir_expand::{ | 5 | use hir_expand::{ |
7 | hygiene::Hygiene, | ||
8 | name::{name, AsName, Name}, | 6 | name::{name, AsName, Name}, |
9 | MacroDefId, MacroDefKind, | 7 | MacroDefId, MacroDefKind, |
10 | }; | 8 | }; |
@@ -18,10 +16,8 @@ use ra_syntax::{ | |||
18 | }; | 16 | }; |
19 | use test_utils::tested_by; | 17 | use test_utils::tested_by; |
20 | 18 | ||
21 | use super::{ExprSource, PatSource}; | ||
22 | use crate::{ | 19 | use crate::{ |
23 | adt::StructKind, | 20 | adt::StructKind, |
24 | attr::Attrs, | ||
25 | body::{Body, BodySourceMap, Expander, PatPtr, SyntheticSyntax}, | 21 | body::{Body, BodySourceMap, Expander, PatPtr, SyntheticSyntax}, |
26 | builtin_type::{BuiltinFloat, BuiltinInt}, | 22 | builtin_type::{BuiltinFloat, BuiltinInt}, |
27 | db::DefDatabase, | 23 | db::DefDatabase, |
@@ -31,12 +27,13 @@ use crate::{ | |||
31 | }, | 27 | }, |
32 | item_scope::BuiltinShadowMode, | 28 | item_scope::BuiltinShadowMode, |
33 | path::GenericArgs, | 29 | path::GenericArgs, |
34 | path::Path, | ||
35 | type_ref::{Mutability, TypeRef}, | 30 | type_ref::{Mutability, TypeRef}, |
36 | AdtId, ConstLoc, ContainerId, DefWithBodyId, EnumLoc, FunctionLoc, HasModule, Intern, | 31 | AdtId, ConstLoc, ContainerId, DefWithBodyId, EnumLoc, FunctionLoc, Intern, ModuleDefId, |
37 | ModuleDefId, StaticLoc, StructLoc, TraitLoc, TypeAliasLoc, UnionLoc, | 32 | StaticLoc, StructLoc, TraitLoc, TypeAliasLoc, UnionLoc, |
38 | }; | 33 | }; |
39 | 34 | ||
35 | use super::{ExprSource, PatSource}; | ||
36 | |||
40 | pub(super) fn lower( | 37 | pub(super) fn lower( |
41 | db: &dyn DefDatabase, | 38 | db: &dyn DefDatabase, |
42 | def: DefWithBodyId, | 39 | def: DefWithBodyId, |
@@ -104,9 +101,8 @@ impl ExprCollector<'_> { | |||
104 | } | 101 | } |
105 | 102 | ||
106 | fn alloc_expr(&mut self, expr: Expr, ptr: AstPtr<ast::Expr>) -> ExprId { | 103 | fn alloc_expr(&mut self, expr: Expr, ptr: AstPtr<ast::Expr>) -> ExprId { |
107 | let ptr = Either::Left(ptr); | ||
108 | let src = self.expander.to_source(ptr); | 104 | let src = self.expander.to_source(ptr); |
109 | let id = self.make_expr(expr, Ok(src)); | 105 | let id = self.make_expr(expr, Ok(src.clone())); |
110 | self.source_map.expr_map.insert(src, id); | 106 | self.source_map.expr_map.insert(src, id); |
111 | id | 107 | id |
112 | } | 108 | } |
@@ -115,13 +111,6 @@ impl ExprCollector<'_> { | |||
115 | fn alloc_expr_desugared(&mut self, expr: Expr) -> ExprId { | 111 | fn alloc_expr_desugared(&mut self, expr: Expr) -> ExprId { |
116 | self.make_expr(expr, Err(SyntheticSyntax)) | 112 | self.make_expr(expr, Err(SyntheticSyntax)) |
117 | } | 113 | } |
118 | fn alloc_expr_field_shorthand(&mut self, expr: Expr, ptr: AstPtr<ast::RecordField>) -> ExprId { | ||
119 | let ptr = Either::Right(ptr); | ||
120 | let src = self.expander.to_source(ptr); | ||
121 | let id = self.make_expr(expr, Ok(src)); | ||
122 | self.source_map.expr_map.insert(src, id); | ||
123 | id | ||
124 | } | ||
125 | fn empty_block(&mut self) -> ExprId { | 114 | fn empty_block(&mut self) -> ExprId { |
126 | self.alloc_expr_desugared(Expr::Block { statements: Vec::new(), tail: None }) | 115 | self.alloc_expr_desugared(Expr::Block { statements: Vec::new(), tail: None }) |
127 | } | 116 | } |
@@ -136,7 +125,7 @@ impl ExprCollector<'_> { | |||
136 | 125 | ||
137 | fn alloc_pat(&mut self, pat: Pat, ptr: PatPtr) -> PatId { | 126 | fn alloc_pat(&mut self, pat: Pat, ptr: PatPtr) -> PatId { |
138 | let src = self.expander.to_source(ptr); | 127 | let src = self.expander.to_source(ptr); |
139 | let id = self.make_pat(pat, Ok(src)); | 128 | let id = self.make_pat(pat, Ok(src.clone())); |
140 | self.source_map.pat_map.insert(src, id); | 129 | self.source_map.pat_map.insert(src, id); |
141 | id | 130 | id |
142 | } | 131 | } |
@@ -291,7 +280,7 @@ impl ExprCollector<'_> { | |||
291 | ast::Expr::ParenExpr(e) => { | 280 | ast::Expr::ParenExpr(e) => { |
292 | let inner = self.collect_expr_opt(e.expr()); | 281 | let inner = self.collect_expr_opt(e.expr()); |
293 | // make the paren expr point to the inner expression as well | 282 | // make the paren expr point to the inner expression as well |
294 | let src = self.expander.to_source(Either::Left(syntax_ptr)); | 283 | let src = self.expander.to_source(syntax_ptr); |
295 | self.source_map.expr_map.insert(src, inner); | 284 | self.source_map.expr_map.insert(src, inner); |
296 | inner | 285 | inner |
297 | } | 286 | } |
@@ -300,7 +289,6 @@ impl ExprCollector<'_> { | |||
300 | self.alloc_expr(Expr::Return { expr }, syntax_ptr) | 289 | self.alloc_expr(Expr::Return { expr }, syntax_ptr) |
301 | } | 290 | } |
302 | ast::Expr::RecordLit(e) => { | 291 | ast::Expr::RecordLit(e) => { |
303 | let crate_graph = self.db.crate_graph(); | ||
304 | let path = e.path().and_then(|path| self.expander.parse_path(path)); | 292 | let path = e.path().and_then(|path| self.expander.parse_path(path)); |
305 | let mut field_ptrs = Vec::new(); | 293 | let mut field_ptrs = Vec::new(); |
306 | let record_lit = if let Some(nfl) = e.record_field_list() { | 294 | let record_lit = if let Some(nfl) = e.record_field_list() { |
@@ -308,31 +296,17 @@ impl ExprCollector<'_> { | |||
308 | .fields() | 296 | .fields() |
309 | .inspect(|field| field_ptrs.push(AstPtr::new(field))) | 297 | .inspect(|field| field_ptrs.push(AstPtr::new(field))) |
310 | .filter_map(|field| { | 298 | .filter_map(|field| { |
311 | let module_id = ContainerId::DefWithBodyId(self.def).module(self.db); | 299 | let attrs = self.expander.parse_attrs(&field); |
312 | let attrs = Attrs::new( | 300 | if !self.expander.is_cfg_enabled(&attrs) { |
313 | &field, | ||
314 | &Hygiene::new(self.db.upcast(), self.expander.current_file_id), | ||
315 | ); | ||
316 | |||
317 | if !attrs.is_cfg_enabled(&crate_graph[module_id.krate].cfg_options) { | ||
318 | return None; | 301 | return None; |
319 | } | 302 | } |
303 | let name = field.field_name()?.as_name(); | ||
320 | 304 | ||
321 | Some(RecordLitField { | 305 | Some(RecordLitField { |
322 | name: field | 306 | name, |
323 | .name_ref() | 307 | expr: match field.expr() { |
324 | .map(|nr| nr.as_name()) | 308 | Some(e) => self.collect_expr(e), |
325 | .unwrap_or_else(Name::missing), | 309 | None => self.missing_expr(), |
326 | expr: if let Some(e) = field.expr() { | ||
327 | self.collect_expr(e) | ||
328 | } else if let Some(nr) = field.name_ref() { | ||
329 | // field shorthand | ||
330 | self.alloc_expr_field_shorthand( | ||
331 | Expr::Path(Path::from_name_ref(&nr)), | ||
332 | AstPtr::new(&field), | ||
333 | ) | ||
334 | } else { | ||
335 | self.missing_expr() | ||
336 | }, | 310 | }, |
337 | }) | 311 | }) |
338 | }) | 312 | }) |
@@ -372,7 +346,7 @@ impl ExprCollector<'_> { | |||
372 | } | 346 | } |
373 | ast::Expr::RefExpr(e) => { | 347 | ast::Expr::RefExpr(e) => { |
374 | let expr = self.collect_expr_opt(e.expr()); | 348 | let expr = self.collect_expr_opt(e.expr()); |
375 | let mutability = Mutability::from_mutable(e.is_mut()); | 349 | let mutability = Mutability::from_mutable(e.mut_token().is_some()); |
376 | self.alloc_expr(Expr::Ref { expr, mutability }, syntax_ptr) | 350 | self.alloc_expr(Expr::Ref { expr, mutability }, syntax_ptr) |
377 | } | 351 | } |
378 | ast::Expr::PrefixExpr(e) => { | 352 | ast::Expr::PrefixExpr(e) => { |
@@ -587,7 +561,8 @@ impl ExprCollector<'_> { | |||
587 | let pattern = match &pat { | 561 | let pattern = match &pat { |
588 | ast::Pat::BindPat(bp) => { | 562 | ast::Pat::BindPat(bp) => { |
589 | let name = bp.name().map(|nr| nr.as_name()).unwrap_or_else(Name::missing); | 563 | let name = bp.name().map(|nr| nr.as_name()).unwrap_or_else(Name::missing); |
590 | let annotation = BindingAnnotation::new(bp.is_mutable(), bp.is_ref()); | 564 | let annotation = |
565 | BindingAnnotation::new(bp.mut_token().is_some(), bp.ref_token().is_some()); | ||
591 | let subpat = bp.pat().map(|subpat| self.collect_pat(subpat)); | 566 | let subpat = bp.pat().map(|subpat| self.collect_pat(subpat)); |
592 | if annotation == BindingAnnotation::Unannotated && subpat.is_none() { | 567 | if annotation == BindingAnnotation::Unannotated && subpat.is_none() { |
593 | // This could also be a single-segment path pattern. To | 568 | // This could also be a single-segment path pattern. To |
@@ -628,7 +603,7 @@ impl ExprCollector<'_> { | |||
628 | } | 603 | } |
629 | ast::Pat::RefPat(p) => { | 604 | ast::Pat::RefPat(p) => { |
630 | let pat = self.collect_pat_opt(p.pat()); | 605 | let pat = self.collect_pat_opt(p.pat()); |
631 | let mutability = Mutability::from_mutable(p.is_mut()); | 606 | let mutability = Mutability::from_mutable(p.mut_token().is_some()); |
632 | Pat::Ref { pat, mutability } | 607 | Pat::Ref { pat, mutability } |
633 | } | 608 | } |
634 | ast::Pat::PathPat(p) => { | 609 | ast::Pat::PathPat(p) => { |
@@ -667,7 +642,9 @@ impl ExprCollector<'_> { | |||
667 | }); | 642 | }); |
668 | fields.extend(iter); | 643 | fields.extend(iter); |
669 | 644 | ||
670 | Pat::Record { path, args: fields } | 645 | let ellipsis = record_field_pat_list.dotdot_token().is_some(); |
646 | |||
647 | Pat::Record { path, args: fields, ellipsis } | ||
671 | } | 648 | } |
672 | ast::Pat::SlicePat(p) => { | 649 | ast::Pat::SlicePat(p) => { |
673 | let SlicePatComponents { prefix, slice, suffix } = p.components(); | 650 | let SlicePatComponents { prefix, slice, suffix } = p.components(); |
@@ -688,7 +665,6 @@ impl ExprCollector<'_> { | |||
688 | Pat::Missing | 665 | Pat::Missing |
689 | } | 666 | } |
690 | } | 667 | } |
691 | |||
692 | // FIXME: implement | 668 | // FIXME: implement |
693 | ast::Pat::BoxPat(_) | ast::Pat::RangePat(_) | ast::Pat::MacroPat(_) => Pat::Missing, | 669 | ast::Pat::BoxPat(_) | ast::Pat::RangePat(_) | ast::Pat::MacroPat(_) => Pat::Missing, |
694 | }; | 670 | }; |
diff --git a/crates/ra_hir_def/src/data.rs b/crates/ra_hir_def/src/data.rs index e793ad874..56a20c5bd 100644 --- a/crates/ra_hir_def/src/data.rs +++ b/crates/ra_hir_def/src/data.rs | |||
@@ -20,7 +20,7 @@ use crate::{ | |||
20 | type_ref::{Mutability, TypeBound, TypeRef}, | 20 | type_ref::{Mutability, TypeBound, TypeRef}, |
21 | visibility::RawVisibility, | 21 | visibility::RawVisibility, |
22 | AssocContainerId, AssocItemId, ConstId, ConstLoc, Expander, FunctionId, FunctionLoc, HasModule, | 22 | AssocContainerId, AssocItemId, ConstId, ConstLoc, Expander, FunctionId, FunctionLoc, HasModule, |
23 | ImplId, Intern, Lookup, ModuleId, StaticId, TraitId, TypeAliasId, TypeAliasLoc, | 23 | ImplId, Intern, Lookup, StaticId, TraitId, TypeAliasId, TypeAliasLoc, |
24 | }; | 24 | }; |
25 | 25 | ||
26 | #[derive(Debug, Clone, PartialEq, Eq)] | 26 | #[derive(Debug, Clone, PartialEq, Eq)] |
@@ -74,7 +74,7 @@ impl FunctionData { | |||
74 | TypeRef::unit() | 74 | TypeRef::unit() |
75 | }; | 75 | }; |
76 | 76 | ||
77 | let ret_type = if src.value.is_async() { | 77 | let ret_type = if src.value.async_token().is_some() { |
78 | let future_impl = desugar_future_path(ret_type); | 78 | let future_impl = desugar_future_path(ret_type); |
79 | let ty_bound = TypeBound::Path(future_impl); | 79 | let ty_bound = TypeBound::Path(future_impl); |
80 | TypeRef::ImplTrait(vec![ty_bound]) | 80 | TypeRef::ImplTrait(vec![ty_bound]) |
@@ -135,7 +135,7 @@ impl TraitData { | |||
135 | pub(crate) fn trait_data_query(db: &dyn DefDatabase, tr: TraitId) -> Arc<TraitData> { | 135 | pub(crate) fn trait_data_query(db: &dyn DefDatabase, tr: TraitId) -> Arc<TraitData> { |
136 | let src = tr.lookup(db).source(db); | 136 | let src = tr.lookup(db).source(db); |
137 | let name = src.value.name().map_or_else(Name::missing, |n| n.as_name()); | 137 | let name = src.value.name().map_or_else(Name::missing, |n| n.as_name()); |
138 | let auto = src.value.is_auto(); | 138 | let auto = src.value.auto_token().is_some(); |
139 | let ast_id_map = db.ast_id_map(src.file_id); | 139 | let ast_id_map = db.ast_id_map(src.file_id); |
140 | 140 | ||
141 | let container = AssocContainerId::TraitId(tr); | 141 | let container = AssocContainerId::TraitId(tr); |
@@ -212,16 +212,23 @@ impl ImplData { | |||
212 | 212 | ||
213 | let target_trait = src.value.target_trait().map(TypeRef::from_ast); | 213 | let target_trait = src.value.target_trait().map(TypeRef::from_ast); |
214 | let target_type = TypeRef::from_ast_opt(src.value.target_type()); | 214 | let target_type = TypeRef::from_ast_opt(src.value.target_type()); |
215 | let is_negative = src.value.is_negative(); | 215 | let is_negative = src.value.excl_token().is_some(); |
216 | let module_id = impl_loc.container.module(db); | 216 | let module_id = impl_loc.container.module(db); |
217 | 217 | ||
218 | let mut items = Vec::new(); | 218 | let mut items = Vec::new(); |
219 | 219 | ||
220 | if let Some(item_list) = src.value.item_list() { | 220 | if let Some(item_list) = src.value.item_list() { |
221 | items.extend(collect_impl_items(db, item_list.impl_items(), src.file_id, id)); | 221 | let mut expander = Expander::new(db, impl_loc.ast_id.file_id, module_id); |
222 | items.extend(collect_impl_items( | ||
223 | db, | ||
224 | &mut expander, | ||
225 | item_list.impl_items(), | ||
226 | src.file_id, | ||
227 | id, | ||
228 | )); | ||
222 | items.extend(collect_impl_items_in_macros( | 229 | items.extend(collect_impl_items_in_macros( |
223 | db, | 230 | db, |
224 | module_id, | 231 | &mut expander, |
225 | &src.with_value(item_list), | 232 | &src.with_value(item_list), |
226 | id, | 233 | id, |
227 | )); | 234 | )); |
@@ -268,18 +275,17 @@ impl ConstData { | |||
268 | 275 | ||
269 | fn collect_impl_items_in_macros( | 276 | fn collect_impl_items_in_macros( |
270 | db: &dyn DefDatabase, | 277 | db: &dyn DefDatabase, |
271 | module_id: ModuleId, | 278 | expander: &mut Expander, |
272 | impl_def: &InFile<ast::ItemList>, | 279 | impl_def: &InFile<ast::ItemList>, |
273 | id: ImplId, | 280 | id: ImplId, |
274 | ) -> Vec<AssocItemId> { | 281 | ) -> Vec<AssocItemId> { |
275 | let mut expander = Expander::new(db, impl_def.file_id, module_id); | ||
276 | let mut res = Vec::new(); | 282 | let mut res = Vec::new(); |
277 | 283 | ||
278 | // We set a limit to protect against infinite recursion | 284 | // We set a limit to protect against infinite recursion |
279 | let limit = 100; | 285 | let limit = 100; |
280 | 286 | ||
281 | for m in impl_def.value.syntax().children().filter_map(ast::MacroCall::cast) { | 287 | for m in impl_def.value.syntax().children().filter_map(ast::MacroCall::cast) { |
282 | res.extend(collect_impl_items_in_macro(db, &mut expander, m, id, limit)) | 288 | res.extend(collect_impl_items_in_macro(db, expander, m, id, limit)) |
283 | } | 289 | } |
284 | 290 | ||
285 | res | 291 | res |
@@ -300,6 +306,7 @@ fn collect_impl_items_in_macro( | |||
300 | let items: InFile<ast::MacroItems> = expander.to_source(items); | 306 | let items: InFile<ast::MacroItems> = expander.to_source(items); |
301 | let mut res = collect_impl_items( | 307 | let mut res = collect_impl_items( |
302 | db, | 308 | db, |
309 | expander, | ||
303 | items.value.items().filter_map(|it| ImplItem::cast(it.syntax().clone())), | 310 | items.value.items().filter_map(|it| ImplItem::cast(it.syntax().clone())), |
304 | items.file_id, | 311 | items.file_id, |
305 | id, | 312 | id, |
@@ -319,32 +326,26 @@ fn collect_impl_items_in_macro( | |||
319 | 326 | ||
320 | fn collect_impl_items( | 327 | fn collect_impl_items( |
321 | db: &dyn DefDatabase, | 328 | db: &dyn DefDatabase, |
329 | expander: &mut Expander, | ||
322 | impl_items: impl Iterator<Item = ImplItem>, | 330 | impl_items: impl Iterator<Item = ImplItem>, |
323 | file_id: crate::HirFileId, | 331 | file_id: crate::HirFileId, |
324 | id: ImplId, | 332 | id: ImplId, |
325 | ) -> Vec<AssocItemId> { | 333 | ) -> Vec<AssocItemId> { |
326 | let items = db.ast_id_map(file_id); | 334 | let items = db.ast_id_map(file_id); |
327 | let crate_graph = db.crate_graph(); | ||
328 | let module_id = id.lookup(db).container.module(db); | ||
329 | 335 | ||
330 | impl_items | 336 | impl_items |
331 | .filter_map(|item_node| match item_node { | 337 | .filter_map(|item_node| match item_node { |
332 | ast::ImplItem::FnDef(it) => { | 338 | ast::ImplItem::FnDef(it) => { |
339 | let attrs = expander.parse_attrs(&it); | ||
340 | if !expander.is_cfg_enabled(&attrs) { | ||
341 | return None; | ||
342 | } | ||
333 | let def = FunctionLoc { | 343 | let def = FunctionLoc { |
334 | container: AssocContainerId::ImplId(id), | 344 | container: AssocContainerId::ImplId(id), |
335 | ast_id: AstId::new(file_id, items.ast_id(&it)), | 345 | ast_id: AstId::new(file_id, items.ast_id(&it)), |
336 | } | 346 | } |
337 | .intern(db); | 347 | .intern(db); |
338 | 348 | Some(def.into()) | |
339 | if !db | ||
340 | .function_data(def) | ||
341 | .attrs | ||
342 | .is_cfg_enabled(&crate_graph[module_id.krate].cfg_options) | ||
343 | { | ||
344 | None | ||
345 | } else { | ||
346 | Some(def.into()) | ||
347 | } | ||
348 | } | 349 | } |
349 | ast::ImplItem::ConstDef(it) => { | 350 | ast::ImplItem::ConstDef(it) => { |
350 | let def = ConstLoc { | 351 | let def = ConstLoc { |
diff --git a/crates/ra_hir_def/src/diagnostics.rs b/crates/ra_hir_def/src/diagnostics.rs index 095498429..cfa0f2f76 100644 --- a/crates/ra_hir_def/src/diagnostics.rs +++ b/crates/ra_hir_def/src/diagnostics.rs | |||
@@ -20,7 +20,7 @@ impl Diagnostic for UnresolvedModule { | |||
20 | "unresolved module".to_string() | 20 | "unresolved module".to_string() |
21 | } | 21 | } |
22 | fn source(&self) -> InFile<SyntaxNodePtr> { | 22 | fn source(&self) -> InFile<SyntaxNodePtr> { |
23 | InFile { file_id: self.file, value: self.decl.into() } | 23 | InFile { file_id: self.file, value: self.decl.clone().into() } |
24 | } | 24 | } |
25 | fn as_any(&self) -> &(dyn Any + Send + 'static) { | 25 | fn as_any(&self) -> &(dyn Any + Send + 'static) { |
26 | self | 26 | self |
diff --git a/crates/ra_hir_def/src/expr.rs b/crates/ra_hir_def/src/expr.rs index 197bbe9bd..e11bdf3ec 100644 --- a/crates/ra_hir_def/src/expr.rs +++ b/crates/ra_hir_def/src/expr.rs | |||
@@ -376,35 +376,14 @@ pub enum Pat { | |||
376 | Wild, | 376 | Wild, |
377 | Tuple(Vec<PatId>), | 377 | Tuple(Vec<PatId>), |
378 | Or(Vec<PatId>), | 378 | Or(Vec<PatId>), |
379 | Record { | 379 | Record { path: Option<Path>, args: Vec<RecordFieldPat>, ellipsis: bool }, |
380 | path: Option<Path>, | 380 | Range { start: ExprId, end: ExprId }, |
381 | args: Vec<RecordFieldPat>, | 381 | Slice { prefix: Vec<PatId>, slice: Option<PatId>, suffix: Vec<PatId> }, |
382 | // FIXME: 'ellipsis' option | ||
383 | }, | ||
384 | Range { | ||
385 | start: ExprId, | ||
386 | end: ExprId, | ||
387 | }, | ||
388 | Slice { | ||
389 | prefix: Vec<PatId>, | ||
390 | slice: Option<PatId>, | ||
391 | suffix: Vec<PatId>, | ||
392 | }, | ||
393 | Path(Path), | 382 | Path(Path), |
394 | Lit(ExprId), | 383 | Lit(ExprId), |
395 | Bind { | 384 | Bind { mode: BindingAnnotation, name: Name, subpat: Option<PatId> }, |
396 | mode: BindingAnnotation, | 385 | TupleStruct { path: Option<Path>, args: Vec<PatId> }, |
397 | name: Name, | 386 | Ref { pat: PatId, mutability: Mutability }, |
398 | subpat: Option<PatId>, | ||
399 | }, | ||
400 | TupleStruct { | ||
401 | path: Option<Path>, | ||
402 | args: Vec<PatId>, | ||
403 | }, | ||
404 | Ref { | ||
405 | pat: PatId, | ||
406 | mutability: Mutability, | ||
407 | }, | ||
408 | } | 387 | } |
409 | 388 | ||
410 | impl Pat { | 389 | impl Pat { |
diff --git a/crates/ra_hir_def/src/generics.rs b/crates/ra_hir_def/src/generics.rs index b687ce2b2..d850244c4 100644 --- a/crates/ra_hir_def/src/generics.rs +++ b/crates/ra_hir_def/src/generics.rs | |||
@@ -194,7 +194,7 @@ impl GenericParams { | |||
194 | } | 194 | } |
195 | 195 | ||
196 | fn add_where_predicate_from_bound(&mut self, bound: ast::TypeBound, type_ref: TypeRef) { | 196 | fn add_where_predicate_from_bound(&mut self, bound: ast::TypeBound, type_ref: TypeRef) { |
197 | if bound.has_question_mark() { | 197 | if bound.question_token().is_some() { |
198 | // FIXME: remove this bound | 198 | // FIXME: remove this bound |
199 | return; | 199 | return; |
200 | } | 200 | } |
diff --git a/crates/ra_hir_def/src/lang_item.rs b/crates/ra_hir_def/src/lang_item.rs index 01b367278..d96ac8c0a 100644 --- a/crates/ra_hir_def/src/lang_item.rs +++ b/crates/ra_hir_def/src/lang_item.rs | |||
@@ -4,6 +4,7 @@ | |||
4 | //! features, such as Fn family of traits. | 4 | //! features, such as Fn family of traits. |
5 | use std::sync::Arc; | 5 | use std::sync::Arc; |
6 | 6 | ||
7 | use ra_prof::profile; | ||
7 | use ra_syntax::SmolStr; | 8 | use ra_syntax::SmolStr; |
8 | use rustc_hash::FxHashMap; | 9 | use rustc_hash::FxHashMap; |
9 | 10 | ||
@@ -78,6 +79,8 @@ impl LangItems { | |||
78 | 79 | ||
79 | /// Salsa query. This will look for lang items in a specific crate. | 80 | /// Salsa query. This will look for lang items in a specific crate. |
80 | pub(crate) fn crate_lang_items_query(db: &dyn DefDatabase, krate: CrateId) -> Arc<LangItems> { | 81 | pub(crate) fn crate_lang_items_query(db: &dyn DefDatabase, krate: CrateId) -> Arc<LangItems> { |
82 | let _p = profile("crate_lang_items_query"); | ||
83 | |||
81 | let mut lang_items = LangItems::default(); | 84 | let mut lang_items = LangItems::default(); |
82 | 85 | ||
83 | let crate_def_map = db.crate_def_map(krate); | 86 | let crate_def_map = db.crate_def_map(krate); |
@@ -95,6 +98,7 @@ impl LangItems { | |||
95 | db: &dyn DefDatabase, | 98 | db: &dyn DefDatabase, |
96 | module: ModuleId, | 99 | module: ModuleId, |
97 | ) -> Option<Arc<LangItems>> { | 100 | ) -> Option<Arc<LangItems>> { |
101 | let _p = profile("module_lang_items_query"); | ||
98 | let mut lang_items = LangItems::default(); | 102 | let mut lang_items = LangItems::default(); |
99 | lang_items.collect_lang_items(db, module); | 103 | lang_items.collect_lang_items(db, module); |
100 | if lang_items.items.is_empty() { | 104 | if lang_items.items.is_empty() { |
@@ -111,6 +115,7 @@ impl LangItems { | |||
111 | start_crate: CrateId, | 115 | start_crate: CrateId, |
112 | item: SmolStr, | 116 | item: SmolStr, |
113 | ) -> Option<LangItemTarget> { | 117 | ) -> Option<LangItemTarget> { |
118 | let _p = profile("lang_item_query"); | ||
114 | let lang_items = db.crate_lang_items(start_crate); | 119 | let lang_items = db.crate_lang_items(start_crate); |
115 | let start_crate_target = lang_items.items.get(&item); | 120 | let start_crate_target = lang_items.items.get(&item); |
116 | if let Some(target) = start_crate_target { | 121 | if let Some(target) = start_crate_target { |
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index 8fe3f8617..98c74fe25 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs | |||
@@ -462,6 +462,14 @@ impl DefCollector<'_> { | |||
462 | Some(ModuleDefId::AdtId(AdtId::EnumId(e))) => { | 462 | Some(ModuleDefId::AdtId(AdtId::EnumId(e))) => { |
463 | tested_by!(glob_enum); | 463 | tested_by!(glob_enum); |
464 | // glob import from enum => just import all the variants | 464 | // glob import from enum => just import all the variants |
465 | |||
466 | // XXX: urgh, so this works by accident! Here, we look at | ||
467 | // the enum data, and, in theory, this might require us to | ||
468 | // look back at the crate_def_map, creating a cycle. For | ||
469 | // example, `enum E { crate::some_macro!(); }`. Luckely, the | ||
470 | // only kind of macro that is allowed inside enum is a | ||
471 | // `cfg_macro`, and we don't need to run name resolution for | ||
472 | // it, but this is sheer luck! | ||
465 | let enum_data = self.db.enum_data(e); | 473 | let enum_data = self.db.enum_data(e); |
466 | let resolutions = enum_data | 474 | let resolutions = enum_data |
467 | .variants | 475 | .variants |
@@ -977,11 +985,7 @@ impl ModCollector<'_, '_> { | |||
977 | } | 985 | } |
978 | 986 | ||
979 | fn is_cfg_enabled(&self, attrs: &Attrs) -> bool { | 987 | fn is_cfg_enabled(&self, attrs: &Attrs) -> bool { |
980 | // FIXME: handle cfg_attr :-) | 988 | attrs.is_cfg_enabled(self.def_collector.cfg_options) |
981 | attrs | ||
982 | .by_key("cfg") | ||
983 | .tt_values() | ||
984 | .all(|tt| self.def_collector.cfg_options.is_cfg_enabled(tt) != Some(false)) | ||
985 | } | 989 | } |
986 | } | 990 | } |
987 | 991 | ||
diff --git a/crates/ra_hir_def/src/nameres/raw.rs b/crates/ra_hir_def/src/nameres/raw.rs index a9dff3a5d..afd538e4a 100644 --- a/crates/ra_hir_def/src/nameres/raw.rs +++ b/crates/ra_hir_def/src/nameres/raw.rs | |||
@@ -287,7 +287,7 @@ impl RawItemsCollector { | |||
287 | let visibility = RawVisibility::from_ast_with_hygiene(module.visibility(), &self.hygiene); | 287 | let visibility = RawVisibility::from_ast_with_hygiene(module.visibility(), &self.hygiene); |
288 | 288 | ||
289 | let ast_id = self.source_ast_id_map.ast_id(&module); | 289 | let ast_id = self.source_ast_id_map.ast_id(&module); |
290 | if module.has_semi() { | 290 | if module.semicolon_token().is_some() { |
291 | let item = | 291 | let item = |
292 | self.raw_items.modules.alloc(ModuleData::Declaration { name, visibility, ast_id }); | 292 | self.raw_items.modules.alloc(ModuleData::Declaration { name, visibility, ast_id }); |
293 | self.push_item(current_module, attrs, RawItemKind::Module(item)); | 293 | self.push_item(current_module, attrs, RawItemKind::Module(item)); |
diff --git a/crates/ra_hir_def/src/nameres/tests/incremental.rs b/crates/ra_hir_def/src/nameres/tests/incremental.rs index 496fc6b08..87165ac33 100644 --- a/crates/ra_hir_def/src/nameres/tests/incremental.rs +++ b/crates/ra_hir_def/src/nameres/tests/incremental.rs | |||
@@ -32,6 +32,9 @@ fn typing_inside_a_function_should_not_invalidate_def_map() { | |||
32 | 32 | ||
33 | use crate::foo::bar::Baz; | 33 | use crate::foo::bar::Baz; |
34 | 34 | ||
35 | enum E { A, B } | ||
36 | use E::*; | ||
37 | |||
35 | fn foo() -> i32 { | 38 | fn foo() -> i32 { |
36 | 1 + 1 | 39 | 1 + 1 |
37 | } | 40 | } |
@@ -46,6 +49,9 @@ fn typing_inside_a_function_should_not_invalidate_def_map() { | |||
46 | 49 | ||
47 | use crate::foo::bar::Baz; | 50 | use crate::foo::bar::Baz; |
48 | 51 | ||
52 | enum E { A, B } | ||
53 | use E::*; | ||
54 | |||
49 | fn foo() -> i32 { 92 } | 55 | fn foo() -> i32 { 92 } |
50 | ", | 56 | ", |
51 | ); | 57 | ); |
diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs index 904080341..91c7b3e09 100644 --- a/crates/ra_hir_def/src/path.rs +++ b/crates/ra_hir_def/src/path.rs | |||
@@ -134,11 +134,6 @@ impl Path { | |||
134 | lower::lower_path(path, hygiene) | 134 | lower::lower_path(path, hygiene) |
135 | } | 135 | } |
136 | 136 | ||
137 | /// Converts an `ast::NameRef` into a single-identifier `Path`. | ||
138 | pub(crate) fn from_name_ref(name_ref: &ast::NameRef) -> Path { | ||
139 | Path { type_anchor: None, mod_path: name_ref.as_name().into(), generic_args: vec![None] } | ||
140 | } | ||
141 | |||
142 | /// Converts a known mod path to `Path`. | 137 | /// Converts a known mod path to `Path`. |
143 | pub(crate) fn from_known_path( | 138 | pub(crate) fn from_known_path( |
144 | path: ModPath, | 139 | path: ModPath, |
diff --git a/crates/ra_hir_def/src/path/lower.rs b/crates/ra_hir_def/src/path/lower.rs index 3c13cb2c7..0f806d6fb 100644 --- a/crates/ra_hir_def/src/path/lower.rs +++ b/crates/ra_hir_def/src/path/lower.rs | |||
@@ -28,7 +28,7 @@ pub(super) fn lower_path(mut path: ast::Path, hygiene: &Hygiene) -> Option<Path> | |||
28 | loop { | 28 | loop { |
29 | let segment = path.segment()?; | 29 | let segment = path.segment()?; |
30 | 30 | ||
31 | if segment.coloncolon().is_some() { | 31 | if segment.coloncolon_token().is_some() { |
32 | kind = PathKind::Abs; | 32 | kind = PathKind::Abs; |
33 | } | 33 | } |
34 | 34 | ||
diff --git a/crates/ra_hir_def/src/path/lower/lower_use.rs b/crates/ra_hir_def/src/path/lower/lower_use.rs index 6ec944228..5b6854b0f 100644 --- a/crates/ra_hir_def/src/path/lower/lower_use.rs +++ b/crates/ra_hir_def/src/path/lower/lower_use.rs | |||
@@ -34,7 +34,7 @@ pub(crate) fn lower_use_tree( | |||
34 | let alias = tree.alias().map(|a| { | 34 | let alias = tree.alias().map(|a| { |
35 | a.name().map(|it| it.as_name()).map_or(ImportAlias::Underscore, ImportAlias::Alias) | 35 | a.name().map(|it| it.as_name()).map_or(ImportAlias::Underscore, ImportAlias::Alias) |
36 | }); | 36 | }); |
37 | let is_glob = tree.star().is_some(); | 37 | let is_glob = tree.star_token().is_some(); |
38 | if let Some(ast_path) = tree.path() { | 38 | if let Some(ast_path) = tree.path() { |
39 | // Handle self in a path. | 39 | // Handle self in a path. |
40 | // E.g. `use something::{self, <...>}` | 40 | // E.g. `use something::{self, <...>}` |
diff --git a/crates/ra_hir_def/src/type_ref.rs b/crates/ra_hir_def/src/type_ref.rs index 01cc392db..ea29c4176 100644 --- a/crates/ra_hir_def/src/type_ref.rs +++ b/crates/ra_hir_def/src/type_ref.rs | |||
@@ -77,7 +77,7 @@ impl TypeRef { | |||
77 | } | 77 | } |
78 | ast::TypeRef::PointerType(inner) => { | 78 | ast::TypeRef::PointerType(inner) => { |
79 | let inner_ty = TypeRef::from_ast_opt(inner.type_ref()); | 79 | let inner_ty = TypeRef::from_ast_opt(inner.type_ref()); |
80 | let mutability = Mutability::from_mutable(inner.is_mut()); | 80 | let mutability = Mutability::from_mutable(inner.mut_token().is_some()); |
81 | TypeRef::RawPtr(Box::new(inner_ty), mutability) | 81 | TypeRef::RawPtr(Box::new(inner_ty), mutability) |
82 | } | 82 | } |
83 | ast::TypeRef::ArrayType(inner) => { | 83 | ast::TypeRef::ArrayType(inner) => { |
@@ -88,7 +88,7 @@ impl TypeRef { | |||
88 | } | 88 | } |
89 | ast::TypeRef::ReferenceType(inner) => { | 89 | ast::TypeRef::ReferenceType(inner) => { |
90 | let inner_ty = TypeRef::from_ast_opt(inner.type_ref()); | 90 | let inner_ty = TypeRef::from_ast_opt(inner.type_ref()); |
91 | let mutability = Mutability::from_mutable(inner.is_mut()); | 91 | let mutability = Mutability::from_mutable(inner.mut_token().is_some()); |
92 | TypeRef::Reference(Box::new(inner_ty), mutability) | 92 | TypeRef::Reference(Box::new(inner_ty), mutability) |
93 | } | 93 | } |
94 | ast::TypeRef::PlaceholderType(_inner) => TypeRef::Placeholder, | 94 | ast::TypeRef::PlaceholderType(_inner) => TypeRef::Placeholder, |
diff --git a/crates/ra_hir_expand/src/ast_id_map.rs b/crates/ra_hir_expand/src/ast_id_map.rs index 5643ecdce..a3ca302c2 100644 --- a/crates/ra_hir_expand/src/ast_id_map.rs +++ b/crates/ra_hir_expand/src/ast_id_map.rs | |||
@@ -90,7 +90,7 @@ impl AstIdMap { | |||
90 | } | 90 | } |
91 | 91 | ||
92 | pub(crate) fn get<N: AstNode>(&self, id: FileAstId<N>) -> AstPtr<N> { | 92 | pub(crate) fn get<N: AstNode>(&self, id: FileAstId<N>) -> AstPtr<N> { |
93 | self.arena[id.raw].cast::<N>().unwrap() | 93 | self.arena[id.raw].clone().cast::<N>().unwrap() |
94 | } | 94 | } |
95 | 95 | ||
96 | fn alloc(&mut self, item: &SyntaxNode) -> ErasedFileAstId { | 96 | fn alloc(&mut self, item: &SyntaxNode) -> ErasedFileAstId { |
diff --git a/crates/ra_hir_expand/src/quote.rs b/crates/ra_hir_expand/src/quote.rs index 3fd4233da..219bc2097 100644 --- a/crates/ra_hir_expand/src/quote.rs +++ b/crates/ra_hir_expand/src/quote.rs | |||
@@ -232,7 +232,7 @@ mod tests { | |||
232 | let quoted = quote!(#a); | 232 | let quoted = quote!(#a); |
233 | assert_eq!(quoted.to_string(), "hello"); | 233 | assert_eq!(quoted.to_string(), "hello"); |
234 | let t = format!("{:?}", quoted); | 234 | let t = format!("{:?}", quoted); |
235 | assert_eq!(t, "Subtree { delimiter: None, token_trees: [Leaf(Ident(Ident { text: \"hello\", id: TokenId(4294967295) }))] }"); | 235 | assert_eq!(t, "SUBTREE $\n IDENT hello 4294967295"); |
236 | } | 236 | } |
237 | 237 | ||
238 | #[test] | 238 | #[test] |
diff --git a/crates/ra_hir_ty/Cargo.toml b/crates/ra_hir_ty/Cargo.toml index 9a4a7aa6f..59efc1c31 100644 --- a/crates/ra_hir_ty/Cargo.toml +++ b/crates/ra_hir_ty/Cargo.toml | |||
@@ -24,6 +24,8 @@ ra_prof = { path = "../ra_prof" } | |||
24 | ra_syntax = { path = "../ra_syntax" } | 24 | ra_syntax = { path = "../ra_syntax" } |
25 | test_utils = { path = "../test_utils" } | 25 | test_utils = { path = "../test_utils" } |
26 | 26 | ||
27 | scoped-tls = "1" | ||
28 | |||
27 | chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "039fc904a05f8cb3d0c682c9a57a63dda7a35356" } | 29 | chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "039fc904a05f8cb3d0c682c9a57a63dda7a35356" } |
28 | chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "039fc904a05f8cb3d0c682c9a57a63dda7a35356" } | 30 | chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "039fc904a05f8cb3d0c682c9a57a63dda7a35356" } |
29 | chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "039fc904a05f8cb3d0c682c9a57a63dda7a35356" } | 31 | chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "039fc904a05f8cb3d0c682c9a57a63dda7a35356" } |
diff --git a/crates/ra_hir_ty/src/db.rs b/crates/ra_hir_ty/src/db.rs index 1462b053f..33da16b48 100644 --- a/crates/ra_hir_ty/src/db.rs +++ b/crates/ra_hir_ty/src/db.rs | |||
@@ -11,7 +11,7 @@ use ra_db::{impl_intern_key, salsa, CrateId, Upcast}; | |||
11 | use ra_prof::profile; | 11 | use ra_prof::profile; |
12 | 12 | ||
13 | use crate::{ | 13 | use crate::{ |
14 | method_resolution::CrateImplDefs, | 14 | method_resolution::{CrateImplDefs, TyFingerprint}, |
15 | traits::{chalk, AssocTyValue, Impl}, | 15 | traits::{chalk, AssocTyValue, Impl}, |
16 | Binders, CallableDef, GenericPredicate, InferenceResult, PolyFnSig, Substs, TraitRef, Ty, | 16 | Binders, CallableDef, GenericPredicate, InferenceResult, PolyFnSig, Substs, TraitRef, Ty, |
17 | TyDefId, TypeCtor, ValueTyDefId, | 17 | TyDefId, TypeCtor, ValueTyDefId, |
@@ -65,7 +65,12 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> { | |||
65 | fn impls_in_crate(&self, krate: CrateId) -> Arc<CrateImplDefs>; | 65 | fn impls_in_crate(&self, krate: CrateId) -> Arc<CrateImplDefs>; |
66 | 66 | ||
67 | #[salsa::invoke(crate::traits::impls_for_trait_query)] | 67 | #[salsa::invoke(crate::traits::impls_for_trait_query)] |
68 | fn impls_for_trait(&self, krate: CrateId, trait_: TraitId) -> Arc<[ImplId]>; | 68 | fn impls_for_trait( |
69 | &self, | ||
70 | krate: CrateId, | ||
71 | trait_: TraitId, | ||
72 | self_ty_fp: Option<TyFingerprint>, | ||
73 | ) -> Arc<[ImplId]>; | ||
69 | 74 | ||
70 | // Interned IDs for Chalk integration | 75 | // Interned IDs for Chalk integration |
71 | #[salsa::interned] | 76 | #[salsa::interned] |
diff --git a/crates/ra_hir_ty/src/diagnostics.rs b/crates/ra_hir_ty/src/diagnostics.rs index 8cbce1168..927896d6f 100644 --- a/crates/ra_hir_ty/src/diagnostics.rs +++ b/crates/ra_hir_ty/src/diagnostics.rs | |||
@@ -21,7 +21,7 @@ impl Diagnostic for NoSuchField { | |||
21 | } | 21 | } |
22 | 22 | ||
23 | fn source(&self) -> InFile<SyntaxNodePtr> { | 23 | fn source(&self) -> InFile<SyntaxNodePtr> { |
24 | InFile { file_id: self.file, value: self.field.into() } | 24 | InFile { file_id: self.file, value: self.field.clone().into() } |
25 | } | 25 | } |
26 | 26 | ||
27 | fn as_any(&self) -> &(dyn Any + Send + 'static) { | 27 | fn as_any(&self) -> &(dyn Any + Send + 'static) { |
@@ -45,7 +45,7 @@ impl Diagnostic for MissingFields { | |||
45 | buf | 45 | buf |
46 | } | 46 | } |
47 | fn source(&self) -> InFile<SyntaxNodePtr> { | 47 | fn source(&self) -> InFile<SyntaxNodePtr> { |
48 | InFile { file_id: self.file, value: self.field_list.into() } | 48 | InFile { file_id: self.file, value: self.field_list.clone().into() } |
49 | } | 49 | } |
50 | fn as_any(&self) -> &(dyn Any + Send + 'static) { | 50 | fn as_any(&self) -> &(dyn Any + Send + 'static) { |
51 | self | 51 | self |
@@ -63,6 +63,29 @@ impl AstDiagnostic for MissingFields { | |||
63 | } | 63 | } |
64 | 64 | ||
65 | #[derive(Debug)] | 65 | #[derive(Debug)] |
66 | pub struct MissingPatFields { | ||
67 | pub file: HirFileId, | ||
68 | pub field_list: AstPtr<ast::RecordFieldPatList>, | ||
69 | pub missed_fields: Vec<Name>, | ||
70 | } | ||
71 | |||
72 | impl Diagnostic for MissingPatFields { | ||
73 | fn message(&self) -> String { | ||
74 | let mut buf = String::from("Missing structure fields:\n"); | ||
75 | for field in &self.missed_fields { | ||
76 | format_to!(buf, "- {}", field); | ||
77 | } | ||
78 | buf | ||
79 | } | ||
80 | fn source(&self) -> InFile<SyntaxNodePtr> { | ||
81 | InFile { file_id: self.file, value: self.field_list.clone().into() } | ||
82 | } | ||
83 | fn as_any(&self) -> &(dyn Any + Send + 'static) { | ||
84 | self | ||
85 | } | ||
86 | } | ||
87 | |||
88 | #[derive(Debug)] | ||
66 | pub struct MissingMatchArms { | 89 | pub struct MissingMatchArms { |
67 | pub file: HirFileId, | 90 | pub file: HirFileId, |
68 | pub match_expr: AstPtr<ast::Expr>, | 91 | pub match_expr: AstPtr<ast::Expr>, |
@@ -74,7 +97,7 @@ impl Diagnostic for MissingMatchArms { | |||
74 | String::from("Missing match arm") | 97 | String::from("Missing match arm") |
75 | } | 98 | } |
76 | fn source(&self) -> InFile<SyntaxNodePtr> { | 99 | fn source(&self) -> InFile<SyntaxNodePtr> { |
77 | InFile { file_id: self.file, value: self.match_expr.into() } | 100 | InFile { file_id: self.file, value: self.match_expr.clone().into() } |
78 | } | 101 | } |
79 | fn as_any(&self) -> &(dyn Any + Send + 'static) { | 102 | fn as_any(&self) -> &(dyn Any + Send + 'static) { |
80 | self | 103 | self |
@@ -92,7 +115,7 @@ impl Diagnostic for MissingOkInTailExpr { | |||
92 | "wrap return expression in Ok".to_string() | 115 | "wrap return expression in Ok".to_string() |
93 | } | 116 | } |
94 | fn source(&self) -> InFile<SyntaxNodePtr> { | 117 | fn source(&self) -> InFile<SyntaxNodePtr> { |
95 | InFile { file_id: self.file, value: self.expr.into() } | 118 | InFile { file_id: self.file, value: self.expr.clone().into() } |
96 | } | 119 | } |
97 | fn as_any(&self) -> &(dyn Any + Send + 'static) { | 120 | fn as_any(&self) -> &(dyn Any + Send + 'static) { |
98 | self | 121 | self |
diff --git a/crates/ra_hir_ty/src/display.rs b/crates/ra_hir_ty/src/display.rs index 0e9313aa1..d03bbd5a7 100644 --- a/crates/ra_hir_ty/src/display.rs +++ b/crates/ra_hir_ty/src/display.rs | |||
@@ -247,19 +247,21 @@ impl HirDisplay for ApplicationTy { | |||
247 | } | 247 | } |
248 | } | 248 | } |
249 | TypeCtor::Closure { .. } => { | 249 | TypeCtor::Closure { .. } => { |
250 | let sig = self.parameters[0] | 250 | let sig = self.parameters[0].callable_sig(f.db); |
251 | .callable_sig(f.db) | 251 | if let Some(sig) = sig { |
252 | .expect("first closure parameter should contain signature"); | 252 | if sig.params().is_empty() { |
253 | if sig.params().is_empty() { | 253 | write!(f, "||")?; |
254 | write!(f, "||")?; | 254 | } else if f.omit_verbose_types() { |
255 | } else if f.omit_verbose_types() { | 255 | write!(f, "|{}|", TYPE_HINT_TRUNCATION)?; |
256 | write!(f, "|{}|", TYPE_HINT_TRUNCATION)?; | 256 | } else { |
257 | write!(f, "|")?; | ||
258 | f.write_joined(sig.params(), ", ")?; | ||
259 | write!(f, "|")?; | ||
260 | }; | ||
261 | write!(f, " -> {}", sig.ret().display(f.db))?; | ||
257 | } else { | 262 | } else { |
258 | write!(f, "|")?; | 263 | write!(f, "{{closure}}")?; |
259 | f.write_joined(sig.params(), ", ")?; | 264 | } |
260 | write!(f, "|")?; | ||
261 | }; | ||
262 | write!(f, " -> {}", sig.ret().display(f.db))?; | ||
263 | } | 265 | } |
264 | } | 266 | } |
265 | Ok(()) | 267 | Ok(()) |
diff --git a/crates/ra_hir_ty/src/expr.rs b/crates/ra_hir_ty/src/expr.rs index e45e9ea14..69b527f74 100644 --- a/crates/ra_hir_ty/src/expr.rs +++ b/crates/ra_hir_ty/src/expr.rs | |||
@@ -9,7 +9,7 @@ use rustc_hash::FxHashSet; | |||
9 | 9 | ||
10 | use crate::{ | 10 | use crate::{ |
11 | db::HirDatabase, | 11 | db::HirDatabase, |
12 | diagnostics::{MissingFields, MissingMatchArms, MissingOkInTailExpr}, | 12 | diagnostics::{MissingFields, MissingMatchArms, MissingOkInTailExpr, MissingPatFields}, |
13 | utils::variant_data, | 13 | utils::variant_data, |
14 | ApplicationTy, InferenceResult, Ty, TypeCtor, | 14 | ApplicationTy, InferenceResult, Ty, TypeCtor, |
15 | _match::{is_useful, MatchCheckCtx, Matrix, PatStack, Usefulness}, | 15 | _match::{is_useful, MatchCheckCtx, Matrix, PatStack, Usefulness}, |
@@ -49,39 +49,95 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
49 | if let Some((variant_def, missed_fields, true)) = | 49 | if let Some((variant_def, missed_fields, true)) = |
50 | record_literal_missing_fields(db, &self.infer, id, expr) | 50 | record_literal_missing_fields(db, &self.infer, id, expr) |
51 | { | 51 | { |
52 | // XXX: only look at source_map if we do have missing fields | 52 | self.create_record_literal_missing_fields_diagnostic( |
53 | let (_, source_map) = db.body_with_source_map(self.func.into()); | 53 | id, |
54 | 54 | db, | |
55 | if let Ok(source_ptr) = source_map.expr_syntax(id) { | 55 | variant_def, |
56 | if let Some(expr) = source_ptr.value.left() { | 56 | missed_fields, |
57 | let root = source_ptr.file_syntax(db.upcast()); | 57 | ); |
58 | if let ast::Expr::RecordLit(record_lit) = expr.to_node(&root) { | ||
59 | if let Some(field_list) = record_lit.record_field_list() { | ||
60 | let variant_data = variant_data(db.upcast(), variant_def); | ||
61 | let missed_fields = missed_fields | ||
62 | .into_iter() | ||
63 | .map(|idx| variant_data.fields()[idx].name.clone()) | ||
64 | .collect(); | ||
65 | self.sink.push(MissingFields { | ||
66 | file: source_ptr.file_id, | ||
67 | field_list: AstPtr::new(&field_list), | ||
68 | missed_fields, | ||
69 | }) | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | } | ||
74 | } | 58 | } |
75 | if let Expr::Match { expr, arms } = expr { | 59 | if let Expr::Match { expr, arms } = expr { |
76 | self.validate_match(id, *expr, arms, db, self.infer.clone()); | 60 | self.validate_match(id, *expr, arms, db, self.infer.clone()); |
77 | } | 61 | } |
78 | } | 62 | } |
63 | for (id, pat) in body.pats.iter() { | ||
64 | if let Some((variant_def, missed_fields, true)) = | ||
65 | record_pattern_missing_fields(db, &self.infer, id, pat) | ||
66 | { | ||
67 | self.create_record_pattern_missing_fields_diagnostic( | ||
68 | id, | ||
69 | db, | ||
70 | variant_def, | ||
71 | missed_fields, | ||
72 | ); | ||
73 | } | ||
74 | } | ||
79 | let body_expr = &body[body.body_expr]; | 75 | let body_expr = &body[body.body_expr]; |
80 | if let Expr::Block { tail: Some(t), .. } = body_expr { | 76 | if let Expr::Block { tail: Some(t), .. } = body_expr { |
81 | self.validate_results_in_tail_expr(body.body_expr, *t, db); | 77 | self.validate_results_in_tail_expr(body.body_expr, *t, db); |
82 | } | 78 | } |
83 | } | 79 | } |
84 | 80 | ||
81 | fn create_record_literal_missing_fields_diagnostic( | ||
82 | &mut self, | ||
83 | id: ExprId, | ||
84 | db: &dyn HirDatabase, | ||
85 | variant_def: VariantId, | ||
86 | missed_fields: Vec<LocalStructFieldId>, | ||
87 | ) { | ||
88 | // XXX: only look at source_map if we do have missing fields | ||
89 | let (_, source_map) = db.body_with_source_map(self.func.into()); | ||
90 | |||
91 | if let Ok(source_ptr) = source_map.expr_syntax(id) { | ||
92 | let root = source_ptr.file_syntax(db.upcast()); | ||
93 | if let ast::Expr::RecordLit(record_lit) = &source_ptr.value.to_node(&root) { | ||
94 | if let Some(field_list) = record_lit.record_field_list() { | ||
95 | let variant_data = variant_data(db.upcast(), variant_def); | ||
96 | let missed_fields = missed_fields | ||
97 | .into_iter() | ||
98 | .map(|idx| variant_data.fields()[idx].name.clone()) | ||
99 | .collect(); | ||
100 | self.sink.push(MissingFields { | ||
101 | file: source_ptr.file_id, | ||
102 | field_list: AstPtr::new(&field_list), | ||
103 | missed_fields, | ||
104 | }) | ||
105 | } | ||
106 | } | ||
107 | } | ||
108 | } | ||
109 | |||
110 | fn create_record_pattern_missing_fields_diagnostic( | ||
111 | &mut self, | ||
112 | id: PatId, | ||
113 | db: &dyn HirDatabase, | ||
114 | variant_def: VariantId, | ||
115 | missed_fields: Vec<LocalStructFieldId>, | ||
116 | ) { | ||
117 | // XXX: only look at source_map if we do have missing fields | ||
118 | let (_, source_map) = db.body_with_source_map(self.func.into()); | ||
119 | |||
120 | if let Ok(source_ptr) = source_map.pat_syntax(id) { | ||
121 | if let Some(expr) = source_ptr.value.as_ref().left() { | ||
122 | let root = source_ptr.file_syntax(db.upcast()); | ||
123 | if let ast::Pat::RecordPat(record_pat) = expr.to_node(&root) { | ||
124 | if let Some(field_list) = record_pat.record_field_pat_list() { | ||
125 | let variant_data = variant_data(db.upcast(), variant_def); | ||
126 | let missed_fields = missed_fields | ||
127 | .into_iter() | ||
128 | .map(|idx| variant_data.fields()[idx].name.clone()) | ||
129 | .collect(); | ||
130 | self.sink.push(MissingPatFields { | ||
131 | file: source_ptr.file_id, | ||
132 | field_list: AstPtr::new(&field_list), | ||
133 | missed_fields, | ||
134 | }) | ||
135 | } | ||
136 | } | ||
137 | } | ||
138 | } | ||
139 | } | ||
140 | |||
85 | fn validate_match( | 141 | fn validate_match( |
86 | &mut self, | 142 | &mut self, |
87 | id: ExprId, | 143 | id: ExprId, |
@@ -147,18 +203,16 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
147 | } | 203 | } |
148 | 204 | ||
149 | if let Ok(source_ptr) = source_map.expr_syntax(id) { | 205 | if let Ok(source_ptr) = source_map.expr_syntax(id) { |
150 | if let Some(expr) = source_ptr.value.left() { | 206 | let root = source_ptr.file_syntax(db.upcast()); |
151 | let root = source_ptr.file_syntax(db.upcast()); | 207 | if let ast::Expr::MatchExpr(match_expr) = &source_ptr.value.to_node(&root) { |
152 | if let ast::Expr::MatchExpr(match_expr) = expr.to_node(&root) { | 208 | if let (Some(match_expr), Some(arms)) = |
153 | if let (Some(match_expr), Some(arms)) = | 209 | (match_expr.expr(), match_expr.match_arm_list()) |
154 | (match_expr.expr(), match_expr.match_arm_list()) | 210 | { |
155 | { | 211 | self.sink.push(MissingMatchArms { |
156 | self.sink.push(MissingMatchArms { | 212 | file: source_ptr.file_id, |
157 | file: source_ptr.file_id, | 213 | match_expr: AstPtr::new(&match_expr), |
158 | match_expr: AstPtr::new(&match_expr), | 214 | arms: AstPtr::new(&arms), |
159 | arms: AstPtr::new(&arms), | 215 | }) |
160 | }) | ||
161 | } | ||
162 | } | 216 | } |
163 | } | 217 | } |
164 | } | 218 | } |
@@ -189,9 +243,8 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
189 | let (_, source_map) = db.body_with_source_map(self.func.into()); | 243 | let (_, source_map) = db.body_with_source_map(self.func.into()); |
190 | 244 | ||
191 | if let Ok(source_ptr) = source_map.expr_syntax(id) { | 245 | if let Ok(source_ptr) = source_map.expr_syntax(id) { |
192 | if let Some(expr) = source_ptr.value.left() { | 246 | self.sink |
193 | self.sink.push(MissingOkInTailExpr { file: source_ptr.file_id, expr }); | 247 | .push(MissingOkInTailExpr { file: source_ptr.file_id, expr: source_ptr.value }); |
194 | } | ||
195 | } | 248 | } |
196 | } | 249 | } |
197 | } | 250 | } |
@@ -232,9 +285,9 @@ pub fn record_pattern_missing_fields( | |||
232 | infer: &InferenceResult, | 285 | infer: &InferenceResult, |
233 | id: PatId, | 286 | id: PatId, |
234 | pat: &Pat, | 287 | pat: &Pat, |
235 | ) -> Option<(VariantId, Vec<LocalStructFieldId>)> { | 288 | ) -> Option<(VariantId, Vec<LocalStructFieldId>, /*exhaustive*/ bool)> { |
236 | let fields = match pat { | 289 | let (fields, exhaustive) = match pat { |
237 | Pat::Record { path: _, args } => args, | 290 | Pat::Record { path: _, args, ellipsis } => (args, !ellipsis), |
238 | _ => return None, | 291 | _ => return None, |
239 | }; | 292 | }; |
240 | 293 | ||
@@ -254,5 +307,5 @@ pub fn record_pattern_missing_fields( | |||
254 | if missed_fields.is_empty() { | 307 | if missed_fields.is_empty() { |
255 | return None; | 308 | return None; |
256 | } | 309 | } |
257 | Some((variant_def, missed_fields)) | 310 | Some((variant_def, missed_fields, exhaustive)) |
258 | } | 311 | } |
diff --git a/crates/ra_hir_ty/src/infer/pat.rs b/crates/ra_hir_ty/src/infer/pat.rs index 69bbb4307..078476f76 100644 --- a/crates/ra_hir_ty/src/infer/pat.rs +++ b/crates/ra_hir_ty/src/infer/pat.rs | |||
@@ -158,7 +158,7 @@ impl<'a> InferenceContext<'a> { | |||
158 | Pat::TupleStruct { path: p, args: subpats } => { | 158 | Pat::TupleStruct { path: p, args: subpats } => { |
159 | self.infer_tuple_struct_pat(p.as_ref(), subpats, expected, default_bm, pat) | 159 | self.infer_tuple_struct_pat(p.as_ref(), subpats, expected, default_bm, pat) |
160 | } | 160 | } |
161 | Pat::Record { path: p, args: fields } => { | 161 | Pat::Record { path: p, args: fields, ellipsis: _ } => { |
162 | self.infer_record_pat(p.as_ref(), fields, expected, default_bm, pat) | 162 | self.infer_record_pat(p.as_ref(), fields, expected, default_bm, pat) |
163 | } | 163 | } |
164 | Pat::Path(path) => { | 164 | Pat::Path(path) => { |
diff --git a/crates/ra_hir_ty/src/method_resolution.rs b/crates/ra_hir_ty/src/method_resolution.rs index 74a0bc7db..657284fd0 100644 --- a/crates/ra_hir_ty/src/method_resolution.rs +++ b/crates/ra_hir_ty/src/method_resolution.rs | |||
@@ -34,7 +34,7 @@ impl TyFingerprint { | |||
34 | /// Creates a TyFingerprint for looking up an impl. Only certain types can | 34 | /// Creates a TyFingerprint for looking up an impl. Only certain types can |
35 | /// have impls: if we have some `struct S`, we can have an `impl S`, but not | 35 | /// have impls: if we have some `struct S`, we can have an `impl S`, but not |
36 | /// `impl &S`. Hence, this will return `None` for reference types and such. | 36 | /// `impl &S`. Hence, this will return `None` for reference types and such. |
37 | fn for_impl(ty: &Ty) -> Option<TyFingerprint> { | 37 | pub(crate) fn for_impl(ty: &Ty) -> Option<TyFingerprint> { |
38 | match ty { | 38 | match ty { |
39 | Ty::Apply(a_ty) => Some(TyFingerprint::Apply(a_ty.ctor)), | 39 | Ty::Apply(a_ty) => Some(TyFingerprint::Apply(a_ty.ctor)), |
40 | _ => None, | 40 | _ => None, |
@@ -45,7 +45,7 @@ impl TyFingerprint { | |||
45 | #[derive(Debug, PartialEq, Eq)] | 45 | #[derive(Debug, PartialEq, Eq)] |
46 | pub struct CrateImplDefs { | 46 | pub struct CrateImplDefs { |
47 | impls: FxHashMap<TyFingerprint, Vec<ImplId>>, | 47 | impls: FxHashMap<TyFingerprint, Vec<ImplId>>, |
48 | impls_by_trait: FxHashMap<TraitId, Vec<ImplId>>, | 48 | impls_by_trait: FxHashMap<TraitId, FxHashMap<Option<TyFingerprint>, Vec<ImplId>>>, |
49 | } | 49 | } |
50 | 50 | ||
51 | impl CrateImplDefs { | 51 | impl CrateImplDefs { |
@@ -59,7 +59,14 @@ impl CrateImplDefs { | |||
59 | for impl_id in module_data.scope.impls() { | 59 | for impl_id in module_data.scope.impls() { |
60 | match db.impl_trait(impl_id) { | 60 | match db.impl_trait(impl_id) { |
61 | Some(tr) => { | 61 | Some(tr) => { |
62 | res.impls_by_trait.entry(tr.value.trait_).or_default().push(impl_id); | 62 | let self_ty = db.impl_self_ty(impl_id); |
63 | let self_ty_fp = TyFingerprint::for_impl(&self_ty.value); | ||
64 | res.impls_by_trait | ||
65 | .entry(tr.value.trait_) | ||
66 | .or_default() | ||
67 | .entry(self_ty_fp) | ||
68 | .or_default() | ||
69 | .push(impl_id); | ||
63 | } | 70 | } |
64 | None => { | 71 | None => { |
65 | let self_ty = db.impl_self_ty(impl_id); | 72 | let self_ty = db.impl_self_ty(impl_id); |
@@ -79,11 +86,39 @@ impl CrateImplDefs { | |||
79 | } | 86 | } |
80 | 87 | ||
81 | pub fn lookup_impl_defs_for_trait(&self, tr: TraitId) -> impl Iterator<Item = ImplId> + '_ { | 88 | pub fn lookup_impl_defs_for_trait(&self, tr: TraitId) -> impl Iterator<Item = ImplId> + '_ { |
82 | self.impls_by_trait.get(&tr).into_iter().flatten().copied() | 89 | self.impls_by_trait |
90 | .get(&tr) | ||
91 | .into_iter() | ||
92 | .flat_map(|m| m.values().flat_map(|v| v.iter().copied())) | ||
93 | } | ||
94 | |||
95 | pub fn lookup_impl_defs_for_trait_and_ty( | ||
96 | &self, | ||
97 | tr: TraitId, | ||
98 | fp: TyFingerprint, | ||
99 | ) -> impl Iterator<Item = ImplId> + '_ { | ||
100 | self.impls_by_trait | ||
101 | .get(&tr) | ||
102 | .and_then(|m| m.get(&Some(fp))) | ||
103 | .into_iter() | ||
104 | .flatten() | ||
105 | .copied() | ||
106 | .chain( | ||
107 | self.impls_by_trait | ||
108 | .get(&tr) | ||
109 | .and_then(|m| m.get(&None)) | ||
110 | .into_iter() | ||
111 | .flatten() | ||
112 | .copied(), | ||
113 | ) | ||
83 | } | 114 | } |
84 | 115 | ||
85 | pub fn all_impls<'a>(&'a self) -> impl Iterator<Item = ImplId> + 'a { | 116 | pub fn all_impls<'a>(&'a self) -> impl Iterator<Item = ImplId> + 'a { |
86 | self.impls.values().chain(self.impls_by_trait.values()).flatten().copied() | 117 | self.impls |
118 | .values() | ||
119 | .chain(self.impls_by_trait.values().flat_map(|m| m.values())) | ||
120 | .flatten() | ||
121 | .copied() | ||
87 | } | 122 | } |
88 | } | 123 | } |
89 | 124 | ||
diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/ra_hir_ty/src/tests.rs index 08723068f..81fc0f63a 100644 --- a/crates/ra_hir_ty/src/tests.rs +++ b/crates/ra_hir_ty/src/tests.rs | |||
@@ -23,7 +23,7 @@ use insta::assert_snapshot; | |||
23 | use ra_db::{fixture::WithFixture, salsa::Database, FilePosition, SourceDatabase}; | 23 | use ra_db::{fixture::WithFixture, salsa::Database, FilePosition, SourceDatabase}; |
24 | use ra_syntax::{ | 24 | use ra_syntax::{ |
25 | algo, | 25 | algo, |
26 | ast::{self, AstNode, AstToken}, | 26 | ast::{self, AstNode}, |
27 | }; | 27 | }; |
28 | use stdx::format_to; | 28 | use stdx::format_to; |
29 | 29 | ||
@@ -82,12 +82,10 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String { | |||
82 | 82 | ||
83 | for (expr, ty) in inference_result.type_of_expr.iter() { | 83 | for (expr, ty) in inference_result.type_of_expr.iter() { |
84 | let syntax_ptr = match body_source_map.expr_syntax(expr) { | 84 | let syntax_ptr = match body_source_map.expr_syntax(expr) { |
85 | Ok(sp) => { | 85 | Ok(sp) => sp.map(|ast| ast.syntax_node_ptr()), |
86 | sp.map(|ast| ast.either(|it| it.syntax_node_ptr(), |it| it.syntax_node_ptr())) | ||
87 | } | ||
88 | Err(SyntheticSyntax) => continue, | 86 | Err(SyntheticSyntax) => continue, |
89 | }; | 87 | }; |
90 | types.push((syntax_ptr, ty)); | 88 | types.push((syntax_ptr.clone(), ty)); |
91 | if let Some(mismatch) = inference_result.type_mismatch_for_expr(expr) { | 89 | if let Some(mismatch) = inference_result.type_mismatch_for_expr(expr) { |
92 | mismatches.push((syntax_ptr, mismatch)); | 90 | mismatches.push((syntax_ptr, mismatch)); |
93 | } | 91 | } |
@@ -101,7 +99,7 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String { | |||
101 | let node = src_ptr.value.to_node(&src_ptr.file_syntax(&db)); | 99 | let node = src_ptr.value.to_node(&src_ptr.file_syntax(&db)); |
102 | 100 | ||
103 | let (range, text) = if let Some(self_param) = ast::SelfParam::cast(node.clone()) { | 101 | let (range, text) = if let Some(self_param) = ast::SelfParam::cast(node.clone()) { |
104 | (self_param.self_kw().unwrap().syntax().text_range(), "self".to_string()) | 102 | (self_param.self_token().unwrap().text_range(), "self".to_string()) |
105 | } else { | 103 | } else { |
106 | (src_ptr.value.range(), node.text().to_string().replace("\n", " ")) | 104 | (src_ptr.value.range(), node.text().to_string().replace("\n", " ")) |
107 | }; | 105 | }; |
@@ -409,3 +407,43 @@ fn no_such_field_with_feature_flag_diagnostics_on_struct_fields() { | |||
409 | 407 | ||
410 | assert_snapshot!(diagnostics, @r###""###); | 408 | assert_snapshot!(diagnostics, @r###""###); |
411 | } | 409 | } |
410 | |||
411 | #[test] | ||
412 | fn missing_record_pat_field_diagnostic() { | ||
413 | let diagnostics = TestDB::with_files( | ||
414 | r" | ||
415 | //- /lib.rs | ||
416 | struct S { foo: i32, bar: () } | ||
417 | fn baz(s: S) { | ||
418 | let S { foo: _ } = s; | ||
419 | } | ||
420 | ", | ||
421 | ) | ||
422 | .diagnostics() | ||
423 | .0; | ||
424 | |||
425 | assert_snapshot!(diagnostics, @r###" | ||
426 | "{ foo: _ }": Missing structure fields: | ||
427 | - bar | ||
428 | "### | ||
429 | ); | ||
430 | } | ||
431 | |||
432 | #[test] | ||
433 | fn missing_record_pat_field_no_diagnostic_if_not_exhaustive() { | ||
434 | let diagnostics = TestDB::with_files( | ||
435 | r" | ||
436 | //- /lib.rs | ||
437 | struct S { foo: i32, bar: () } | ||
438 | fn baz(s: S) -> i32 { | ||
439 | match s { | ||
440 | S { foo, .. } => foo, | ||
441 | } | ||
442 | } | ||
443 | ", | ||
444 | ) | ||
445 | .diagnostics() | ||
446 | .0; | ||
447 | |||
448 | assert_snapshot!(diagnostics, @""); | ||
449 | } | ||
diff --git a/crates/ra_hir_ty/src/tests/macros.rs b/crates/ra_hir_ty/src/tests/macros.rs index ff4599b71..f2a9b1c40 100644 --- a/crates/ra_hir_ty/src/tests/macros.rs +++ b/crates/ra_hir_ty/src/tests/macros.rs | |||
@@ -1,10 +1,13 @@ | |||
1 | use std::fs; | ||
2 | |||
1 | use insta::assert_snapshot; | 3 | use insta::assert_snapshot; |
2 | use ra_db::fixture::WithFixture; | 4 | use ra_db::fixture::WithFixture; |
3 | 5 | use test_utils::project_dir; | |
4 | use super::{infer, type_at, type_at_pos}; | ||
5 | 6 | ||
6 | use crate::test_db::TestDB; | 7 | use crate::test_db::TestDB; |
7 | 8 | ||
9 | use super::{infer, type_at, type_at_pos}; | ||
10 | |||
8 | #[test] | 11 | #[test] |
9 | fn cfg_impl_def() { | 12 | fn cfg_impl_def() { |
10 | let (db, pos) = TestDB::with_position( | 13 | let (db, pos) = TestDB::with_position( |
@@ -482,6 +485,30 @@ fn bar() -> u32 {0} | |||
482 | } | 485 | } |
483 | 486 | ||
484 | #[test] | 487 | #[test] |
488 | #[ignore] | ||
489 | fn include_accidentally_quadratic() { | ||
490 | let file = project_dir().join("crates/ra_syntax/test_data/accidentally_quadratic"); | ||
491 | let big_file = fs::read_to_string(file).unwrap(); | ||
492 | let big_file = vec![big_file; 10].join("\n"); | ||
493 | |||
494 | let fixture = r#" | ||
495 | //- /main.rs | ||
496 | #[rustc_builtin_macro] | ||
497 | macro_rules! include {() => {}} | ||
498 | |||
499 | include!("foo.rs"); | ||
500 | |||
501 | fn main() { | ||
502 | RegisterBlock { }<|>; | ||
503 | } | ||
504 | "#; | ||
505 | let fixture = format!("{}\n//- /foo.rs\n{}", fixture, big_file); | ||
506 | |||
507 | let (db, pos) = TestDB::with_position(&fixture); | ||
508 | assert_eq!("RegisterBlock", type_at_pos(&db, pos)); | ||
509 | } | ||
510 | |||
511 | #[test] | ||
485 | fn infer_builtin_macros_include_concat() { | 512 | fn infer_builtin_macros_include_concat() { |
486 | let (db, pos) = TestDB::with_position( | 513 | let (db, pos) = TestDB::with_position( |
487 | r#" | 514 | r#" |
diff --git a/crates/ra_hir_ty/src/traits.rs b/crates/ra_hir_ty/src/traits.rs index 5a1e12ce9..43d8d1e80 100644 --- a/crates/ra_hir_ty/src/traits.rs +++ b/crates/ra_hir_ty/src/traits.rs | |||
@@ -7,7 +7,7 @@ use ra_db::{impl_intern_key, salsa, CrateId}; | |||
7 | use ra_prof::profile; | 7 | use ra_prof::profile; |
8 | use rustc_hash::FxHashSet; | 8 | use rustc_hash::FxHashSet; |
9 | 9 | ||
10 | use crate::{db::HirDatabase, DebruijnIndex}; | 10 | use crate::{db::HirDatabase, method_resolution::TyFingerprint, DebruijnIndex}; |
11 | 11 | ||
12 | use super::{Canonical, GenericPredicate, HirDisplay, ProjectionTy, TraitRef, Ty, TypeWalk}; | 12 | use super::{Canonical, GenericPredicate, HirDisplay, ProjectionTy, TraitRef, Ty, TypeWalk}; |
13 | 13 | ||
@@ -40,7 +40,12 @@ pub(crate) fn impls_for_trait_query( | |||
40 | db: &dyn HirDatabase, | 40 | db: &dyn HirDatabase, |
41 | krate: CrateId, | 41 | krate: CrateId, |
42 | trait_: TraitId, | 42 | trait_: TraitId, |
43 | self_ty_fp: Option<TyFingerprint>, | ||
43 | ) -> Arc<[ImplId]> { | 44 | ) -> Arc<[ImplId]> { |
45 | // FIXME: We could be a lot smarter here - because of the orphan rules and | ||
46 | // the fact that the trait and the self type need to be in the dependency | ||
47 | // tree of a crate somewhere for an impl to exist, we could skip looking in | ||
48 | // a lot of crates completely | ||
44 | let mut impls = FxHashSet::default(); | 49 | let mut impls = FxHashSet::default(); |
45 | // We call the query recursively here. On the one hand, this means we can | 50 | // We call the query recursively here. On the one hand, this means we can |
46 | // reuse results from queries for different crates; on the other hand, this | 51 | // reuse results from queries for different crates; on the other hand, this |
@@ -48,10 +53,13 @@ pub(crate) fn impls_for_trait_query( | |||
48 | // ones the user is editing), so this may actually be a waste of memory. I'm | 53 | // ones the user is editing), so this may actually be a waste of memory. I'm |
49 | // doing it like this mainly for simplicity for now. | 54 | // doing it like this mainly for simplicity for now. |
50 | for dep in &db.crate_graph()[krate].dependencies { | 55 | for dep in &db.crate_graph()[krate].dependencies { |
51 | impls.extend(db.impls_for_trait(dep.crate_id, trait_).iter()); | 56 | impls.extend(db.impls_for_trait(dep.crate_id, trait_, self_ty_fp).iter()); |
52 | } | 57 | } |
53 | let crate_impl_defs = db.impls_in_crate(krate); | 58 | let crate_impl_defs = db.impls_in_crate(krate); |
54 | impls.extend(crate_impl_defs.lookup_impl_defs_for_trait(trait_)); | 59 | match self_ty_fp { |
60 | Some(fp) => impls.extend(crate_impl_defs.lookup_impl_defs_for_trait_and_ty(trait_, fp)), | ||
61 | None => impls.extend(crate_impl_defs.lookup_impl_defs_for_trait(trait_)), | ||
62 | } | ||
55 | impls.into_iter().collect() | 63 | impls.into_iter().collect() |
56 | } | 64 | } |
57 | 65 | ||
@@ -177,7 +185,7 @@ fn solve( | |||
177 | 185 | ||
178 | let fuel = std::cell::Cell::new(CHALK_SOLVER_FUEL); | 186 | let fuel = std::cell::Cell::new(CHALK_SOLVER_FUEL); |
179 | 187 | ||
180 | let solution = solver.solve_limited(&context, goal, || { | 188 | let should_continue = || { |
181 | context.db.check_canceled(); | 189 | context.db.check_canceled(); |
182 | let remaining = fuel.get(); | 190 | let remaining = fuel.get(); |
183 | fuel.set(remaining - 1); | 191 | fuel.set(remaining - 1); |
@@ -185,12 +193,21 @@ fn solve( | |||
185 | log::debug!("fuel exhausted"); | 193 | log::debug!("fuel exhausted"); |
186 | } | 194 | } |
187 | remaining > 0 | 195 | remaining > 0 |
188 | }); | 196 | }; |
197 | let mut solve = || solver.solve_limited(&context, goal, should_continue); | ||
198 | // don't set the TLS for Chalk unless Chalk debugging is active, to make | ||
199 | // extra sure we only use it for debugging | ||
200 | let solution = | ||
201 | if is_chalk_debug() { chalk::tls::set_current_program(db, solve) } else { solve() }; | ||
189 | 202 | ||
190 | log::debug!("solve({:?}) => {:?}", goal, solution); | 203 | log::debug!("solve({:?}) => {:?}", goal, solution); |
191 | solution | 204 | solution |
192 | } | 205 | } |
193 | 206 | ||
207 | fn is_chalk_debug() -> bool { | ||
208 | std::env::var("CHALK_DEBUG").is_ok() | ||
209 | } | ||
210 | |||
194 | fn solution_from_chalk( | 211 | fn solution_from_chalk( |
195 | db: &dyn HirDatabase, | 212 | db: &dyn HirDatabase, |
196 | solution: chalk_solve::Solution<Interner>, | 213 | solution: chalk_solve::Solution<Interner>, |
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs index 1bc0f0713..e05fea843 100644 --- a/crates/ra_hir_ty/src/traits/chalk.rs +++ b/crates/ra_hir_ty/src/traits/chalk.rs | |||
@@ -16,10 +16,12 @@ use ra_db::{ | |||
16 | 16 | ||
17 | use super::{builtin, AssocTyValue, Canonical, ChalkContext, Impl, Obligation}; | 17 | use super::{builtin, AssocTyValue, Canonical, ChalkContext, Impl, Obligation}; |
18 | use crate::{ | 18 | use crate::{ |
19 | db::HirDatabase, display::HirDisplay, utils::generics, ApplicationTy, GenericPredicate, | 19 | db::HirDatabase, display::HirDisplay, method_resolution::TyFingerprint, utils::generics, |
20 | ProjectionTy, Substs, TraitRef, Ty, TypeCtor, | 20 | ApplicationTy, GenericPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, |
21 | }; | 21 | }; |
22 | 22 | ||
23 | pub(super) mod tls; | ||
24 | |||
23 | #[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] | 25 | #[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] |
24 | pub struct Interner; | 26 | pub struct Interner; |
25 | 27 | ||
@@ -33,90 +35,85 @@ impl chalk_ir::interner::Interner for Interner { | |||
33 | type Identifier = TypeAliasId; | 35 | type Identifier = TypeAliasId; |
34 | type DefId = InternId; | 36 | type DefId = InternId; |
35 | 37 | ||
36 | // FIXME: implement these | ||
37 | fn debug_struct_id( | 38 | fn debug_struct_id( |
38 | _type_kind_id: chalk_ir::StructId<Self>, | 39 | type_kind_id: StructId, |
39 | _fmt: &mut fmt::Formatter<'_>, | 40 | fmt: &mut fmt::Formatter<'_>, |
40 | ) -> Option<fmt::Result> { | 41 | ) -> Option<fmt::Result> { |
41 | None | 42 | tls::with_current_program(|prog| Some(prog?.debug_struct_id(type_kind_id, fmt))) |
42 | } | 43 | } |
43 | 44 | ||
44 | fn debug_trait_id( | 45 | fn debug_trait_id(type_kind_id: TraitId, fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> { |
45 | _type_kind_id: chalk_ir::TraitId<Self>, | 46 | tls::with_current_program(|prog| Some(prog?.debug_trait_id(type_kind_id, fmt))) |
46 | _fmt: &mut fmt::Formatter<'_>, | ||
47 | ) -> Option<fmt::Result> { | ||
48 | None | ||
49 | } | 47 | } |
50 | 48 | ||
51 | fn debug_assoc_type_id( | 49 | fn debug_assoc_type_id(id: AssocTypeId, fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> { |
52 | _id: chalk_ir::AssocTypeId<Self>, | 50 | tls::with_current_program(|prog| Some(prog?.debug_assoc_type_id(id, fmt))) |
53 | _fmt: &mut fmt::Formatter<'_>, | ||
54 | ) -> Option<fmt::Result> { | ||
55 | None | ||
56 | } | 51 | } |
57 | 52 | ||
58 | fn debug_alias( | 53 | fn debug_alias( |
59 | _projection: &chalk_ir::AliasTy<Self>, | 54 | alias: &chalk_ir::AliasTy<Interner>, |
60 | _fmt: &mut fmt::Formatter<'_>, | 55 | fmt: &mut fmt::Formatter<'_>, |
61 | ) -> Option<fmt::Result> { | 56 | ) -> Option<fmt::Result> { |
62 | None | 57 | tls::with_current_program(|prog| Some(prog?.debug_alias(alias, fmt))) |
63 | } | 58 | } |
64 | 59 | ||
65 | fn debug_ty(_ty: &chalk_ir::Ty<Self>, _fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> { | 60 | fn debug_ty(ty: &chalk_ir::Ty<Interner>, fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> { |
66 | None | 61 | tls::with_current_program(|prog| Some(prog?.debug_ty(ty, fmt))) |
67 | } | 62 | } |
68 | 63 | ||
69 | fn debug_lifetime( | 64 | fn debug_lifetime( |
70 | _lifetime: &chalk_ir::Lifetime<Self>, | 65 | lifetime: &chalk_ir::Lifetime<Interner>, |
71 | _fmt: &mut fmt::Formatter<'_>, | 66 | fmt: &mut fmt::Formatter<'_>, |
72 | ) -> Option<fmt::Result> { | 67 | ) -> Option<fmt::Result> { |
73 | None | 68 | tls::with_current_program(|prog| Some(prog?.debug_lifetime(lifetime, fmt))) |
74 | } | 69 | } |
75 | 70 | ||
76 | fn debug_parameter( | 71 | fn debug_parameter( |
77 | _parameter: &Parameter<Self>, | 72 | parameter: &Parameter<Interner>, |
78 | _fmt: &mut fmt::Formatter<'_>, | 73 | fmt: &mut fmt::Formatter<'_>, |
79 | ) -> Option<fmt::Result> { | 74 | ) -> Option<fmt::Result> { |
80 | None | 75 | tls::with_current_program(|prog| Some(prog?.debug_parameter(parameter, fmt))) |
81 | } | 76 | } |
82 | 77 | ||
83 | fn debug_goal(_goal: &Goal<Self>, _fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> { | 78 | fn debug_goal(goal: &Goal<Interner>, fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> { |
84 | None | 79 | tls::with_current_program(|prog| Some(prog?.debug_goal(goal, fmt))) |
85 | } | 80 | } |
86 | 81 | ||
87 | fn debug_goals( | 82 | fn debug_goals( |
88 | _goals: &chalk_ir::Goals<Self>, | 83 | goals: &chalk_ir::Goals<Interner>, |
89 | _fmt: &mut fmt::Formatter<'_>, | 84 | fmt: &mut fmt::Formatter<'_>, |
90 | ) -> Option<fmt::Result> { | 85 | ) -> Option<fmt::Result> { |
91 | None | 86 | tls::with_current_program(|prog| Some(prog?.debug_goals(goals, fmt))) |
92 | } | 87 | } |
93 | 88 | ||
94 | fn debug_program_clause_implication( | 89 | fn debug_program_clause_implication( |
95 | _pci: &chalk_ir::ProgramClauseImplication<Self>, | 90 | pci: &chalk_ir::ProgramClauseImplication<Interner>, |
96 | _fmt: &mut fmt::Formatter<'_>, | 91 | fmt: &mut fmt::Formatter<'_>, |
97 | ) -> Option<fmt::Result> { | 92 | ) -> Option<fmt::Result> { |
98 | None | 93 | tls::with_current_program(|prog| Some(prog?.debug_program_clause_implication(pci, fmt))) |
99 | } | 94 | } |
100 | 95 | ||
101 | fn debug_application_ty( | 96 | fn debug_application_ty( |
102 | _application_ty: &chalk_ir::ApplicationTy<Self>, | 97 | application_ty: &chalk_ir::ApplicationTy<Interner>, |
103 | _fmt: &mut fmt::Formatter<'_>, | 98 | fmt: &mut fmt::Formatter<'_>, |
104 | ) -> Option<fmt::Result> { | 99 | ) -> Option<fmt::Result> { |
105 | None | 100 | tls::with_current_program(|prog| Some(prog?.debug_application_ty(application_ty, fmt))) |
106 | } | 101 | } |
107 | 102 | ||
108 | fn debug_substitution( | 103 | fn debug_substitution( |
109 | _substitution: &chalk_ir::Substitution<Self>, | 104 | substitution: &chalk_ir::Substitution<Interner>, |
110 | _fmt: &mut fmt::Formatter<'_>, | 105 | fmt: &mut fmt::Formatter<'_>, |
111 | ) -> Option<fmt::Result> { | 106 | ) -> Option<fmt::Result> { |
112 | None | 107 | tls::with_current_program(|prog| Some(prog?.debug_substitution(substitution, fmt))) |
113 | } | 108 | } |
114 | 109 | ||
115 | fn debug_separator_trait_ref( | 110 | fn debug_separator_trait_ref( |
116 | _separator_trait_ref: &chalk_ir::SeparatorTraitRef<Self>, | 111 | separator_trait_ref: &chalk_ir::SeparatorTraitRef<Interner>, |
117 | _fmt: &mut fmt::Formatter<'_>, | 112 | fmt: &mut fmt::Formatter<'_>, |
118 | ) -> Option<fmt::Result> { | 113 | ) -> Option<fmt::Result> { |
119 | None | 114 | tls::with_current_program(|prog| { |
115 | Some(prog?.debug_separator_trait_ref(separator_trait_ref, fmt)) | ||
116 | }) | ||
120 | } | 117 | } |
121 | 118 | ||
122 | fn intern_ty(&self, ty: chalk_ir::TyData<Self>) -> Box<chalk_ir::TyData<Self>> { | 119 | fn intern_ty(&self, ty: chalk_ir::TyData<Self>) -> Box<chalk_ir::TyData<Self>> { |
@@ -650,19 +647,22 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> { | |||
650 | debug!("impls_for_trait {:?}", trait_id); | 647 | debug!("impls_for_trait {:?}", trait_id); |
651 | let trait_: hir_def::TraitId = from_chalk(self.db, trait_id); | 648 | let trait_: hir_def::TraitId = from_chalk(self.db, trait_id); |
652 | 649 | ||
650 | let ty: Ty = from_chalk(self.db, parameters[0].assert_ty_ref(&Interner).clone()); | ||
651 | |||
652 | let self_ty_fp = TyFingerprint::for_impl(&ty); | ||
653 | |||
653 | // Note: Since we're using impls_for_trait, only impls where the trait | 654 | // Note: Since we're using impls_for_trait, only impls where the trait |
654 | // can be resolved should ever reach Chalk. `impl_datum` relies on that | 655 | // can be resolved should ever reach Chalk. `impl_datum` relies on that |
655 | // and will panic if the trait can't be resolved. | 656 | // and will panic if the trait can't be resolved. |
656 | let mut result: Vec<_> = self | 657 | let mut result: Vec<_> = self |
657 | .db | 658 | .db |
658 | .impls_for_trait(self.krate, trait_) | 659 | .impls_for_trait(self.krate, trait_, self_ty_fp) |
659 | .iter() | 660 | .iter() |
660 | .copied() | 661 | .copied() |
661 | .map(Impl::ImplDef) | 662 | .map(Impl::ImplDef) |
662 | .map(|impl_| impl_.to_chalk(self.db)) | 663 | .map(|impl_| impl_.to_chalk(self.db)) |
663 | .collect(); | 664 | .collect(); |
664 | 665 | ||
665 | let ty: Ty = from_chalk(self.db, parameters[0].assert_ty_ref(&Interner).clone()); | ||
666 | let arg: Option<Ty> = | 666 | let arg: Option<Ty> = |
667 | parameters.get(1).map(|p| from_chalk(self.db, p.assert_ty_ref(&Interner).clone())); | 667 | parameters.get(1).map(|p| from_chalk(self.db, p.assert_ty_ref(&Interner).clone())); |
668 | 668 | ||
diff --git a/crates/ra_hir_ty/src/traits/chalk/tls.rs b/crates/ra_hir_ty/src/traits/chalk/tls.rs new file mode 100644 index 000000000..d9bbb54a5 --- /dev/null +++ b/crates/ra_hir_ty/src/traits/chalk/tls.rs | |||
@@ -0,0 +1,231 @@ | |||
1 | //! Implementation of Chalk debug helper functions using TLS. | ||
2 | use std::fmt; | ||
3 | |||
4 | use chalk_ir::{AliasTy, Goal, Goals, Lifetime, Parameter, ProgramClauseImplication, TypeName}; | ||
5 | |||
6 | use super::{from_chalk, Interner}; | ||
7 | use crate::{db::HirDatabase, CallableDef, TypeCtor}; | ||
8 | use hir_def::{AdtId, AssocContainerId, Lookup, TypeAliasId}; | ||
9 | |||
10 | pub use unsafe_tls::{set_current_program, with_current_program}; | ||
11 | |||
12 | pub struct DebugContext<'a>(&'a (dyn HirDatabase + 'a)); | ||
13 | |||
14 | impl DebugContext<'_> { | ||
15 | pub fn debug_struct_id( | ||
16 | &self, | ||
17 | id: super::StructId, | ||
18 | f: &mut fmt::Formatter<'_>, | ||
19 | ) -> Result<(), fmt::Error> { | ||
20 | let type_ctor: TypeCtor = from_chalk(self.0, TypeName::Struct(id)); | ||
21 | match type_ctor { | ||
22 | TypeCtor::Bool => write!(f, "bool")?, | ||
23 | TypeCtor::Char => write!(f, "char")?, | ||
24 | TypeCtor::Int(t) => write!(f, "{}", t)?, | ||
25 | TypeCtor::Float(t) => write!(f, "{}", t)?, | ||
26 | TypeCtor::Str => write!(f, "str")?, | ||
27 | TypeCtor::Slice => write!(f, "slice")?, | ||
28 | TypeCtor::Array => write!(f, "array")?, | ||
29 | TypeCtor::RawPtr(m) => write!(f, "*{}", m.as_keyword_for_ptr())?, | ||
30 | TypeCtor::Ref(m) => write!(f, "&{}", m.as_keyword_for_ref())?, | ||
31 | TypeCtor::Never => write!(f, "!")?, | ||
32 | TypeCtor::Tuple { .. } => { | ||
33 | write!(f, "()")?; | ||
34 | } | ||
35 | TypeCtor::FnPtr { .. } => { | ||
36 | write!(f, "fn")?; | ||
37 | } | ||
38 | TypeCtor::FnDef(def) => { | ||
39 | let name = match def { | ||
40 | CallableDef::FunctionId(ff) => self.0.function_data(ff).name.clone(), | ||
41 | CallableDef::StructId(s) => self.0.struct_data(s).name.clone(), | ||
42 | CallableDef::EnumVariantId(e) => { | ||
43 | let enum_data = self.0.enum_data(e.parent); | ||
44 | enum_data.variants[e.local_id].name.clone() | ||
45 | } | ||
46 | }; | ||
47 | match def { | ||
48 | CallableDef::FunctionId(_) => write!(f, "{{fn {}}}", name)?, | ||
49 | CallableDef::StructId(_) | CallableDef::EnumVariantId(_) => { | ||
50 | write!(f, "{{ctor {}}}", name)? | ||
51 | } | ||
52 | } | ||
53 | } | ||
54 | TypeCtor::Adt(def_id) => { | ||
55 | let name = match def_id { | ||
56 | AdtId::StructId(it) => self.0.struct_data(it).name.clone(), | ||
57 | AdtId::UnionId(it) => self.0.union_data(it).name.clone(), | ||
58 | AdtId::EnumId(it) => self.0.enum_data(it).name.clone(), | ||
59 | }; | ||
60 | write!(f, "{}", name)?; | ||
61 | } | ||
62 | TypeCtor::AssociatedType(type_alias) => { | ||
63 | let trait_ = match type_alias.lookup(self.0.upcast()).container { | ||
64 | AssocContainerId::TraitId(it) => it, | ||
65 | _ => panic!("not an associated type"), | ||
66 | }; | ||
67 | let trait_name = self.0.trait_data(trait_).name.clone(); | ||
68 | let name = self.0.type_alias_data(type_alias).name.clone(); | ||
69 | write!(f, "{}::{}", trait_name, name)?; | ||
70 | } | ||
71 | TypeCtor::Closure { def, expr } => { | ||
72 | write!(f, "{{closure {:?} in {:?}}}", expr.into_raw(), def)?; | ||
73 | } | ||
74 | } | ||
75 | Ok(()) | ||
76 | } | ||
77 | |||
78 | pub fn debug_trait_id( | ||
79 | &self, | ||
80 | id: super::TraitId, | ||
81 | fmt: &mut fmt::Formatter<'_>, | ||
82 | ) -> Result<(), fmt::Error> { | ||
83 | let trait_: hir_def::TraitId = from_chalk(self.0, id); | ||
84 | let trait_data = self.0.trait_data(trait_); | ||
85 | write!(fmt, "{}", trait_data.name) | ||
86 | } | ||
87 | |||
88 | pub fn debug_assoc_type_id( | ||
89 | &self, | ||
90 | id: super::AssocTypeId, | ||
91 | fmt: &mut fmt::Formatter<'_>, | ||
92 | ) -> Result<(), fmt::Error> { | ||
93 | let type_alias: TypeAliasId = from_chalk(self.0, id); | ||
94 | let type_alias_data = self.0.type_alias_data(type_alias); | ||
95 | let trait_ = match type_alias.lookup(self.0.upcast()).container { | ||
96 | AssocContainerId::TraitId(t) => t, | ||
97 | _ => panic!("associated type not in trait"), | ||
98 | }; | ||
99 | let trait_data = self.0.trait_data(trait_); | ||
100 | write!(fmt, "{}::{}", trait_data.name, type_alias_data.name) | ||
101 | } | ||
102 | |||
103 | pub fn debug_alias( | ||
104 | &self, | ||
105 | alias: &AliasTy<Interner>, | ||
106 | fmt: &mut fmt::Formatter<'_>, | ||
107 | ) -> Result<(), fmt::Error> { | ||
108 | let type_alias: TypeAliasId = from_chalk(self.0, alias.associated_ty_id); | ||
109 | let type_alias_data = self.0.type_alias_data(type_alias); | ||
110 | let trait_ = match type_alias.lookup(self.0.upcast()).container { | ||
111 | AssocContainerId::TraitId(t) => t, | ||
112 | _ => panic!("associated type not in trait"), | ||
113 | }; | ||
114 | let trait_data = self.0.trait_data(trait_); | ||
115 | let params = alias.substitution.parameters(&Interner); | ||
116 | write!( | ||
117 | fmt, | ||
118 | "<{:?} as {}<{:?}>>::{}", | ||
119 | ¶ms[0], | ||
120 | trait_data.name, | ||
121 | ¶ms[1..], | ||
122 | type_alias_data.name | ||
123 | ) | ||
124 | } | ||
125 | |||
126 | pub fn debug_ty( | ||
127 | &self, | ||
128 | ty: &chalk_ir::Ty<Interner>, | ||
129 | fmt: &mut fmt::Formatter<'_>, | ||
130 | ) -> Result<(), fmt::Error> { | ||
131 | write!(fmt, "{:?}", ty.data(&Interner)) | ||
132 | } | ||
133 | |||
134 | pub fn debug_lifetime( | ||
135 | &self, | ||
136 | lifetime: &Lifetime<Interner>, | ||
137 | fmt: &mut fmt::Formatter<'_>, | ||
138 | ) -> Result<(), fmt::Error> { | ||
139 | write!(fmt, "{:?}", lifetime.data(&Interner)) | ||
140 | } | ||
141 | |||
142 | pub fn debug_parameter( | ||
143 | &self, | ||
144 | parameter: &Parameter<Interner>, | ||
145 | fmt: &mut fmt::Formatter<'_>, | ||
146 | ) -> Result<(), fmt::Error> { | ||
147 | write!(fmt, "{:?}", parameter.data(&Interner).inner_debug()) | ||
148 | } | ||
149 | |||
150 | pub fn debug_goal( | ||
151 | &self, | ||
152 | goal: &Goal<Interner>, | ||
153 | fmt: &mut fmt::Formatter<'_>, | ||
154 | ) -> Result<(), fmt::Error> { | ||
155 | let goal_data = goal.data(&Interner); | ||
156 | write!(fmt, "{:?}", goal_data) | ||
157 | } | ||
158 | |||
159 | pub fn debug_goals( | ||
160 | &self, | ||
161 | goals: &Goals<Interner>, | ||
162 | fmt: &mut fmt::Formatter<'_>, | ||
163 | ) -> Result<(), fmt::Error> { | ||
164 | write!(fmt, "{:?}", goals.debug(&Interner)) | ||
165 | } | ||
166 | |||
167 | pub fn debug_program_clause_implication( | ||
168 | &self, | ||
169 | pci: &ProgramClauseImplication<Interner>, | ||
170 | fmt: &mut fmt::Formatter<'_>, | ||
171 | ) -> Result<(), fmt::Error> { | ||
172 | write!(fmt, "{:?}", pci.debug(&Interner)) | ||
173 | } | ||
174 | |||
175 | pub fn debug_application_ty( | ||
176 | &self, | ||
177 | application_ty: &chalk_ir::ApplicationTy<Interner>, | ||
178 | fmt: &mut fmt::Formatter<'_>, | ||
179 | ) -> Result<(), fmt::Error> { | ||
180 | write!(fmt, "{:?}", application_ty.debug(&Interner)) | ||
181 | } | ||
182 | |||
183 | pub fn debug_substitution( | ||
184 | &self, | ||
185 | substitution: &chalk_ir::Substitution<Interner>, | ||
186 | fmt: &mut fmt::Formatter<'_>, | ||
187 | ) -> Result<(), fmt::Error> { | ||
188 | write!(fmt, "{:?}", substitution.debug(&Interner)) | ||
189 | } | ||
190 | |||
191 | pub fn debug_separator_trait_ref( | ||
192 | &self, | ||
193 | separator_trait_ref: &chalk_ir::SeparatorTraitRef<Interner>, | ||
194 | fmt: &mut fmt::Formatter<'_>, | ||
195 | ) -> Result<(), fmt::Error> { | ||
196 | write!(fmt, "{:?}", separator_trait_ref.debug(&Interner)) | ||
197 | } | ||
198 | } | ||
199 | |||
200 | mod unsafe_tls { | ||
201 | use super::DebugContext; | ||
202 | use crate::db::HirDatabase; | ||
203 | use scoped_tls::scoped_thread_local; | ||
204 | |||
205 | scoped_thread_local!(static PROGRAM: DebugContext); | ||
206 | |||
207 | pub fn with_current_program<R>( | ||
208 | op: impl for<'a> FnOnce(Option<&'a DebugContext<'a>>) -> R, | ||
209 | ) -> R { | ||
210 | if PROGRAM.is_set() { | ||
211 | PROGRAM.with(|prog| op(Some(prog))) | ||
212 | } else { | ||
213 | op(None) | ||
214 | } | ||
215 | } | ||
216 | |||
217 | pub fn set_current_program<OP, R>(p: &dyn HirDatabase, op: OP) -> R | ||
218 | where | ||
219 | OP: FnOnce() -> R, | ||
220 | { | ||
221 | let ctx = DebugContext(p); | ||
222 | // we're transmuting the lifetime in the DebugContext to static. This is | ||
223 | // fine because we only keep the reference for the lifetime of this | ||
224 | // function, *and* the only way to access the context is through | ||
225 | // `with_current_program`, which hides the lifetime through the `for` | ||
226 | // type. | ||
227 | let static_p: &DebugContext<'static> = | ||
228 | unsafe { std::mem::transmute::<&DebugContext, &DebugContext<'static>>(&ctx) }; | ||
229 | PROGRAM.set(static_p, || op()) | ||
230 | } | ||
231 | } | ||
diff --git a/crates/ra_ide/src/completion/complete_dot.rs b/crates/ra_ide/src/completion/complete_dot.rs index 358b041aa..b5448af5c 100644 --- a/crates/ra_ide/src/completion/complete_dot.rs +++ b/crates/ra_ide/src/completion/complete_dot.rs | |||
@@ -72,7 +72,6 @@ fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: &Ty | |||
72 | } | 72 | } |
73 | for (i, ty) in receiver.tuple_fields(ctx.db).into_iter().enumerate() { | 73 | for (i, ty) in receiver.tuple_fields(ctx.db).into_iter().enumerate() { |
74 | // FIXME: Handle visibility | 74 | // FIXME: Handle visibility |
75 | // TODO: add the same behavior with type ? | ||
76 | acc.add_tuple_field(ctx, i, &ty); | 75 | acc.add_tuple_field(ctx, i, &ty); |
77 | } | 76 | } |
78 | } | 77 | } |
diff --git a/crates/ra_ide/src/completion/complete_fn_param.rs b/crates/ra_ide/src/completion/complete_fn_param.rs index 62ae5ccb4..f84b559fc 100644 --- a/crates/ra_ide/src/completion/complete_fn_param.rs +++ b/crates/ra_ide/src/completion/complete_fn_param.rs | |||
@@ -1,6 +1,9 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use ra_syntax::{ast, match_ast, AstNode}; | 3 | use ra_syntax::{ |
4 | ast::{self, ModuleItemOwner}, | ||
5 | match_ast, AstNode, | ||
6 | }; | ||
4 | use rustc_hash::FxHashMap; | 7 | use rustc_hash::FxHashMap; |
5 | 8 | ||
6 | use crate::completion::{CompletionContext, CompletionItem, CompletionKind, Completions}; | 9 | use crate::completion::{CompletionContext, CompletionItem, CompletionKind, Completions}; |
@@ -16,11 +19,19 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext) | |||
16 | 19 | ||
17 | let mut params = FxHashMap::default(); | 20 | let mut params = FxHashMap::default(); |
18 | for node in ctx.token.parent().ancestors() { | 21 | for node in ctx.token.parent().ancestors() { |
19 | match_ast! { | 22 | let items = match_ast! { |
20 | match node { | 23 | match node { |
21 | ast::SourceFile(it) => process(it, &mut params), | 24 | ast::SourceFile(it) => it.items(), |
22 | ast::ItemList(it) => process(it, &mut params), | 25 | ast::ItemList(it) => it.items(), |
23 | _ => (), | 26 | _ => continue, |
27 | } | ||
28 | }; | ||
29 | for item in items { | ||
30 | if let ast::ModuleItem::FnDef(func) = item { | ||
31 | func.param_list().into_iter().flat_map(|it| it.params()).for_each(|param| { | ||
32 | let text = param.syntax().text().to_string(); | ||
33 | params.entry(text).or_insert((0, param)).0 += 1; | ||
34 | }) | ||
24 | } | 35 | } |
25 | } | 36 | } |
26 | } | 37 | } |
@@ -39,15 +50,6 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext) | |||
39 | .lookup_by(lookup) | 50 | .lookup_by(lookup) |
40 | .add_to(acc) | 51 | .add_to(acc) |
41 | }); | 52 | }); |
42 | |||
43 | fn process<N: ast::FnDefOwner>(node: N, params: &mut FxHashMap<String, (u32, ast::Param)>) { | ||
44 | node.functions().filter_map(|it| it.param_list()).flat_map(|it| it.params()).for_each( | ||
45 | |param| { | ||
46 | let text = param.syntax().text().to_string(); | ||
47 | params.entry(text).or_insert((0, param)).0 += 1; | ||
48 | }, | ||
49 | ) | ||
50 | } | ||
51 | } | 53 | } |
52 | 54 | ||
53 | #[cfg(test)] | 55 | #[cfg(test)] |
diff --git a/crates/ra_ide/src/completion/complete_trait_impl.rs b/crates/ra_ide/src/completion/complete_trait_impl.rs index ded1ff3bc..fab02945c 100644 --- a/crates/ra_ide/src/completion/complete_trait_impl.rs +++ b/crates/ra_ide/src/completion/complete_trait_impl.rs | |||
@@ -35,7 +35,7 @@ use hir::{self, Docs, HasSource}; | |||
35 | use ra_assists::utils::get_missing_impl_items; | 35 | use ra_assists::utils::get_missing_impl_items; |
36 | use ra_syntax::{ | 36 | use ra_syntax::{ |
37 | ast::{self, edit, ImplDef}, | 37 | ast::{self, edit, ImplDef}, |
38 | AstNode, SyntaxKind, SyntaxNode, TextRange, | 38 | AstNode, SyntaxKind, SyntaxNode, TextRange, T, |
39 | }; | 39 | }; |
40 | use ra_text_edit::TextEdit; | 40 | use ra_text_edit::TextEdit; |
41 | 41 | ||
@@ -204,7 +204,7 @@ fn make_const_compl_syntax(const_: &ast::ConstDef) -> String { | |||
204 | let end = const_ | 204 | let end = const_ |
205 | .syntax() | 205 | .syntax() |
206 | .children_with_tokens() | 206 | .children_with_tokens() |
207 | .find(|s| s.kind() == SyntaxKind::SEMI || s.kind() == SyntaxKind::EQ) | 207 | .find(|s| s.kind() == T![;] || s.kind() == T![=]) |
208 | .map_or(const_end, |f| f.text_range().start()); | 208 | .map_or(const_end, |f| f.text_range().start()); |
209 | 209 | ||
210 | let len = end - start; | 210 | let len = end - start; |
diff --git a/crates/ra_ide/src/completion/complete_unqualified_path.rs b/crates/ra_ide/src/completion/complete_unqualified_path.rs index efde9bf73..0b0da6ee4 100644 --- a/crates/ra_ide/src/completion/complete_unqualified_path.rs +++ b/crates/ra_ide/src/completion/complete_unqualified_path.rs | |||
@@ -3,7 +3,7 @@ | |||
3 | use crate::completion::{CompletionContext, Completions}; | 3 | use crate::completion::{CompletionContext, Completions}; |
4 | 4 | ||
5 | pub(super) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionContext) { | 5 | pub(super) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionContext) { |
6 | if !(ctx.is_trivial_path && !ctx.is_pat_binding_or_const) { | 6 | if !(ctx.is_trivial_path && !ctx.is_pat_binding_or_const && !ctx.record_lit_syntax.is_some()) { |
7 | return; | 7 | return; |
8 | } | 8 | } |
9 | 9 | ||
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index fddaf21e4..eb8016dd1 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs | |||
@@ -1,13 +1,11 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use hir::{db::HirDatabase, Semantics, SemanticsScope}; | 3 | use hir::{Semantics, SemanticsScope}; |
4 | use ra_db::SourceDatabase; | 4 | use ra_db::SourceDatabase; |
5 | use ra_ide_db::RootDatabase; | 5 | use ra_ide_db::RootDatabase; |
6 | use ra_syntax::{ | 6 | use ra_syntax::{ |
7 | algo::{find_covering_element, find_node_at_offset}, | 7 | algo::{find_covering_element, find_node_at_offset}, |
8 | ast, | 8 | ast, AstNode, |
9 | ast::ArgListOwner, | ||
10 | AstNode, | ||
11 | SyntaxKind::*, | 9 | SyntaxKind::*, |
12 | SyntaxNode, SyntaxToken, TextRange, TextUnit, | 10 | SyntaxNode, SyntaxToken, TextRange, TextUnit, |
13 | }; | 11 | }; |
@@ -196,7 +194,10 @@ impl<'a> CompletionContext<'a> { | |||
196 | if let Some(name) = find_node_at_offset::<ast::Name>(&file_with_fake_ident, offset) { | 194 | if let Some(name) = find_node_at_offset::<ast::Name>(&file_with_fake_ident, offset) { |
197 | if let Some(bind_pat) = name.syntax().ancestors().find_map(ast::BindPat::cast) { | 195 | if let Some(bind_pat) = name.syntax().ancestors().find_map(ast::BindPat::cast) { |
198 | self.is_pat_binding_or_const = true; | 196 | self.is_pat_binding_or_const = true; |
199 | if bind_pat.has_at() || bind_pat.is_ref() || bind_pat.is_mutable() { | 197 | if bind_pat.at_token().is_some() |
198 | || bind_pat.ref_token().is_some() | ||
199 | || bind_pat.mut_token().is_some() | ||
200 | { | ||
200 | self.is_pat_binding_or_const = false; | 201 | self.is_pat_binding_or_const = false; |
201 | } | 202 | } |
202 | if bind_pat.syntax().parent().and_then(ast::RecordFieldPatList::cast).is_some() { | 203 | if bind_pat.syntax().parent().and_then(ast::RecordFieldPatList::cast).is_some() { |
@@ -230,7 +231,7 @@ impl<'a> CompletionContext<'a> { | |||
230 | self.name_ref_syntax = | 231 | self.name_ref_syntax = |
231 | find_node_at_offset(&original_file, name_ref.syntax().text_range().start()); | 232 | find_node_at_offset(&original_file, name_ref.syntax().text_range().start()); |
232 | let name_range = name_ref.syntax().text_range(); | 233 | let name_range = name_ref.syntax().text_range(); |
233 | if name_ref.syntax().parent().and_then(ast::RecordField::cast).is_some() { | 234 | if ast::RecordField::for_field_name(&name_ref).is_some() { |
234 | self.record_lit_syntax = | 235 | self.record_lit_syntax = |
235 | self.sema.find_node_at_offset_with_macros(&original_file, offset); | 236 | self.sema.find_node_at_offset_with_macros(&original_file, offset); |
236 | } | 237 | } |
diff --git a/crates/ra_ide/src/display/function_signature.rs b/crates/ra_ide/src/display/function_signature.rs index e58a78271..2d175882b 100644 --- a/crates/ra_ide/src/display/function_signature.rs +++ b/crates/ra_ide/src/display/function_signature.rs | |||
@@ -69,7 +69,13 @@ impl FunctionSignature { | |||
69 | for field in st.fields(db).into_iter() { | 69 | for field in st.fields(db).into_iter() { |
70 | let ty = field.signature_ty(db); | 70 | let ty = field.signature_ty(db); |
71 | let raw_param = format!("{}", ty.display(db)); | 71 | let raw_param = format!("{}", ty.display(db)); |
72 | parameter_types.push(raw_param.split(':').nth(1).unwrap()[1..].to_string()); | 72 | |
73 | if let Some(param_type) = raw_param.split(':').nth(1) { | ||
74 | parameter_types.push(param_type[1..].to_string()); | ||
75 | } else { | ||
76 | // The unwrap_or_else is useful when you have tuple struct | ||
77 | parameter_types.push(raw_param.clone()); | ||
78 | } | ||
73 | params.push(raw_param); | 79 | params.push(raw_param); |
74 | } | 80 | } |
75 | 81 | ||
@@ -107,8 +113,15 @@ impl FunctionSignature { | |||
107 | for field in variant.fields(db).into_iter() { | 113 | for field in variant.fields(db).into_iter() { |
108 | let ty = field.signature_ty(db); | 114 | let ty = field.signature_ty(db); |
109 | let raw_param = format!("{}", ty.display(db)); | 115 | let raw_param = format!("{}", ty.display(db)); |
110 | parameter_types.push(raw_param.split(':').nth(1).unwrap()[1..].to_string()); | 116 | if let Some(param_type) = raw_param.split(':').nth(1) { |
111 | params.push(raw_param); | 117 | parameter_types.push(param_type[1..].to_string()); |
118 | } else { | ||
119 | // The unwrap_or_else is useful when you have tuple | ||
120 | parameter_types.push(raw_param); | ||
121 | } | ||
122 | let name = field.name(db); | ||
123 | |||
124 | params.push(format!("{}: {}", name, ty.display(db))); | ||
112 | } | 125 | } |
113 | 126 | ||
114 | Some( | 127 | Some( |
@@ -164,7 +177,7 @@ impl From<&'_ ast::FnDef> for FunctionSignature { | |||
164 | has_self_param = true; | 177 | has_self_param = true; |
165 | let raw_param = self_param.syntax().text().to_string(); | 178 | let raw_param = self_param.syntax().text().to_string(); |
166 | 179 | ||
167 | // TODO: better solution ? | 180 | // FIXME: better solution ? |
168 | res_types.push( | 181 | res_types.push( |
169 | raw_param.split(':').nth(1).unwrap_or_else(|| " Self")[1..].to_string(), | 182 | raw_param.split(':').nth(1).unwrap_or_else(|| " Self")[1..].to_string(), |
170 | ); | 183 | ); |
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs index 4b133b19b..45b9f7802 100644 --- a/crates/ra_ide/src/inlay_hints.rs +++ b/crates/ra_ide/src/inlay_hints.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! This module defines multiple types of inlay hints and their visibility |
2 | 2 | ||
3 | use hir::{Adt, HirDisplay, Semantics, Type}; | 3 | use hir::{Adt, HirDisplay, Semantics, Type}; |
4 | use ra_ide_db::RootDatabase; | 4 | use ra_ide_db::RootDatabase; |
@@ -235,8 +235,10 @@ fn should_show_param_hint( | |||
235 | param_name: &str, | 235 | param_name: &str, |
236 | argument: &ast::Expr, | 236 | argument: &ast::Expr, |
237 | ) -> bool { | 237 | ) -> bool { |
238 | let argument_string = argument.syntax().to_string(); | 238 | if param_name.is_empty() |
239 | if param_name.is_empty() || argument_string.ends_with(param_name) { | 239 | || is_argument_similar_to_param(argument, param_name) |
240 | || Some(param_name) == fn_signature.name.as_ref().map(String::as_str) | ||
241 | { | ||
240 | return false; | 242 | return false; |
241 | } | 243 | } |
242 | 244 | ||
@@ -245,12 +247,32 @@ fn should_show_param_hint( | |||
245 | } else { | 247 | } else { |
246 | fn_signature.parameters.len() | 248 | fn_signature.parameters.len() |
247 | }; | 249 | }; |
250 | |||
248 | // avoid displaying hints for common functions like map, filter, etc. | 251 | // avoid displaying hints for common functions like map, filter, etc. |
249 | if parameters_len == 1 && (param_name.len() == 1 || param_name == "predicate") { | 252 | // or other obvious words used in std |
250 | return false; | 253 | parameters_len != 1 || !is_obvious_param(param_name) |
254 | } | ||
255 | |||
256 | fn is_argument_similar_to_param(argument: &ast::Expr, param_name: &str) -> bool { | ||
257 | let argument_string = remove_ref(argument.clone()).syntax().to_string(); | ||
258 | argument_string.starts_with(¶m_name) || argument_string.ends_with(¶m_name) | ||
259 | } | ||
260 | |||
261 | fn remove_ref(expr: ast::Expr) -> ast::Expr { | ||
262 | if let ast::Expr::RefExpr(ref_expr) = &expr { | ||
263 | if let Some(inner) = ref_expr.expr() { | ||
264 | return inner; | ||
265 | } | ||
251 | } | 266 | } |
267 | expr | ||
268 | } | ||
252 | 269 | ||
253 | true | 270 | fn is_obvious_param(param_name: &str) -> bool { |
271 | let is_obvious_param_name = match param_name { | ||
272 | "predicate" | "value" | "pat" | "rhs" | "other" => true, | ||
273 | _ => false, | ||
274 | }; | ||
275 | param_name.len() == 1 || is_obvious_param_name | ||
254 | } | 276 | } |
255 | 277 | ||
256 | fn get_fn_signature(sema: &Semantics<RootDatabase>, expr: &ast::Expr) -> Option<FunctionSignature> { | 278 | fn get_fn_signature(sema: &Semantics<RootDatabase>, expr: &ast::Expr) -> Option<FunctionSignature> { |
@@ -1059,9 +1081,22 @@ impl Test { | |||
1059 | self | 1081 | self |
1060 | } | 1082 | } |
1061 | 1083 | ||
1084 | fn field(self, value: i32) -> Self { | ||
1085 | self | ||
1086 | } | ||
1087 | |||
1062 | fn no_hints_expected(&self, _: i32, test_var: i32) {} | 1088 | fn no_hints_expected(&self, _: i32, test_var: i32) {} |
1089 | |||
1090 | fn frob(&self, frob: bool) {} | ||
1063 | } | 1091 | } |
1064 | 1092 | ||
1093 | struct Param {} | ||
1094 | |||
1095 | fn different_order(param: &Param) {} | ||
1096 | fn different_order_mut(param: &mut Param) {} | ||
1097 | |||
1098 | fn twiddle(twiddle: bool) {} | ||
1099 | |||
1065 | fn main() { | 1100 | fn main() { |
1066 | let container: TestVarContainer = TestVarContainer { test_var: 42 }; | 1101 | let container: TestVarContainer = TestVarContainer { test_var: 42 }; |
1067 | let test: Test = Test {}; | 1102 | let test: Test = Test {}; |
@@ -1069,11 +1104,23 @@ fn main() { | |||
1069 | map(22); | 1104 | map(22); |
1070 | filter(33); | 1105 | filter(33); |
1071 | 1106 | ||
1072 | let test_processed: Test = test.map(1).filter(2); | 1107 | let test_processed: Test = test.map(1).filter(2).field(3); |
1073 | 1108 | ||
1074 | let test_var: i32 = 55; | 1109 | let test_var: i32 = 55; |
1075 | test_processed.no_hints_expected(22, test_var); | 1110 | test_processed.no_hints_expected(22, test_var); |
1076 | test_processed.no_hints_expected(33, container.test_var); | 1111 | test_processed.no_hints_expected(33, container.test_var); |
1112 | test_processed.frob(false); | ||
1113 | |||
1114 | twiddle(true); | ||
1115 | |||
1116 | let param_begin: Param = Param {}; | ||
1117 | different_order(¶m_begin); | ||
1118 | different_order(&mut param_begin); | ||
1119 | |||
1120 | let a: f64 = 7.0; | ||
1121 | let b: f64 = 4.0; | ||
1122 | let _: f64 = a.div_euclid(b); | ||
1123 | let _: f64 = a.abs_sub(b); | ||
1077 | }"#, | 1124 | }"#, |
1078 | ); | 1125 | ); |
1079 | 1126 | ||
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index 746cc86ba..7d0544ff4 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs | |||
@@ -152,7 +152,7 @@ fn decl_access(def: &Definition, syntax: &SyntaxNode, range: TextRange) -> Optio | |||
152 | if stmt.initializer().is_some() { | 152 | if stmt.initializer().is_some() { |
153 | let pat = stmt.pat()?; | 153 | let pat = stmt.pat()?; |
154 | if let ast::Pat::BindPat(it) = pat { | 154 | if let ast::Pat::BindPat(it) = pat { |
155 | if it.is_mutable() { | 155 | if it.mut_token().is_some() { |
156 | return Some(ReferenceAccess::Write); | 156 | return Some(ReferenceAccess::Write); |
157 | } | 157 | } |
158 | } | 158 | } |
diff --git a/crates/ra_ide/src/syntax_tree.rs b/crates/ra_ide/src/syntax_tree.rs index f58e436d1..5842ae2e8 100644 --- a/crates/ra_ide/src/syntax_tree.rs +++ b/crates/ra_ide/src/syntax_tree.rs | |||
@@ -165,7 +165,7 @@ SOURCE_FILE@[0; 60) | |||
165 | PATH_SEGMENT@[16; 22) | 165 | PATH_SEGMENT@[16; 22) |
166 | NAME_REF@[16; 22) | 166 | NAME_REF@[16; 22) |
167 | IDENT@[16; 22) "assert" | 167 | IDENT@[16; 22) "assert" |
168 | EXCL@[22; 23) "!" | 168 | BANG@[22; 23) "!" |
169 | TOKEN_TREE@[23; 57) | 169 | TOKEN_TREE@[23; 57) |
170 | L_PAREN@[23; 24) "(" | 170 | L_PAREN@[23; 24) "(" |
171 | STRING@[24; 52) "\"\n fn foo() {\n ..." | 171 | STRING@[24; 52) "\"\n fn foo() {\n ..." |
@@ -173,7 +173,7 @@ SOURCE_FILE@[0; 60) | |||
173 | WHITESPACE@[53; 54) " " | 173 | WHITESPACE@[53; 54) " " |
174 | STRING@[54; 56) "\"\"" | 174 | STRING@[54; 56) "\"\"" |
175 | R_PAREN@[56; 57) ")" | 175 | R_PAREN@[56; 57) ")" |
176 | SEMI@[57; 58) ";" | 176 | SEMICOLON@[57; 58) ";" |
177 | WHITESPACE@[58; 59) "\n" | 177 | WHITESPACE@[58; 59) "\n" |
178 | R_CURLY@[59; 60) "}" | 178 | R_CURLY@[59; 60) "}" |
179 | "# | 179 | "# |
@@ -226,7 +226,7 @@ EXPR_STMT@[16; 58) | |||
226 | PATH_SEGMENT@[16; 22) | 226 | PATH_SEGMENT@[16; 22) |
227 | NAME_REF@[16; 22) | 227 | NAME_REF@[16; 22) |
228 | IDENT@[16; 22) "assert" | 228 | IDENT@[16; 22) "assert" |
229 | EXCL@[22; 23) "!" | 229 | BANG@[22; 23) "!" |
230 | TOKEN_TREE@[23; 57) | 230 | TOKEN_TREE@[23; 57) |
231 | L_PAREN@[23; 24) "(" | 231 | L_PAREN@[23; 24) "(" |
232 | STRING@[24; 52) "\"\n fn foo() {\n ..." | 232 | STRING@[24; 52) "\"\n fn foo() {\n ..." |
@@ -234,7 +234,7 @@ EXPR_STMT@[16; 58) | |||
234 | WHITESPACE@[53; 54) " " | 234 | WHITESPACE@[53; 54) " " |
235 | STRING@[54; 56) "\"\"" | 235 | STRING@[54; 56) "\"\"" |
236 | R_PAREN@[56; 57) ")" | 236 | R_PAREN@[56; 57) ")" |
237 | SEMI@[57; 58) ";" | 237 | SEMICOLON@[57; 58) ";" |
238 | "# | 238 | "# |
239 | .trim() | 239 | .trim() |
240 | ); | 240 | ); |
diff --git a/crates/ra_ide/src/typing.rs b/crates/ra_ide/src/typing.rs index cb2cd2479..f55cd3bf5 100644 --- a/crates/ra_ide/src/typing.rs +++ b/crates/ra_ide/src/typing.rs | |||
@@ -63,7 +63,7 @@ fn on_char_typed_inner( | |||
63 | fn on_eq_typed(file: &SourceFile, offset: TextUnit) -> Option<SingleFileChange> { | 63 | fn on_eq_typed(file: &SourceFile, offset: TextUnit) -> Option<SingleFileChange> { |
64 | assert_eq!(file.syntax().text().char_at(offset), Some('=')); | 64 | assert_eq!(file.syntax().text().char_at(offset), Some('=')); |
65 | let let_stmt: ast::LetStmt = find_node_at_offset(file.syntax(), offset)?; | 65 | let let_stmt: ast::LetStmt = find_node_at_offset(file.syntax(), offset)?; |
66 | if let_stmt.has_semi() { | 66 | if let_stmt.semicolon_token().is_some() { |
67 | return None; | 67 | return None; |
68 | } | 68 | } |
69 | if let Some(expr) = let_stmt.initializer() { | 69 | if let Some(expr) = let_stmt.initializer() { |
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index e9934844e..49a8c74fb 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs | |||
@@ -216,7 +216,7 @@ pub fn classify_name_ref( | |||
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | if let Some(record_field) = ast::RecordField::cast(parent.clone()) { | 219 | if let Some(record_field) = ast::RecordField::for_field_name(name_ref) { |
220 | tested_by!(goto_def_for_record_fields; force); | 220 | tested_by!(goto_def_for_record_fields; force); |
221 | tested_by!(goto_def_for_field_init_shorthand; force); | 221 | tested_by!(goto_def_for_field_init_shorthand; force); |
222 | if let Some((field, local)) = sema.resolve_record_field(&record_field) { | 222 | if let Some((field, local)) = sema.resolve_record_field(&record_field) { |
diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs index 8e8ae2b29..9fb5cb058 100644 --- a/crates/ra_mbe/src/syntax_bridge.rs +++ b/crates/ra_mbe/src/syntax_bridge.rs | |||
@@ -137,21 +137,23 @@ impl TokenMap { | |||
137 | token_id: tt::TokenId, | 137 | token_id: tt::TokenId, |
138 | open_relative_range: TextRange, | 138 | open_relative_range: TextRange, |
139 | close_relative_range: TextRange, | 139 | close_relative_range: TextRange, |
140 | ) { | 140 | ) -> usize { |
141 | let res = self.entries.len(); | ||
141 | self.entries | 142 | self.entries |
142 | .push((token_id, TokenTextRange::Delimiter(open_relative_range, close_relative_range))); | 143 | .push((token_id, TokenTextRange::Delimiter(open_relative_range, close_relative_range))); |
144 | res | ||
143 | } | 145 | } |
144 | 146 | ||
145 | fn update_close_delim(&mut self, token_id: tt::TokenId, close_relative_range: TextRange) { | 147 | fn update_close_delim(&mut self, idx: usize, close_relative_range: TextRange) { |
146 | if let Some(entry) = self.entries.iter_mut().find(|(tid, _)| *tid == token_id) { | 148 | let (_, token_text_range) = &mut self.entries[idx]; |
147 | if let TokenTextRange::Delimiter(dim, _) = entry.1 { | 149 | if let TokenTextRange::Delimiter(dim, _) = token_text_range { |
148 | entry.1 = TokenTextRange::Delimiter(dim, close_relative_range); | 150 | *token_text_range = TokenTextRange::Delimiter(*dim, close_relative_range); |
149 | } | ||
150 | } | 151 | } |
151 | } | 152 | } |
152 | 153 | ||
153 | fn remove_delim(&mut self, token_id: tt::TokenId) { | 154 | fn remove_delim(&mut self, idx: usize) { |
154 | self.entries.retain(|(tid, _)| *tid != token_id); | 155 | // FIXME: This could be accidently quadratic |
156 | self.entries.remove(idx); | ||
155 | } | 157 | } |
156 | } | 158 | } |
157 | 159 | ||
@@ -238,24 +240,24 @@ impl TokenIdAlloc { | |||
238 | token_id | 240 | token_id |
239 | } | 241 | } |
240 | 242 | ||
241 | fn open_delim(&mut self, open_abs_range: TextRange) -> tt::TokenId { | 243 | fn open_delim(&mut self, open_abs_range: TextRange) -> (tt::TokenId, usize) { |
242 | let token_id = tt::TokenId(self.next_id); | 244 | let token_id = tt::TokenId(self.next_id); |
243 | self.next_id += 1; | 245 | self.next_id += 1; |
244 | self.map.insert_delim( | 246 | let idx = self.map.insert_delim( |
245 | token_id, | 247 | token_id, |
246 | open_abs_range - self.global_offset, | 248 | open_abs_range - self.global_offset, |
247 | open_abs_range - self.global_offset, | 249 | open_abs_range - self.global_offset, |
248 | ); | 250 | ); |
249 | token_id | 251 | (token_id, idx) |
250 | } | 252 | } |
251 | 253 | ||
252 | fn close_delim(&mut self, id: tt::TokenId, close_abs_range: Option<TextRange>) { | 254 | fn close_delim(&mut self, idx: usize, close_abs_range: Option<TextRange>) { |
253 | match close_abs_range { | 255 | match close_abs_range { |
254 | None => { | 256 | None => { |
255 | self.map.remove_delim(id); | 257 | self.map.remove_delim(idx); |
256 | } | 258 | } |
257 | Some(close) => { | 259 | Some(close) => { |
258 | self.map.update_close_delim(id, close - self.global_offset); | 260 | self.map.update_close_delim(idx, close - self.global_offset); |
259 | } | 261 | } |
260 | } | 262 | } |
261 | } | 263 | } |
@@ -322,7 +324,7 @@ trait TokenConvertor { | |||
322 | 324 | ||
323 | if let Some((kind, closed)) = delim { | 325 | if let Some((kind, closed)) = delim { |
324 | let mut subtree = tt::Subtree::default(); | 326 | let mut subtree = tt::Subtree::default(); |
325 | let id = self.id_alloc().open_delim(range); | 327 | let (id, idx) = self.id_alloc().open_delim(range); |
326 | subtree.delimiter = Some(tt::Delimiter { kind, id }); | 328 | subtree.delimiter = Some(tt::Delimiter { kind, id }); |
327 | 329 | ||
328 | while self.peek().map(|it| it.kind() != closed).unwrap_or(false) { | 330 | while self.peek().map(|it| it.kind() != closed).unwrap_or(false) { |
@@ -331,7 +333,7 @@ trait TokenConvertor { | |||
331 | let last_range = match self.bump() { | 333 | let last_range = match self.bump() { |
332 | None => { | 334 | None => { |
333 | // For error resilience, we insert an char punct for the opening delim here | 335 | // For error resilience, we insert an char punct for the opening delim here |
334 | self.id_alloc().close_delim(id, None); | 336 | self.id_alloc().close_delim(idx, None); |
335 | let leaf: tt::Leaf = tt::Punct { | 337 | let leaf: tt::Leaf = tt::Punct { |
336 | id: self.id_alloc().alloc(range), | 338 | id: self.id_alloc().alloc(range), |
337 | char: token.to_char().unwrap(), | 339 | char: token.to_char().unwrap(), |
@@ -344,7 +346,7 @@ trait TokenConvertor { | |||
344 | } | 346 | } |
345 | Some(it) => it.1, | 347 | Some(it) => it.1, |
346 | }; | 348 | }; |
347 | self.id_alloc().close_delim(id, Some(last_range)); | 349 | self.id_alloc().close_delim(idx, Some(last_range)); |
348 | subtree.into() | 350 | subtree.into() |
349 | } else { | 351 | } else { |
350 | let spacing = match self.peek() { | 352 | let spacing = match self.peek() { |
diff --git a/crates/ra_mbe/src/tests.rs b/crates/ra_mbe/src/tests.rs index 254318e23..5d1274d21 100644 --- a/crates/ra_mbe/src/tests.rs +++ b/crates/ra_mbe/src/tests.rs | |||
@@ -142,6 +142,79 @@ macro_rules! impl_froms { | |||
142 | } | 142 | } |
143 | 143 | ||
144 | #[test] | 144 | #[test] |
145 | fn test_convert_tt2() { | ||
146 | parse_macro( | ||
147 | r#" | ||
148 | macro_rules! impl_froms { | ||
149 | ($e:ident: $($v:ident),*) => { | ||
150 | $( | ||
151 | impl From<$v> for $e { | ||
152 | fn from(it: $v) -> $e { | ||
153 | $e::$v(it) | ||
154 | } | ||
155 | } | ||
156 | )* | ||
157 | } | ||
158 | } | ||
159 | "#, | ||
160 | ) | ||
161 | .assert_expand( | ||
162 | "impl_froms!(TokenTree: Leaf, Subtree);", | ||
163 | r#" | ||
164 | SUBTREE $ | ||
165 | IDENT impl 20 | ||
166 | IDENT From 21 | ||
167 | PUNCH < [joint] 22 | ||
168 | IDENT Leaf 53 | ||
169 | PUNCH > [alone] 25 | ||
170 | IDENT for 26 | ||
171 | IDENT TokenTree 51 | ||
172 | SUBTREE {} 29 | ||
173 | IDENT fn 30 | ||
174 | IDENT from 31 | ||
175 | SUBTREE () 32 | ||
176 | IDENT it 33 | ||
177 | PUNCH : [alone] 34 | ||
178 | IDENT Leaf 53 | ||
179 | PUNCH - [joint] 37 | ||
180 | PUNCH > [alone] 38 | ||
181 | IDENT TokenTree 51 | ||
182 | SUBTREE {} 41 | ||
183 | IDENT TokenTree 51 | ||
184 | PUNCH : [joint] 44 | ||
185 | PUNCH : [joint] 45 | ||
186 | IDENT Leaf 53 | ||
187 | SUBTREE () 48 | ||
188 | IDENT it 49 | ||
189 | IDENT impl 20 | ||
190 | IDENT From 21 | ||
191 | PUNCH < [joint] 22 | ||
192 | IDENT Subtree 55 | ||
193 | PUNCH > [alone] 25 | ||
194 | IDENT for 26 | ||
195 | IDENT TokenTree 51 | ||
196 | SUBTREE {} 29 | ||
197 | IDENT fn 30 | ||
198 | IDENT from 31 | ||
199 | SUBTREE () 32 | ||
200 | IDENT it 33 | ||
201 | PUNCH : [alone] 34 | ||
202 | IDENT Subtree 55 | ||
203 | PUNCH - [joint] 37 | ||
204 | PUNCH > [alone] 38 | ||
205 | IDENT TokenTree 51 | ||
206 | SUBTREE {} 41 | ||
207 | IDENT TokenTree 51 | ||
208 | PUNCH : [joint] 44 | ||
209 | PUNCH : [joint] 45 | ||
210 | IDENT Subtree 55 | ||
211 | SUBTREE () 48 | ||
212 | IDENT it 49 | ||
213 | "#, | ||
214 | ); | ||
215 | } | ||
216 | |||
217 | #[test] | ||
145 | fn test_expr_order() { | 218 | fn test_expr_order() { |
146 | let expanded = parse_macro( | 219 | let expanded = parse_macro( |
147 | r#" | 220 | r#" |
@@ -179,7 +252,7 @@ fn test_expr_order() { | |||
179 | STAR@[11; 12) "*" | 252 | STAR@[11; 12) "*" |
180 | LITERAL@[12; 13) | 253 | LITERAL@[12; 13) |
181 | INT_NUMBER@[12; 13) "2" | 254 | INT_NUMBER@[12; 13) "2" |
182 | SEMI@[13; 14) ";" | 255 | SEMICOLON@[13; 14) ";" |
183 | R_CURLY@[14; 15) "}""#, | 256 | R_CURLY@[14; 15) "}""#, |
184 | ); | 257 | ); |
185 | } | 258 | } |
@@ -532,7 +605,7 @@ fn test_tt_to_stmts() { | |||
532 | EQ@[4; 5) "=" | 605 | EQ@[4; 5) "=" |
533 | LITERAL@[5; 6) | 606 | LITERAL@[5; 6) |
534 | INT_NUMBER@[5; 6) "0" | 607 | INT_NUMBER@[5; 6) "0" |
535 | SEMI@[6; 7) ";" | 608 | SEMICOLON@[6; 7) ";" |
536 | EXPR_STMT@[7; 14) | 609 | EXPR_STMT@[7; 14) |
537 | BIN_EXPR@[7; 13) | 610 | BIN_EXPR@[7; 13) |
538 | PATH_EXPR@[7; 8) | 611 | PATH_EXPR@[7; 8) |
@@ -547,7 +620,7 @@ fn test_tt_to_stmts() { | |||
547 | PLUS@[11; 12) "+" | 620 | PLUS@[11; 12) "+" |
548 | LITERAL@[12; 13) | 621 | LITERAL@[12; 13) |
549 | INT_NUMBER@[12; 13) "1" | 622 | INT_NUMBER@[12; 13) "1" |
550 | SEMI@[13; 14) ";" | 623 | SEMICOLON@[13; 14) ";" |
551 | EXPR_STMT@[14; 15) | 624 | EXPR_STMT@[14; 15) |
552 | PATH_EXPR@[14; 15) | 625 | PATH_EXPR@[14; 15) |
553 | PATH@[14; 15) | 626 | PATH@[14; 15) |
@@ -880,7 +953,7 @@ fn test_tt_composite2() { | |||
880 | PATH_SEGMENT@[0; 3) | 953 | PATH_SEGMENT@[0; 3) |
881 | NAME_REF@[0; 3) | 954 | NAME_REF@[0; 3) |
882 | IDENT@[0; 3) "abs" | 955 | IDENT@[0; 3) "abs" |
883 | EXCL@[3; 4) "!" | 956 | BANG@[3; 4) "!" |
884 | TOKEN_TREE@[4; 10) | 957 | TOKEN_TREE@[4; 10) |
885 | L_PAREN@[4; 5) "(" | 958 | L_PAREN@[4; 5) "(" |
886 | EQ@[5; 6) "=" | 959 | EQ@[5; 6) "=" |
@@ -1000,14 +1073,14 @@ fn test_vec() { | |||
1000 | PATH_SEGMENT@[9; 12) | 1073 | PATH_SEGMENT@[9; 12) |
1001 | NAME_REF@[9; 12) | 1074 | NAME_REF@[9; 12) |
1002 | IDENT@[9; 12) "Vec" | 1075 | IDENT@[9; 12) "Vec" |
1003 | COLONCOLON@[12; 14) "::" | 1076 | COLON2@[12; 14) "::" |
1004 | PATH_SEGMENT@[14; 17) | 1077 | PATH_SEGMENT@[14; 17) |
1005 | NAME_REF@[14; 17) | 1078 | NAME_REF@[14; 17) |
1006 | IDENT@[14; 17) "new" | 1079 | IDENT@[14; 17) "new" |
1007 | ARG_LIST@[17; 19) | 1080 | ARG_LIST@[17; 19) |
1008 | L_PAREN@[17; 18) "(" | 1081 | L_PAREN@[17; 18) "(" |
1009 | R_PAREN@[18; 19) ")" | 1082 | R_PAREN@[18; 19) ")" |
1010 | SEMI@[19; 20) ";" | 1083 | SEMICOLON@[19; 20) ";" |
1011 | EXPR_STMT@[20; 33) | 1084 | EXPR_STMT@[20; 33) |
1012 | METHOD_CALL_EXPR@[20; 32) | 1085 | METHOD_CALL_EXPR@[20; 32) |
1013 | PATH_EXPR@[20; 21) | 1086 | PATH_EXPR@[20; 21) |
@@ -1023,7 +1096,7 @@ fn test_vec() { | |||
1023 | LITERAL@[27; 31) | 1096 | LITERAL@[27; 31) |
1024 | INT_NUMBER@[27; 31) "1u32" | 1097 | INT_NUMBER@[27; 31) "1u32" |
1025 | R_PAREN@[31; 32) ")" | 1098 | R_PAREN@[31; 32) ")" |
1026 | SEMI@[32; 33) ";" | 1099 | SEMICOLON@[32; 33) ";" |
1027 | EXPR_STMT@[33; 43) | 1100 | EXPR_STMT@[33; 43) |
1028 | METHOD_CALL_EXPR@[33; 42) | 1101 | METHOD_CALL_EXPR@[33; 42) |
1029 | PATH_EXPR@[33; 34) | 1102 | PATH_EXPR@[33; 34) |
@@ -1039,7 +1112,7 @@ fn test_vec() { | |||
1039 | LITERAL@[40; 41) | 1112 | LITERAL@[40; 41) |
1040 | INT_NUMBER@[40; 41) "2" | 1113 | INT_NUMBER@[40; 41) "2" |
1041 | R_PAREN@[41; 42) ")" | 1114 | R_PAREN@[41; 42) ")" |
1042 | SEMI@[42; 43) ";" | 1115 | SEMICOLON@[42; 43) ";" |
1043 | PATH_EXPR@[43; 44) | 1116 | PATH_EXPR@[43; 44) |
1044 | PATH@[43; 44) | 1117 | PATH@[43; 44) |
1045 | PATH_SEGMENT@[43; 44) | 1118 | PATH_SEGMENT@[43; 44) |
@@ -1479,6 +1552,12 @@ impl MacroFixture { | |||
1479 | assert_eq!(expansion.to_string(), expected); | 1552 | assert_eq!(expansion.to_string(), expected); |
1480 | } | 1553 | } |
1481 | 1554 | ||
1555 | fn assert_expand(&self, invocation: &str, expected: &str) { | ||
1556 | let expansion = self.expand_tt(invocation); | ||
1557 | let actual = format!("{:?}", expansion); | ||
1558 | test_utils::assert_eq_text!(&actual.trim(), &expected.trim()); | ||
1559 | } | ||
1560 | |||
1482 | fn assert_expand_items(&self, invocation: &str, expected: &str) -> &MacroFixture { | 1561 | fn assert_expand_items(&self, invocation: &str, expected: &str) -> &MacroFixture { |
1483 | self.assert_expansion(FragmentKind::Items, invocation, expected); | 1562 | self.assert_expansion(FragmentKind::Items, invocation, expected); |
1484 | self | 1563 | self |
@@ -1681,7 +1760,7 @@ fn test_no_space_after_semi_colon() { | |||
1681 | MOD_KW@[21; 24) "mod" | 1760 | MOD_KW@[21; 24) "mod" |
1682 | NAME@[24; 25) | 1761 | NAME@[24; 25) |
1683 | IDENT@[24; 25) "m" | 1762 | IDENT@[24; 25) "m" |
1684 | SEMI@[25; 26) ";" | 1763 | SEMICOLON@[25; 26) ";" |
1685 | MODULE@[26; 52) | 1764 | MODULE@[26; 52) |
1686 | ATTR@[26; 47) | 1765 | ATTR@[26; 47) |
1687 | POUND@[26; 27) "#" | 1766 | POUND@[26; 27) "#" |
@@ -1700,7 +1779,7 @@ fn test_no_space_after_semi_colon() { | |||
1700 | MOD_KW@[47; 50) "mod" | 1779 | MOD_KW@[47; 50) "mod" |
1701 | NAME@[50; 51) | 1780 | NAME@[50; 51) |
1702 | IDENT@[50; 51) "f" | 1781 | IDENT@[50; 51) "f" |
1703 | SEMI@[51; 52) ";""###, | 1782 | SEMICOLON@[51; 52) ";""###, |
1704 | ); | 1783 | ); |
1705 | } | 1784 | } |
1706 | 1785 | ||
diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs index c486c0211..cb30b25a8 100644 --- a/crates/ra_parser/src/grammar/expressions.rs +++ b/crates/ra_parser/src/grammar/expressions.rs | |||
@@ -339,7 +339,8 @@ fn expr_bp(p: &mut Parser, mut r: Restrictions, bp: u8) -> (Option<CompletedMark | |||
339 | (Some(lhs), BlockLike::NotBlock) | 339 | (Some(lhs), BlockLike::NotBlock) |
340 | } | 340 | } |
341 | 341 | ||
342 | const LHS_FIRST: TokenSet = atom::ATOM_EXPR_FIRST.union(token_set![AMP, STAR, EXCL, DOT, MINUS]); | 342 | const LHS_FIRST: TokenSet = |
343 | atom::ATOM_EXPR_FIRST.union(token_set![T![&], T![*], T![!], T![.], T![-]]); | ||
343 | 344 | ||
344 | fn lhs(p: &mut Parser, r: Restrictions) -> Option<(CompletedMarker, BlockLike)> { | 345 | fn lhs(p: &mut Parser, r: Restrictions) -> Option<(CompletedMarker, BlockLike)> { |
345 | let m; | 346 | let m; |
@@ -618,26 +619,39 @@ pub(crate) fn record_field_list(p: &mut Parser) { | |||
618 | let m = p.start(); | 619 | let m = p.start(); |
619 | p.bump(T!['{']); | 620 | p.bump(T!['{']); |
620 | while !p.at(EOF) && !p.at(T!['}']) { | 621 | while !p.at(EOF) && !p.at(T!['}']) { |
622 | let m = p.start(); | ||
623 | // test record_literal_field_with_attr | ||
624 | // fn main() { | ||
625 | // S { #[cfg(test)] field: 1 } | ||
626 | // } | ||
627 | attributes::outer_attributes(p); | ||
628 | |||
621 | match p.current() { | 629 | match p.current() { |
622 | // test record_literal_field_with_attr | 630 | IDENT | INT_NUMBER => { |
623 | // fn main() { | 631 | // test_err record_literal_before_ellipsis_recovery |
624 | // S { #[cfg(test)] field: 1 } | 632 | // fn main() { |
625 | // } | 633 | // S { field ..S::default() } |
626 | IDENT | INT_NUMBER | T![#] => { | 634 | // } |
627 | let m = p.start(); | 635 | if p.nth_at(1, T![:]) || p.nth_at(1, T![..]) { |
628 | attributes::outer_attributes(p); | 636 | name_ref_or_index(p); |
629 | name_ref_or_index(p); | 637 | p.expect(T![:]); |
630 | if p.eat(T![:]) { | ||
631 | expr(p); | ||
632 | } | 638 | } |
639 | expr(p); | ||
633 | m.complete(p, RECORD_FIELD); | 640 | m.complete(p, RECORD_FIELD); |
634 | } | 641 | } |
635 | T![.] if p.at(T![..]) => { | 642 | T![.] if p.at(T![..]) => { |
643 | m.abandon(p); | ||
636 | p.bump(T![..]); | 644 | p.bump(T![..]); |
637 | expr(p); | 645 | expr(p); |
638 | } | 646 | } |
639 | T!['{'] => error_block(p, "expected a field"), | 647 | T!['{'] => { |
640 | _ => p.err_and_bump("expected identifier"), | 648 | error_block(p, "expected a field"); |
649 | m.abandon(p); | ||
650 | } | ||
651 | _ => { | ||
652 | p.err_and_bump("expected identifier"); | ||
653 | m.abandon(p); | ||
654 | } | ||
641 | } | 655 | } |
642 | if !p.at(T!['}']) { | 656 | if !p.at(T!['}']) { |
643 | p.expect(T![,]); | 657 | p.expect(T![,]); |
diff --git a/crates/ra_parser/src/grammar/types.rs b/crates/ra_parser/src/grammar/types.rs index 386969d2d..fe1a039cb 100644 --- a/crates/ra_parser/src/grammar/types.rs +++ b/crates/ra_parser/src/grammar/types.rs | |||
@@ -3,8 +3,19 @@ | |||
3 | use super::*; | 3 | use super::*; |
4 | 4 | ||
5 | pub(super) const TYPE_FIRST: TokenSet = paths::PATH_FIRST.union(token_set![ | 5 | pub(super) const TYPE_FIRST: TokenSet = paths::PATH_FIRST.union(token_set![ |
6 | L_PAREN, EXCL, STAR, L_BRACK, AMP, UNDERSCORE, FN_KW, UNSAFE_KW, EXTERN_KW, FOR_KW, IMPL_KW, | 6 | T!['('], |
7 | DYN_KW, L_ANGLE, | 7 | T!['['], |
8 | T![<], | ||
9 | T![!], | ||
10 | T![*], | ||
11 | T![&], | ||
12 | T![_], | ||
13 | T![fn], | ||
14 | T![unsafe], | ||
15 | T![extern], | ||
16 | T![for], | ||
17 | T![impl], | ||
18 | T![dyn], | ||
8 | ]); | 19 | ]); |
9 | 20 | ||
10 | const TYPE_RECOVERY_SET: TokenSet = token_set![R_PAREN, COMMA, L_DOLLAR]; | 21 | const TYPE_RECOVERY_SET: TokenSet = token_set![R_PAREN, COMMA, L_DOLLAR]; |
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs index 004f4e564..524e7d784 100644 --- a/crates/ra_parser/src/syntax_kind/generated.rs +++ b/crates/ra_parser/src/syntax_kind/generated.rs | |||
@@ -9,7 +9,7 @@ pub enum SyntaxKind { | |||
9 | TOMBSTONE, | 9 | TOMBSTONE, |
10 | #[doc(hidden)] | 10 | #[doc(hidden)] |
11 | EOF, | 11 | EOF, |
12 | SEMI, | 12 | SEMICOLON, |
13 | COMMA, | 13 | COMMA, |
14 | L_PAREN, | 14 | L_PAREN, |
15 | R_PAREN, | 15 | R_PAREN, |
@@ -33,15 +33,15 @@ pub enum SyntaxKind { | |||
33 | PERCENT, | 33 | PERCENT, |
34 | UNDERSCORE, | 34 | UNDERSCORE, |
35 | DOT, | 35 | DOT, |
36 | DOTDOT, | 36 | DOT2, |
37 | DOTDOTDOT, | 37 | DOT3, |
38 | DOTDOTEQ, | 38 | DOT2EQ, |
39 | COLON, | 39 | COLON, |
40 | COLONCOLON, | 40 | COLON2, |
41 | EQ, | 41 | EQ, |
42 | EQEQ, | 42 | EQ2, |
43 | FAT_ARROW, | 43 | FAT_ARROW, |
44 | EXCL, | 44 | BANG, |
45 | NEQ, | 45 | NEQ, |
46 | MINUS, | 46 | MINUS, |
47 | THIN_ARROW, | 47 | THIN_ARROW, |
@@ -55,8 +55,8 @@ pub enum SyntaxKind { | |||
55 | SLASHEQ, | 55 | SLASHEQ, |
56 | STAREQ, | 56 | STAREQ, |
57 | PERCENTEQ, | 57 | PERCENTEQ, |
58 | AMPAMP, | 58 | AMP2, |
59 | PIPEPIPE, | 59 | PIPE2, |
60 | SHL, | 60 | SHL, |
61 | SHR, | 61 | SHR, |
62 | SHLEQ, | 62 | SHLEQ, |
@@ -265,12 +265,12 @@ impl SyntaxKind { | |||
265 | } | 265 | } |
266 | pub fn is_punct(self) -> bool { | 266 | pub fn is_punct(self) -> bool { |
267 | match self { | 267 | match self { |
268 | SEMI | COMMA | L_PAREN | R_PAREN | L_CURLY | R_CURLY | L_BRACK | R_BRACK | L_ANGLE | 268 | SEMICOLON | COMMA | L_PAREN | R_PAREN | L_CURLY | R_CURLY | L_BRACK | R_BRACK |
269 | | R_ANGLE | AT | POUND | TILDE | QUESTION | DOLLAR | AMP | PIPE | PLUS | STAR | 269 | | L_ANGLE | R_ANGLE | AT | POUND | TILDE | QUESTION | DOLLAR | AMP | PIPE | PLUS |
270 | | SLASH | CARET | PERCENT | UNDERSCORE | DOT | DOTDOT | DOTDOTDOT | DOTDOTEQ | 270 | | STAR | SLASH | CARET | PERCENT | UNDERSCORE | DOT | DOT2 | DOT3 | DOT2EQ | COLON |
271 | | COLON | COLONCOLON | EQ | EQEQ | FAT_ARROW | EXCL | NEQ | MINUS | THIN_ARROW | 271 | | COLON2 | EQ | EQ2 | FAT_ARROW | BANG | NEQ | MINUS | THIN_ARROW | LTEQ | GTEQ |
272 | | LTEQ | GTEQ | PLUSEQ | MINUSEQ | PIPEEQ | AMPEQ | CARETEQ | SLASHEQ | STAREQ | 272 | | PLUSEQ | MINUSEQ | PIPEEQ | AMPEQ | CARETEQ | SLASHEQ | STAREQ | PERCENTEQ | AMP2 |
273 | | PERCENTEQ | AMPAMP | PIPEPIPE | SHL | SHR | SHLEQ | SHREQ => true, | 273 | | PIPE2 | SHL | SHR | SHLEQ | SHREQ => true, |
274 | _ => false, | 274 | _ => false, |
275 | } | 275 | } |
276 | } | 276 | } |
@@ -329,7 +329,7 @@ impl SyntaxKind { | |||
329 | } | 329 | } |
330 | pub fn from_char(c: char) -> Option<SyntaxKind> { | 330 | pub fn from_char(c: char) -> Option<SyntaxKind> { |
331 | let tok = match c { | 331 | let tok = match c { |
332 | ';' => SEMI, | 332 | ';' => SEMICOLON, |
333 | ',' => COMMA, | 333 | ',' => COMMA, |
334 | '(' => L_PAREN, | 334 | '(' => L_PAREN, |
335 | ')' => R_PAREN, | 335 | ')' => R_PAREN, |
@@ -355,7 +355,7 @@ impl SyntaxKind { | |||
355 | '.' => DOT, | 355 | '.' => DOT, |
356 | ':' => COLON, | 356 | ':' => COLON, |
357 | '=' => EQ, | 357 | '=' => EQ, |
358 | '!' => EXCL, | 358 | '!' => BANG, |
359 | '-' => MINUS, | 359 | '-' => MINUS, |
360 | _ => return None, | 360 | _ => return None, |
361 | }; | 361 | }; |
@@ -363,296 +363,4 @@ impl SyntaxKind { | |||
363 | } | 363 | } |
364 | } | 364 | } |
365 | #[macro_export] | 365 | #[macro_export] |
366 | macro_rules! T { | 366 | macro_rules ! T { [ ; ] => { $ crate :: SyntaxKind :: SEMICOLON } ; [ , ] => { $ crate :: SyntaxKind :: COMMA } ; [ '(' ] => { $ crate :: SyntaxKind :: L_PAREN } ; [ ')' ] => { $ crate :: SyntaxKind :: R_PAREN } ; [ '{' ] => { $ crate :: SyntaxKind :: L_CURLY } ; [ '}' ] => { $ crate :: SyntaxKind :: R_CURLY } ; [ '[' ] => { $ crate :: SyntaxKind :: L_BRACK } ; [ ']' ] => { $ crate :: SyntaxKind :: R_BRACK } ; [ < ] => { $ crate :: SyntaxKind :: L_ANGLE } ; [ > ] => { $ crate :: SyntaxKind :: R_ANGLE } ; [ @ ] => { $ crate :: SyntaxKind :: AT } ; [ # ] => { $ crate :: SyntaxKind :: POUND } ; [ ~ ] => { $ crate :: SyntaxKind :: TILDE } ; [ ? ] => { $ crate :: SyntaxKind :: QUESTION } ; [ $ ] => { $ crate :: SyntaxKind :: DOLLAR } ; [ & ] => { $ crate :: SyntaxKind :: AMP } ; [ | ] => { $ crate :: SyntaxKind :: PIPE } ; [ + ] => { $ crate :: SyntaxKind :: PLUS } ; [ * ] => { $ crate :: SyntaxKind :: STAR } ; [ / ] => { $ crate :: SyntaxKind :: SLASH } ; [ ^ ] => { $ crate :: SyntaxKind :: CARET } ; [ % ] => { $ crate :: SyntaxKind :: PERCENT } ; [ _ ] => { $ crate :: SyntaxKind :: UNDERSCORE } ; [ . ] => { $ crate :: SyntaxKind :: DOT } ; [ .. ] => { $ crate :: SyntaxKind :: DOT2 } ; [ ... ] => { $ crate :: SyntaxKind :: DOT3 } ; [ ..= ] => { $ crate :: SyntaxKind :: DOT2EQ } ; [ : ] => { $ crate :: SyntaxKind :: COLON } ; [ :: ] => { $ crate :: SyntaxKind :: COLON2 } ; [ = ] => { $ crate :: SyntaxKind :: EQ } ; [ == ] => { $ crate :: SyntaxKind :: EQ2 } ; [ => ] => { $ crate :: SyntaxKind :: FAT_ARROW } ; [ ! ] => { $ crate :: SyntaxKind :: BANG } ; [ != ] => { $ crate :: SyntaxKind :: NEQ } ; [ - ] => { $ crate :: SyntaxKind :: MINUS } ; [ -> ] => { $ crate :: SyntaxKind :: THIN_ARROW } ; [ <= ] => { $ crate :: SyntaxKind :: LTEQ } ; [ >= ] => { $ crate :: SyntaxKind :: GTEQ } ; [ += ] => { $ crate :: SyntaxKind :: PLUSEQ } ; [ -= ] => { $ crate :: SyntaxKind :: MINUSEQ } ; [ |= ] => { $ crate :: SyntaxKind :: PIPEEQ } ; [ &= ] => { $ crate :: SyntaxKind :: AMPEQ } ; [ ^= ] => { $ crate :: SyntaxKind :: CARETEQ } ; [ /= ] => { $ crate :: SyntaxKind :: SLASHEQ } ; [ *= ] => { $ crate :: SyntaxKind :: STAREQ } ; [ %= ] => { $ crate :: SyntaxKind :: PERCENTEQ } ; [ && ] => { $ crate :: SyntaxKind :: AMP2 } ; [ || ] => { $ crate :: SyntaxKind :: PIPE2 } ; [ << ] => { $ crate :: SyntaxKind :: SHL } ; [ >> ] => { $ crate :: SyntaxKind :: SHR } ; [ <<= ] => { $ crate :: SyntaxKind :: SHLEQ } ; [ >>= ] => { $ crate :: SyntaxKind :: SHREQ } ; [ as ] => { $ crate :: SyntaxKind :: AS_KW } ; [ async ] => { $ crate :: SyntaxKind :: ASYNC_KW } ; [ await ] => { $ crate :: SyntaxKind :: AWAIT_KW } ; [ box ] => { $ crate :: SyntaxKind :: BOX_KW } ; [ break ] => { $ crate :: SyntaxKind :: BREAK_KW } ; [ const ] => { $ crate :: SyntaxKind :: CONST_KW } ; [ continue ] => { $ crate :: SyntaxKind :: CONTINUE_KW } ; [ crate ] => { $ crate :: SyntaxKind :: CRATE_KW } ; [ dyn ] => { $ crate :: SyntaxKind :: DYN_KW } ; [ else ] => { $ crate :: SyntaxKind :: ELSE_KW } ; [ enum ] => { $ crate :: SyntaxKind :: ENUM_KW } ; [ extern ] => { $ crate :: SyntaxKind :: EXTERN_KW } ; [ false ] => { $ crate :: SyntaxKind :: FALSE_KW } ; [ fn ] => { $ crate :: SyntaxKind :: FN_KW } ; [ for ] => { $ crate :: SyntaxKind :: FOR_KW } ; [ if ] => { $ crate :: SyntaxKind :: IF_KW } ; [ impl ] => { $ crate :: SyntaxKind :: IMPL_KW } ; [ in ] => { $ crate :: SyntaxKind :: IN_KW } ; [ let ] => { $ crate :: SyntaxKind :: LET_KW } ; [ loop ] => { $ crate :: SyntaxKind :: LOOP_KW } ; [ macro ] => { $ crate :: SyntaxKind :: MACRO_KW } ; [ match ] => { $ crate :: SyntaxKind :: MATCH_KW } ; [ mod ] => { $ crate :: SyntaxKind :: MOD_KW } ; [ move ] => { $ crate :: SyntaxKind :: MOVE_KW } ; [ mut ] => { $ crate :: SyntaxKind :: MUT_KW } ; [ pub ] => { $ crate :: SyntaxKind :: PUB_KW } ; [ ref ] => { $ crate :: SyntaxKind :: REF_KW } ; [ return ] => { $ crate :: SyntaxKind :: RETURN_KW } ; [ self ] => { $ crate :: SyntaxKind :: SELF_KW } ; [ static ] => { $ crate :: SyntaxKind :: STATIC_KW } ; [ struct ] => { $ crate :: SyntaxKind :: STRUCT_KW } ; [ super ] => { $ crate :: SyntaxKind :: SUPER_KW } ; [ trait ] => { $ crate :: SyntaxKind :: TRAIT_KW } ; [ true ] => { $ crate :: SyntaxKind :: TRUE_KW } ; [ try ] => { $ crate :: SyntaxKind :: TRY_KW } ; [ type ] => { $ crate :: SyntaxKind :: TYPE_KW } ; [ unsafe ] => { $ crate :: SyntaxKind :: UNSAFE_KW } ; [ use ] => { $ crate :: SyntaxKind :: USE_KW } ; [ where ] => { $ crate :: SyntaxKind :: WHERE_KW } ; [ while ] => { $ crate :: SyntaxKind :: WHILE_KW } ; [ auto ] => { $ crate :: SyntaxKind :: AUTO_KW } ; [ default ] => { $ crate :: SyntaxKind :: DEFAULT_KW } ; [ existential ] => { $ crate :: SyntaxKind :: EXISTENTIAL_KW } ; [ union ] => { $ crate :: SyntaxKind :: UNION_KW } ; [ raw ] => { $ crate :: SyntaxKind :: RAW_KW } ; [ lifetime ] => { $ crate :: SyntaxKind :: LIFETIME } ; [ ident ] => { $ crate :: SyntaxKind :: IDENT } ; } |
367 | ( ; ) => { | ||
368 | $crate::SyntaxKind::SEMI | ||
369 | }; | ||
370 | ( , ) => { | ||
371 | $crate::SyntaxKind::COMMA | ||
372 | }; | ||
373 | ( '(' ) => { | ||
374 | $crate::SyntaxKind::L_PAREN | ||
375 | }; | ||
376 | ( ')' ) => { | ||
377 | $crate::SyntaxKind::R_PAREN | ||
378 | }; | ||
379 | ( '{' ) => { | ||
380 | $crate::SyntaxKind::L_CURLY | ||
381 | }; | ||
382 | ( '}' ) => { | ||
383 | $crate::SyntaxKind::R_CURLY | ||
384 | }; | ||
385 | ( '[' ) => { | ||
386 | $crate::SyntaxKind::L_BRACK | ||
387 | }; | ||
388 | ( ']' ) => { | ||
389 | $crate::SyntaxKind::R_BRACK | ||
390 | }; | ||
391 | ( < ) => { | ||
392 | $crate::SyntaxKind::L_ANGLE | ||
393 | }; | ||
394 | ( > ) => { | ||
395 | $crate::SyntaxKind::R_ANGLE | ||
396 | }; | ||
397 | ( @ ) => { | ||
398 | $crate::SyntaxKind::AT | ||
399 | }; | ||
400 | ( # ) => { | ||
401 | $crate::SyntaxKind::POUND | ||
402 | }; | ||
403 | ( ~ ) => { | ||
404 | $crate::SyntaxKind::TILDE | ||
405 | }; | ||
406 | ( ? ) => { | ||
407 | $crate::SyntaxKind::QUESTION | ||
408 | }; | ||
409 | ( $ ) => { | ||
410 | $crate::SyntaxKind::DOLLAR | ||
411 | }; | ||
412 | ( & ) => { | ||
413 | $crate::SyntaxKind::AMP | ||
414 | }; | ||
415 | ( | ) => { | ||
416 | $crate::SyntaxKind::PIPE | ||
417 | }; | ||
418 | ( + ) => { | ||
419 | $crate::SyntaxKind::PLUS | ||
420 | }; | ||
421 | ( * ) => { | ||
422 | $crate::SyntaxKind::STAR | ||
423 | }; | ||
424 | ( / ) => { | ||
425 | $crate::SyntaxKind::SLASH | ||
426 | }; | ||
427 | ( ^ ) => { | ||
428 | $crate::SyntaxKind::CARET | ||
429 | }; | ||
430 | ( % ) => { | ||
431 | $crate::SyntaxKind::PERCENT | ||
432 | }; | ||
433 | ( _ ) => { | ||
434 | $crate::SyntaxKind::UNDERSCORE | ||
435 | }; | ||
436 | ( . ) => { | ||
437 | $crate::SyntaxKind::DOT | ||
438 | }; | ||
439 | ( .. ) => { | ||
440 | $crate::SyntaxKind::DOTDOT | ||
441 | }; | ||
442 | ( ... ) => { | ||
443 | $crate::SyntaxKind::DOTDOTDOT | ||
444 | }; | ||
445 | ( ..= ) => { | ||
446 | $crate::SyntaxKind::DOTDOTEQ | ||
447 | }; | ||
448 | ( : ) => { | ||
449 | $crate::SyntaxKind::COLON | ||
450 | }; | ||
451 | ( :: ) => { | ||
452 | $crate::SyntaxKind::COLONCOLON | ||
453 | }; | ||
454 | ( = ) => { | ||
455 | $crate::SyntaxKind::EQ | ||
456 | }; | ||
457 | ( == ) => { | ||
458 | $crate::SyntaxKind::EQEQ | ||
459 | }; | ||
460 | ( => ) => { | ||
461 | $crate::SyntaxKind::FAT_ARROW | ||
462 | }; | ||
463 | ( ! ) => { | ||
464 | $crate::SyntaxKind::EXCL | ||
465 | }; | ||
466 | ( != ) => { | ||
467 | $crate::SyntaxKind::NEQ | ||
468 | }; | ||
469 | ( - ) => { | ||
470 | $crate::SyntaxKind::MINUS | ||
471 | }; | ||
472 | ( -> ) => { | ||
473 | $crate::SyntaxKind::THIN_ARROW | ||
474 | }; | ||
475 | ( <= ) => { | ||
476 | $crate::SyntaxKind::LTEQ | ||
477 | }; | ||
478 | ( >= ) => { | ||
479 | $crate::SyntaxKind::GTEQ | ||
480 | }; | ||
481 | ( += ) => { | ||
482 | $crate::SyntaxKind::PLUSEQ | ||
483 | }; | ||
484 | ( -= ) => { | ||
485 | $crate::SyntaxKind::MINUSEQ | ||
486 | }; | ||
487 | ( |= ) => { | ||
488 | $crate::SyntaxKind::PIPEEQ | ||
489 | }; | ||
490 | ( &= ) => { | ||
491 | $crate::SyntaxKind::AMPEQ | ||
492 | }; | ||
493 | ( ^= ) => { | ||
494 | $crate::SyntaxKind::CARETEQ | ||
495 | }; | ||
496 | ( /= ) => { | ||
497 | $crate::SyntaxKind::SLASHEQ | ||
498 | }; | ||
499 | ( *= ) => { | ||
500 | $crate::SyntaxKind::STAREQ | ||
501 | }; | ||
502 | ( %= ) => { | ||
503 | $crate::SyntaxKind::PERCENTEQ | ||
504 | }; | ||
505 | ( && ) => { | ||
506 | $crate::SyntaxKind::AMPAMP | ||
507 | }; | ||
508 | ( || ) => { | ||
509 | $crate::SyntaxKind::PIPEPIPE | ||
510 | }; | ||
511 | ( << ) => { | ||
512 | $crate::SyntaxKind::SHL | ||
513 | }; | ||
514 | ( >> ) => { | ||
515 | $crate::SyntaxKind::SHR | ||
516 | }; | ||
517 | ( <<= ) => { | ||
518 | $crate::SyntaxKind::SHLEQ | ||
519 | }; | ||
520 | ( >>= ) => { | ||
521 | $crate::SyntaxKind::SHREQ | ||
522 | }; | ||
523 | ( as ) => { | ||
524 | $crate::SyntaxKind::AS_KW | ||
525 | }; | ||
526 | ( async ) => { | ||
527 | $crate::SyntaxKind::ASYNC_KW | ||
528 | }; | ||
529 | ( await ) => { | ||
530 | $crate::SyntaxKind::AWAIT_KW | ||
531 | }; | ||
532 | ( box ) => { | ||
533 | $crate::SyntaxKind::BOX_KW | ||
534 | }; | ||
535 | ( break ) => { | ||
536 | $crate::SyntaxKind::BREAK_KW | ||
537 | }; | ||
538 | ( const ) => { | ||
539 | $crate::SyntaxKind::CONST_KW | ||
540 | }; | ||
541 | ( continue ) => { | ||
542 | $crate::SyntaxKind::CONTINUE_KW | ||
543 | }; | ||
544 | ( crate ) => { | ||
545 | $crate::SyntaxKind::CRATE_KW | ||
546 | }; | ||
547 | ( dyn ) => { | ||
548 | $crate::SyntaxKind::DYN_KW | ||
549 | }; | ||
550 | ( else ) => { | ||
551 | $crate::SyntaxKind::ELSE_KW | ||
552 | }; | ||
553 | ( enum ) => { | ||
554 | $crate::SyntaxKind::ENUM_KW | ||
555 | }; | ||
556 | ( extern ) => { | ||
557 | $crate::SyntaxKind::EXTERN_KW | ||
558 | }; | ||
559 | ( false ) => { | ||
560 | $crate::SyntaxKind::FALSE_KW | ||
561 | }; | ||
562 | ( fn ) => { | ||
563 | $crate::SyntaxKind::FN_KW | ||
564 | }; | ||
565 | ( for ) => { | ||
566 | $crate::SyntaxKind::FOR_KW | ||
567 | }; | ||
568 | ( if ) => { | ||
569 | $crate::SyntaxKind::IF_KW | ||
570 | }; | ||
571 | ( impl ) => { | ||
572 | $crate::SyntaxKind::IMPL_KW | ||
573 | }; | ||
574 | ( in ) => { | ||
575 | $crate::SyntaxKind::IN_KW | ||
576 | }; | ||
577 | ( let ) => { | ||
578 | $crate::SyntaxKind::LET_KW | ||
579 | }; | ||
580 | ( loop ) => { | ||
581 | $crate::SyntaxKind::LOOP_KW | ||
582 | }; | ||
583 | ( macro ) => { | ||
584 | $crate::SyntaxKind::MACRO_KW | ||
585 | }; | ||
586 | ( match ) => { | ||
587 | $crate::SyntaxKind::MATCH_KW | ||
588 | }; | ||
589 | ( mod ) => { | ||
590 | $crate::SyntaxKind::MOD_KW | ||
591 | }; | ||
592 | ( move ) => { | ||
593 | $crate::SyntaxKind::MOVE_KW | ||
594 | }; | ||
595 | ( mut ) => { | ||
596 | $crate::SyntaxKind::MUT_KW | ||
597 | }; | ||
598 | ( pub ) => { | ||
599 | $crate::SyntaxKind::PUB_KW | ||
600 | }; | ||
601 | ( ref ) => { | ||
602 | $crate::SyntaxKind::REF_KW | ||
603 | }; | ||
604 | ( return ) => { | ||
605 | $crate::SyntaxKind::RETURN_KW | ||
606 | }; | ||
607 | ( self ) => { | ||
608 | $crate::SyntaxKind::SELF_KW | ||
609 | }; | ||
610 | ( static ) => { | ||
611 | $crate::SyntaxKind::STATIC_KW | ||
612 | }; | ||
613 | ( struct ) => { | ||
614 | $crate::SyntaxKind::STRUCT_KW | ||
615 | }; | ||
616 | ( super ) => { | ||
617 | $crate::SyntaxKind::SUPER_KW | ||
618 | }; | ||
619 | ( trait ) => { | ||
620 | $crate::SyntaxKind::TRAIT_KW | ||
621 | }; | ||
622 | ( true ) => { | ||
623 | $crate::SyntaxKind::TRUE_KW | ||
624 | }; | ||
625 | ( try ) => { | ||
626 | $crate::SyntaxKind::TRY_KW | ||
627 | }; | ||
628 | ( type ) => { | ||
629 | $crate::SyntaxKind::TYPE_KW | ||
630 | }; | ||
631 | ( unsafe ) => { | ||
632 | $crate::SyntaxKind::UNSAFE_KW | ||
633 | }; | ||
634 | ( use ) => { | ||
635 | $crate::SyntaxKind::USE_KW | ||
636 | }; | ||
637 | ( where ) => { | ||
638 | $crate::SyntaxKind::WHERE_KW | ||
639 | }; | ||
640 | ( while ) => { | ||
641 | $crate::SyntaxKind::WHILE_KW | ||
642 | }; | ||
643 | ( auto ) => { | ||
644 | $crate::SyntaxKind::AUTO_KW | ||
645 | }; | ||
646 | ( default ) => { | ||
647 | $crate::SyntaxKind::DEFAULT_KW | ||
648 | }; | ||
649 | ( existential ) => { | ||
650 | $crate::SyntaxKind::EXISTENTIAL_KW | ||
651 | }; | ||
652 | ( union ) => { | ||
653 | $crate::SyntaxKind::UNION_KW | ||
654 | }; | ||
655 | ( raw ) => { | ||
656 | $crate::SyntaxKind::RAW_KW | ||
657 | }; | ||
658 | } | ||
diff --git a/crates/ra_proc_macro_srv/Cargo.toml b/crates/ra_proc_macro_srv/Cargo.toml index f08de5fc7..1e0f50339 100644 --- a/crates/ra_proc_macro_srv/Cargo.toml +++ b/crates/ra_proc_macro_srv/Cargo.toml | |||
@@ -12,9 +12,12 @@ doctest = false | |||
12 | ra_tt = { path = "../ra_tt" } | 12 | ra_tt = { path = "../ra_tt" } |
13 | ra_mbe = { path = "../ra_mbe" } | 13 | ra_mbe = { path = "../ra_mbe" } |
14 | ra_proc_macro = { path = "../ra_proc_macro" } | 14 | ra_proc_macro = { path = "../ra_proc_macro" } |
15 | goblin = "0.2.1" | ||
16 | libloading = "0.6.0" | ||
17 | test_utils = { path = "../test_utils" } | ||
15 | 18 | ||
16 | [dev-dependencies] | 19 | [dev-dependencies] |
17 | cargo_metadata = "0.9.1" | 20 | cargo_metadata = "0.9.1" |
18 | difference = "2.0.0" | 21 | difference = "2.0.0" |
19 | # used as proc macro test target | 22 | # used as proc macro test target |
20 | serde_derive = "=1.0.104" \ No newline at end of file | 23 | serde_derive = "=1.0.104" |
diff --git a/crates/ra_proc_macro_srv/src/dylib.rs b/crates/ra_proc_macro_srv/src/dylib.rs new file mode 100644 index 000000000..ec63d587b --- /dev/null +++ b/crates/ra_proc_macro_srv/src/dylib.rs | |||
@@ -0,0 +1,211 @@ | |||
1 | //! Handles dynamic library loading for proc macro | ||
2 | |||
3 | use crate::{proc_macro::bridge, rustc_server::TokenStream}; | ||
4 | use std::path::Path; | ||
5 | |||
6 | use goblin::{mach::Mach, Object}; | ||
7 | use libloading::Library; | ||
8 | use ra_proc_macro::ProcMacroKind; | ||
9 | |||
10 | use std::io::Error as IoError; | ||
11 | use std::io::ErrorKind as IoErrorKind; | ||
12 | |||
13 | const NEW_REGISTRAR_SYMBOL: &str = "_rustc_proc_macro_decls_"; | ||
14 | |||
15 | fn invalid_data_err(e: impl Into<Box<dyn std::error::Error + Send + Sync>>) -> IoError { | ||
16 | IoError::new(IoErrorKind::InvalidData, e) | ||
17 | } | ||
18 | |||
19 | fn get_symbols_from_lib(file: &Path) -> Result<Vec<String>, IoError> { | ||
20 | let buffer = std::fs::read(file)?; | ||
21 | let object = Object::parse(&buffer).map_err(invalid_data_err)?; | ||
22 | |||
23 | match object { | ||
24 | Object::Elf(elf) => { | ||
25 | let symbols = elf.dynstrtab.to_vec().map_err(invalid_data_err)?; | ||
26 | let names = symbols.iter().map(|s| s.to_string()).collect(); | ||
27 | Ok(names) | ||
28 | } | ||
29 | Object::PE(pe) => { | ||
30 | let symbol_names = | ||
31 | pe.exports.iter().flat_map(|s| s.name).map(|n| n.to_string()).collect(); | ||
32 | Ok(symbol_names) | ||
33 | } | ||
34 | Object::Mach(mach) => match mach { | ||
35 | Mach::Binary(binary) => { | ||
36 | let exports = binary.exports().map_err(invalid_data_err)?; | ||
37 | let names = exports | ||
38 | .into_iter() | ||
39 | .map(|s| { | ||
40 | // In macos doc: | ||
41 | // https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/dlsym.3.html | ||
42 | // Unlike other dyld API's, the symbol name passed to dlsym() must NOT be | ||
43 | // prepended with an underscore. | ||
44 | if s.name.starts_with("_") { | ||
45 | s.name[1..].to_string() | ||
46 | } else { | ||
47 | s.name | ||
48 | } | ||
49 | }) | ||
50 | .collect(); | ||
51 | Ok(names) | ||
52 | } | ||
53 | Mach::Fat(_) => Ok(vec![]), | ||
54 | }, | ||
55 | Object::Archive(_) | Object::Unknown(_) => Ok(vec![]), | ||
56 | } | ||
57 | } | ||
58 | |||
59 | fn is_derive_registrar_symbol(symbol: &str) -> bool { | ||
60 | symbol.contains(NEW_REGISTRAR_SYMBOL) | ||
61 | } | ||
62 | |||
63 | fn find_registrar_symbol(file: &Path) -> Result<Option<String>, IoError> { | ||
64 | let symbols = get_symbols_from_lib(file)?; | ||
65 | Ok(symbols.into_iter().find(|s| is_derive_registrar_symbol(s))) | ||
66 | } | ||
67 | |||
68 | /// Loads dynamic library in platform dependent manner. | ||
69 | /// | ||
70 | /// For unix, you have to use RTLD_DEEPBIND flag to escape problems described | ||
71 | /// [here](https://github.com/fedochet/rust-proc-macro-panic-inside-panic-expample) | ||
72 | /// and [here](https://github.com/rust-lang/rust/issues/60593). | ||
73 | /// | ||
74 | /// Usage of RTLD_DEEPBIND | ||
75 | /// [here](https://github.com/fedochet/rust-proc-macro-panic-inside-panic-expample/issues/1) | ||
76 | /// | ||
77 | /// It seems that on Windows that behaviour is default, so we do nothing in that case. | ||
78 | #[cfg(windows)] | ||
79 | fn load_library(file: &Path) -> Result<Library, libloading::Error> { | ||
80 | Library::new(file) | ||
81 | } | ||
82 | |||
83 | #[cfg(unix)] | ||
84 | fn load_library(file: &Path) -> Result<Library, libloading::Error> { | ||
85 | use libloading::os::unix::Library as UnixLibrary; | ||
86 | use std::os::raw::c_int; | ||
87 | |||
88 | const RTLD_NOW: c_int = 0x00002; | ||
89 | const RTLD_DEEPBIND: c_int = 0x00008; | ||
90 | |||
91 | UnixLibrary::open(Some(file), RTLD_NOW | RTLD_DEEPBIND).map(|lib| lib.into()) | ||
92 | } | ||
93 | |||
94 | struct ProcMacroLibraryLibloading { | ||
95 | // Hold the dylib to prevent it for unloadeding | ||
96 | _lib: Library, | ||
97 | exported_macros: Vec<bridge::client::ProcMacro>, | ||
98 | } | ||
99 | |||
100 | impl ProcMacroLibraryLibloading { | ||
101 | fn open(file: &Path) -> Result<Self, IoError> { | ||
102 | let symbol_name = find_registrar_symbol(file)? | ||
103 | .ok_or(invalid_data_err(format!("Cannot find registrar symbol in file {:?}", file)))?; | ||
104 | |||
105 | let lib = load_library(file).map_err(invalid_data_err)?; | ||
106 | let exported_macros = { | ||
107 | let macros: libloading::Symbol<&&[bridge::client::ProcMacro]> = | ||
108 | unsafe { lib.get(symbol_name.as_bytes()) }.map_err(invalid_data_err)?; | ||
109 | macros.to_vec() | ||
110 | }; | ||
111 | |||
112 | Ok(ProcMacroLibraryLibloading { _lib: lib, exported_macros }) | ||
113 | } | ||
114 | } | ||
115 | |||
116 | type ProcMacroLibraryImpl = ProcMacroLibraryLibloading; | ||
117 | |||
118 | pub struct Expander { | ||
119 | libs: Vec<ProcMacroLibraryImpl>, | ||
120 | } | ||
121 | |||
122 | impl Expander { | ||
123 | pub fn new<P: AsRef<Path>>(lib: &P) -> Result<Expander, String> { | ||
124 | let mut libs = vec![]; | ||
125 | /* Some libraries for dynamic loading require canonicalized path (even when it is | ||
126 | already absolute | ||
127 | */ | ||
128 | let lib = | ||
129 | lib.as_ref().canonicalize().expect(&format!("Cannot canonicalize {:?}", lib.as_ref())); | ||
130 | |||
131 | let library = ProcMacroLibraryImpl::open(&lib).map_err(|e| e.to_string())?; | ||
132 | libs.push(library); | ||
133 | |||
134 | Ok(Expander { libs }) | ||
135 | } | ||
136 | |||
137 | pub fn expand( | ||
138 | &self, | ||
139 | macro_name: &str, | ||
140 | macro_body: &ra_tt::Subtree, | ||
141 | attributes: Option<&ra_tt::Subtree>, | ||
142 | ) -> Result<ra_tt::Subtree, bridge::PanicMessage> { | ||
143 | let parsed_body = TokenStream::with_subtree(macro_body.clone()); | ||
144 | |||
145 | let parsed_attributes = attributes | ||
146 | .map_or(crate::rustc_server::TokenStream::new(), |attr| { | ||
147 | TokenStream::with_subtree(attr.clone()) | ||
148 | }); | ||
149 | |||
150 | for lib in &self.libs { | ||
151 | for proc_macro in &lib.exported_macros { | ||
152 | match proc_macro { | ||
153 | bridge::client::ProcMacro::CustomDerive { trait_name, client, .. } | ||
154 | if *trait_name == macro_name => | ||
155 | { | ||
156 | let res = client.run( | ||
157 | &crate::proc_macro::bridge::server::SameThread, | ||
158 | crate::rustc_server::Rustc::default(), | ||
159 | parsed_body, | ||
160 | ); | ||
161 | return res.map(|it| it.subtree); | ||
162 | } | ||
163 | bridge::client::ProcMacro::Bang { name, client } if *name == macro_name => { | ||
164 | let res = client.run( | ||
165 | &crate::proc_macro::bridge::server::SameThread, | ||
166 | crate::rustc_server::Rustc::default(), | ||
167 | parsed_body, | ||
168 | ); | ||
169 | return res.map(|it| it.subtree); | ||
170 | } | ||
171 | bridge::client::ProcMacro::Attr { name, client } if *name == macro_name => { | ||
172 | let res = client.run( | ||
173 | &crate::proc_macro::bridge::server::SameThread, | ||
174 | crate::rustc_server::Rustc::default(), | ||
175 | parsed_attributes, | ||
176 | parsed_body, | ||
177 | ); | ||
178 | |||
179 | return res.map(|it| it.subtree); | ||
180 | } | ||
181 | _ => continue, | ||
182 | } | ||
183 | } | ||
184 | } | ||
185 | |||
186 | Err(bridge::PanicMessage::String("Nothing to expand".to_string())) | ||
187 | } | ||
188 | |||
189 | pub fn list_macros(&self) -> Result<Vec<(String, ProcMacroKind)>, bridge::PanicMessage> { | ||
190 | let mut result = vec![]; | ||
191 | |||
192 | for lib in &self.libs { | ||
193 | for proc_macro in &lib.exported_macros { | ||
194 | let res = match proc_macro { | ||
195 | bridge::client::ProcMacro::CustomDerive { trait_name, .. } => { | ||
196 | (trait_name.to_string(), ProcMacroKind::CustomDerive) | ||
197 | } | ||
198 | bridge::client::ProcMacro::Bang { name, .. } => { | ||
199 | (name.to_string(), ProcMacroKind::FuncLike) | ||
200 | } | ||
201 | bridge::client::ProcMacro::Attr { name, .. } => { | ||
202 | (name.to_string(), ProcMacroKind::Attr) | ||
203 | } | ||
204 | }; | ||
205 | result.push(res); | ||
206 | } | ||
207 | } | ||
208 | |||
209 | Ok(result) | ||
210 | } | ||
211 | } | ||
diff --git a/crates/ra_proc_macro_srv/src/lib.rs b/crates/ra_proc_macro_srv/src/lib.rs index f376df236..59716cbb3 100644 --- a/crates/ra_proc_macro_srv/src/lib.rs +++ b/crates/ra_proc_macro_srv/src/lib.rs | |||
@@ -17,13 +17,41 @@ mod proc_macro; | |||
17 | #[doc(hidden)] | 17 | #[doc(hidden)] |
18 | mod rustc_server; | 18 | mod rustc_server; |
19 | 19 | ||
20 | mod dylib; | ||
21 | |||
20 | use proc_macro::bridge::client::TokenStream; | 22 | use proc_macro::bridge::client::TokenStream; |
21 | use ra_proc_macro::{ExpansionResult, ExpansionTask, ListMacrosResult, ListMacrosTask}; | 23 | use ra_proc_macro::{ExpansionResult, ExpansionTask, ListMacrosResult, ListMacrosTask}; |
22 | 24 | ||
23 | pub fn expand_task(_task: &ExpansionTask) -> Result<ExpansionResult, String> { | 25 | pub fn expand_task(task: &ExpansionTask) -> Result<ExpansionResult, String> { |
24 | unimplemented!() | 26 | let expander = dylib::Expander::new(&task.lib) |
27 | .expect(&format!("Cannot expand with provided libraries: ${:?}", &task.lib)); | ||
28 | |||
29 | match expander.expand(&task.macro_name, &task.macro_body, task.attributes.as_ref()) { | ||
30 | Ok(expansion) => Ok(ExpansionResult { expansion }), | ||
31 | Err(msg) => { | ||
32 | let reason = format!( | ||
33 | "Cannot perform expansion for {}: error {:?}!", | ||
34 | &task.macro_name, | ||
35 | msg.as_str() | ||
36 | ); | ||
37 | Err(reason) | ||
38 | } | ||
39 | } | ||
25 | } | 40 | } |
26 | 41 | ||
27 | pub fn list_macros(_task: &ListMacrosTask) -> Result<ListMacrosResult, String> { | 42 | pub fn list_macros(task: &ListMacrosTask) -> Result<ListMacrosResult, String> { |
28 | unimplemented!() | 43 | let expander = dylib::Expander::new(&task.lib) |
44 | .expect(&format!("Cannot expand with provided libraries: ${:?}", &task.lib)); | ||
45 | |||
46 | match expander.list_macros() { | ||
47 | Ok(macros) => Ok(ListMacrosResult { macros }), | ||
48 | Err(msg) => { | ||
49 | let reason = | ||
50 | format!("Cannot perform expansion for {:?}: error {:?}!", &task.lib, msg.as_str()); | ||
51 | Err(reason) | ||
52 | } | ||
53 | } | ||
29 | } | 54 | } |
55 | |||
56 | #[cfg(test)] | ||
57 | mod tests; | ||
diff --git a/crates/ra_proc_macro_srv/src/rustc_server.rs b/crates/ra_proc_macro_srv/src/rustc_server.rs index 92d1fd989..ec0d35692 100644 --- a/crates/ra_proc_macro_srv/src/rustc_server.rs +++ b/crates/ra_proc_macro_srv/src/rustc_server.rs | |||
@@ -34,6 +34,10 @@ impl TokenStream { | |||
34 | TokenStream { subtree: Default::default() } | 34 | TokenStream { subtree: Default::default() } |
35 | } | 35 | } |
36 | 36 | ||
37 | pub fn with_subtree(subtree: tt::Subtree) -> Self { | ||
38 | TokenStream { subtree } | ||
39 | } | ||
40 | |||
37 | pub fn is_empty(&self) -> bool { | 41 | pub fn is_empty(&self) -> bool { |
38 | self.subtree.token_trees.is_empty() | 42 | self.subtree.token_trees.is_empty() |
39 | } | 43 | } |
diff --git a/crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt b/crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt new file mode 100644 index 000000000..24507d98d --- /dev/null +++ b/crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt | |||
@@ -0,0 +1,188 @@ | |||
1 | SUBTREE $ | ||
2 | PUNCH # [alone] 4294967295 | ||
3 | SUBTREE [] 4294967295 | ||
4 | IDENT allow 4294967295 | ||
5 | SUBTREE () 4294967295 | ||
6 | IDENT non_upper_case_globals 4294967295 | ||
7 | PUNCH , [alone] 4294967295 | ||
8 | IDENT unused_attributes 4294967295 | ||
9 | PUNCH , [alone] 4294967295 | ||
10 | IDENT unused_qualifications 4294967295 | ||
11 | IDENT const 4294967295 | ||
12 | IDENT _IMPL_SERIALIZE_FOR_Foo 4294967295 | ||
13 | PUNCH : [alone] 4294967295 | ||
14 | SUBTREE () 4294967295 | ||
15 | PUNCH = [alone] 4294967295 | ||
16 | SUBTREE {} 4294967295 | ||
17 | PUNCH # [alone] 4294967295 | ||
18 | SUBTREE [] 4294967295 | ||
19 | IDENT allow 4294967295 | ||
20 | SUBTREE () 4294967295 | ||
21 | IDENT unknown_lints 4294967295 | ||
22 | PUNCH # [alone] 4294967295 | ||
23 | SUBTREE [] 4294967295 | ||
24 | IDENT cfg_attr 4294967295 | ||
25 | SUBTREE () 4294967295 | ||
26 | IDENT feature 4294967295 | ||
27 | PUNCH = [alone] 4294967295 | ||
28 | SUBTREE $ | ||
29 | LITERAL "cargo-clippy" 0 | ||
30 | PUNCH , [alone] 4294967295 | ||
31 | IDENT allow 4294967295 | ||
32 | SUBTREE () 4294967295 | ||
33 | IDENT useless_attribute 4294967295 | ||
34 | PUNCH # [alone] 4294967295 | ||
35 | SUBTREE [] 4294967295 | ||
36 | IDENT allow 4294967295 | ||
37 | SUBTREE () 4294967295 | ||
38 | IDENT rust_2018_idioms 4294967295 | ||
39 | IDENT extern 4294967295 | ||
40 | IDENT crate 4294967295 | ||
41 | IDENT serde 4294967295 | ||
42 | IDENT as 4294967295 | ||
43 | IDENT _serde 4294967295 | ||
44 | PUNCH ; [alone] 4294967295 | ||
45 | PUNCH # [alone] 4294967295 | ||
46 | SUBTREE [] 4294967295 | ||
47 | IDENT allow 4294967295 | ||
48 | SUBTREE () 4294967295 | ||
49 | IDENT unused_macros 4294967295 | ||
50 | IDENT macro_rules 4294967295 | ||
51 | PUNCH ! [alone] 4294967295 | ||
52 | IDENT try 4294967295 | ||
53 | SUBTREE {} 4294967295 | ||
54 | SUBTREE () 4294967295 | ||
55 | PUNCH $ [alone] 4294967295 | ||
56 | IDENT __expr 4294967295 | ||
57 | PUNCH : [alone] 4294967295 | ||
58 | IDENT expr 4294967295 | ||
59 | PUNCH = [joint] 4294967295 | ||
60 | PUNCH > [alone] 4294967295 | ||
61 | SUBTREE {} 4294967295 | ||
62 | IDENT match 4294967295 | ||
63 | PUNCH $ [alone] 4294967295 | ||
64 | IDENT __expr 4294967295 | ||
65 | SUBTREE {} 4294967295 | ||
66 | IDENT _serde 4294967295 | ||
67 | PUNCH : [joint] 4294967295 | ||
68 | PUNCH : [alone] 4294967295 | ||
69 | IDENT export 4294967295 | ||
70 | PUNCH : [joint] 4294967295 | ||
71 | PUNCH : [alone] 4294967295 | ||
72 | IDENT Ok 4294967295 | ||
73 | SUBTREE () 4294967295 | ||
74 | IDENT __val 4294967295 | ||
75 | PUNCH = [joint] 4294967295 | ||
76 | PUNCH > [alone] 4294967295 | ||
77 | IDENT __val 4294967295 | ||
78 | PUNCH , [alone] 4294967295 | ||
79 | IDENT _serde 4294967295 | ||
80 | PUNCH : [joint] 4294967295 | ||
81 | PUNCH : [alone] 4294967295 | ||
82 | IDENT export 4294967295 | ||
83 | PUNCH : [joint] 4294967295 | ||
84 | PUNCH : [alone] 4294967295 | ||
85 | IDENT Err 4294967295 | ||
86 | SUBTREE () 4294967295 | ||
87 | IDENT __err 4294967295 | ||
88 | PUNCH = [joint] 4294967295 | ||
89 | PUNCH > [alone] 4294967295 | ||
90 | SUBTREE {} 4294967295 | ||
91 | IDENT return 4294967295 | ||
92 | IDENT _serde 4294967295 | ||
93 | PUNCH : [joint] 4294967295 | ||
94 | PUNCH : [alone] 4294967295 | ||
95 | IDENT export 4294967295 | ||
96 | PUNCH : [joint] 4294967295 | ||
97 | PUNCH : [alone] 4294967295 | ||
98 | IDENT Err 4294967295 | ||
99 | SUBTREE () 4294967295 | ||
100 | IDENT __err 4294967295 | ||
101 | PUNCH ; [alone] 4294967295 | ||
102 | PUNCH # [alone] 4294967295 | ||
103 | SUBTREE [] 4294967295 | ||
104 | IDENT automatically_derived 4294967295 | ||
105 | IDENT impl 4294967295 | ||
106 | IDENT _serde 4294967295 | ||
107 | PUNCH : [joint] 4294967295 | ||
108 | PUNCH : [alone] 4294967295 | ||
109 | IDENT Serialize 4294967295 | ||
110 | IDENT for 4294967295 | ||
111 | IDENT Foo 1 | ||
112 | SUBTREE {} 4294967295 | ||
113 | IDENT fn 4294967295 | ||
114 | IDENT serialize 4294967295 | ||
115 | PUNCH < [alone] 4294967295 | ||
116 | IDENT __S 4294967295 | ||
117 | PUNCH > [alone] 4294967295 | ||
118 | SUBTREE () 4294967295 | ||
119 | PUNCH & [alone] 4294967295 | ||
120 | IDENT self 4294967295 | ||
121 | PUNCH , [alone] 4294967295 | ||
122 | IDENT __serializer 4294967295 | ||
123 | PUNCH : [alone] 4294967295 | ||
124 | IDENT __S 4294967295 | ||
125 | PUNCH - [joint] 4294967295 | ||
126 | PUNCH > [alone] 4294967295 | ||
127 | IDENT _serde 4294967295 | ||
128 | PUNCH : [joint] 4294967295 | ||
129 | PUNCH : [alone] 4294967295 | ||
130 | IDENT export 4294967295 | ||
131 | PUNCH : [joint] 4294967295 | ||
132 | PUNCH : [alone] 4294967295 | ||
133 | IDENT Result 4294967295 | ||
134 | PUNCH < [alone] 4294967295 | ||
135 | IDENT __S 4294967295 | ||
136 | PUNCH : [joint] 4294967295 | ||
137 | PUNCH : [alone] 4294967295 | ||
138 | IDENT Ok 4294967295 | ||
139 | PUNCH , [alone] 4294967295 | ||
140 | IDENT __S 4294967295 | ||
141 | PUNCH : [joint] 4294967295 | ||
142 | PUNCH : [alone] 4294967295 | ||
143 | IDENT Error 4294967295 | ||
144 | PUNCH > [alone] 4294967295 | ||
145 | IDENT where 4294967295 | ||
146 | IDENT __S 4294967295 | ||
147 | PUNCH : [alone] 4294967295 | ||
148 | IDENT _serde 4294967295 | ||
149 | PUNCH : [joint] 4294967295 | ||
150 | PUNCH : [alone] 4294967295 | ||
151 | IDENT Serializer 4294967295 | ||
152 | PUNCH , [alone] 4294967295 | ||
153 | SUBTREE {} 4294967295 | ||
154 | IDENT let 4294967295 | ||
155 | IDENT __serde_state 4294967295 | ||
156 | PUNCH = [alone] 4294967295 | ||
157 | IDENT try 4294967295 | ||
158 | PUNCH ! [alone] 4294967295 | ||
159 | SUBTREE () 4294967295 | ||
160 | IDENT _serde 4294967295 | ||
161 | PUNCH : [joint] 4294967295 | ||
162 | PUNCH : [alone] 4294967295 | ||
163 | IDENT Serializer 4294967295 | ||
164 | PUNCH : [joint] 4294967295 | ||
165 | PUNCH : [alone] 4294967295 | ||
166 | IDENT serialize_struct 4294967295 | ||
167 | SUBTREE () 4294967295 | ||
168 | IDENT __serializer 4294967295 | ||
169 | PUNCH , [alone] 4294967295 | ||
170 | LITERAL "Foo" 4294967295 | ||
171 | PUNCH , [alone] 4294967295 | ||
172 | IDENT false 4294967295 | ||
173 | IDENT as 4294967295 | ||
174 | IDENT usize 4294967295 | ||
175 | PUNCH ; [alone] 4294967295 | ||
176 | IDENT _serde 4294967295 | ||
177 | PUNCH : [joint] 4294967295 | ||
178 | PUNCH : [alone] 4294967295 | ||
179 | IDENT ser 4294967295 | ||
180 | PUNCH : [joint] 4294967295 | ||
181 | PUNCH : [alone] 4294967295 | ||
182 | IDENT SerializeStruct 4294967295 | ||
183 | PUNCH : [joint] 4294967295 | ||
184 | PUNCH : [alone] 4294967295 | ||
185 | IDENT end 4294967295 | ||
186 | SUBTREE () 4294967295 | ||
187 | IDENT __serde_state 4294967295 | ||
188 | PUNCH ; [alone] 4294967295 \ No newline at end of file | ||
diff --git a/crates/ra_proc_macro_srv/src/tests/mod.rs b/crates/ra_proc_macro_srv/src/tests/mod.rs new file mode 100644 index 000000000..03f79bc5d --- /dev/null +++ b/crates/ra_proc_macro_srv/src/tests/mod.rs | |||
@@ -0,0 +1,47 @@ | |||
1 | //! proc-macro tests | ||
2 | |||
3 | #[macro_use] | ||
4 | mod utils; | ||
5 | use test_utils::assert_eq_text; | ||
6 | use utils::*; | ||
7 | |||
8 | #[test] | ||
9 | fn test_derive_serialize_proc_macro() { | ||
10 | assert_expand( | ||
11 | "serde_derive", | ||
12 | "Serialize", | ||
13 | "1.0.104", | ||
14 | r##"struct Foo {}"##, | ||
15 | include_str!("fixtures/test_serialize_proc_macro.txt"), | ||
16 | ); | ||
17 | } | ||
18 | |||
19 | #[test] | ||
20 | fn test_derive_serialize_proc_macro_failed() { | ||
21 | assert_expand( | ||
22 | "serde_derive", | ||
23 | "Serialize", | ||
24 | "1.0.104", | ||
25 | r##" | ||
26 | struct {} | ||
27 | "##, | ||
28 | r##" | ||
29 | SUBTREE $ | ||
30 | IDENT compile_error 4294967295 | ||
31 | PUNCH ! [alone] 4294967295 | ||
32 | SUBTREE {} 4294967295 | ||
33 | LITERAL "expected identifier" 4294967295 | ||
34 | "##, | ||
35 | ); | ||
36 | } | ||
37 | |||
38 | #[test] | ||
39 | fn test_derive_proc_macro_list() { | ||
40 | let res = list("serde_derive", "1.0.104").join("\n"); | ||
41 | |||
42 | assert_eq_text!( | ||
43 | &res, | ||
44 | r#"Serialize [CustomDerive] | ||
45 | Deserialize [CustomDerive]"# | ||
46 | ); | ||
47 | } | ||
diff --git a/crates/ra_proc_macro_srv/src/tests/utils.rs b/crates/ra_proc_macro_srv/src/tests/utils.rs new file mode 100644 index 000000000..1ee409449 --- /dev/null +++ b/crates/ra_proc_macro_srv/src/tests/utils.rs | |||
@@ -0,0 +1,65 @@ | |||
1 | //! utils used in proc-macro tests | ||
2 | |||
3 | use crate::dylib; | ||
4 | use crate::list_macros; | ||
5 | pub use difference::Changeset as __Changeset; | ||
6 | use ra_proc_macro::ListMacrosTask; | ||
7 | use std::str::FromStr; | ||
8 | use test_utils::assert_eq_text; | ||
9 | |||
10 | mod fixtures { | ||
11 | use cargo_metadata::{parse_messages, Message}; | ||
12 | use std::process::Command; | ||
13 | |||
14 | // Use current project metadata to get the proc-macro dylib path | ||
15 | pub fn dylib_path(crate_name: &str, version: &str) -> std::path::PathBuf { | ||
16 | let command = Command::new("cargo") | ||
17 | .args(&["check", "--message-format", "json"]) | ||
18 | .output() | ||
19 | .unwrap() | ||
20 | .stdout; | ||
21 | |||
22 | for message in parse_messages(command.as_slice()) { | ||
23 | match message.unwrap() { | ||
24 | Message::CompilerArtifact(artifact) => { | ||
25 | if artifact.target.kind.contains(&"proc-macro".to_string()) { | ||
26 | let repr = format!("{} {}", crate_name, version); | ||
27 | if artifact.package_id.repr.starts_with(&repr) { | ||
28 | return artifact.filenames[0].clone(); | ||
29 | } | ||
30 | } | ||
31 | } | ||
32 | _ => (), // Unknown message | ||
33 | } | ||
34 | } | ||
35 | |||
36 | panic!("No proc-macro dylib for {} found!", crate_name); | ||
37 | } | ||
38 | } | ||
39 | |||
40 | fn parse_string(code: &str) -> Option<crate::rustc_server::TokenStream> { | ||
41 | Some(crate::rustc_server::TokenStream::from_str(code).unwrap()) | ||
42 | } | ||
43 | |||
44 | pub fn assert_expand( | ||
45 | crate_name: &str, | ||
46 | macro_name: &str, | ||
47 | version: &str, | ||
48 | fixture: &str, | ||
49 | expect: &str, | ||
50 | ) { | ||
51 | let path = fixtures::dylib_path(crate_name, version); | ||
52 | let expander = dylib::Expander::new(&path).unwrap(); | ||
53 | let fixture = parse_string(fixture).unwrap(); | ||
54 | |||
55 | let res = expander.expand(macro_name, &fixture.subtree, None).unwrap(); | ||
56 | assert_eq_text!(&format!("{:?}", res), &expect.trim()); | ||
57 | } | ||
58 | |||
59 | pub fn list(crate_name: &str, version: &str) -> Vec<String> { | ||
60 | let path = fixtures::dylib_path(crate_name, version); | ||
61 | let task = ListMacrosTask { lib: path }; | ||
62 | |||
63 | let res = list_macros(&task).unwrap(); | ||
64 | res.macros.into_iter().map(|(name, kind)| format!("{} [{:?}]", name, kind)).collect() | ||
65 | } | ||
diff --git a/crates/ra_prof/src/lib.rs b/crates/ra_prof/src/lib.rs index 00ea3a9b0..2d4f68f5e 100644 --- a/crates/ra_prof/src/lib.rs +++ b/crates/ra_prof/src/lib.rs | |||
@@ -113,21 +113,6 @@ pub fn profile(label: Label) -> Profiler { | |||
113 | }) | 113 | }) |
114 | } | 114 | } |
115 | 115 | ||
116 | pub fn print_time(label: Label) -> impl Drop { | ||
117 | struct Guard { | ||
118 | label: Label, | ||
119 | start: Instant, | ||
120 | } | ||
121 | |||
122 | impl Drop for Guard { | ||
123 | fn drop(&mut self) { | ||
124 | eprintln!("{}: {:?}", self.label, self.start.elapsed()) | ||
125 | } | ||
126 | } | ||
127 | |||
128 | Guard { label, start: Instant::now() } | ||
129 | } | ||
130 | |||
131 | pub struct Profiler { | 116 | pub struct Profiler { |
132 | label: Option<Label>, | 117 | label: Option<Label>, |
133 | detail: Option<String>, | 118 | detail: Option<String>, |
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index a42eec91a..99c6b7219 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs | |||
@@ -42,11 +42,6 @@ pub trait AstNode { | |||
42 | fn syntax(&self) -> &SyntaxNode; | 42 | fn syntax(&self) -> &SyntaxNode; |
43 | } | 43 | } |
44 | 44 | ||
45 | #[test] | ||
46 | fn assert_ast_is_object_safe() { | ||
47 | fn _f(_: &dyn AstNode, _: &dyn NameOwner) {} | ||
48 | } | ||
49 | |||
50 | /// Like `AstNode`, but wraps tokens rather than interior nodes. | 45 | /// Like `AstNode`, but wraps tokens rather than interior nodes. |
51 | pub trait AstToken { | 46 | pub trait AstToken { |
52 | fn can_cast(token: SyntaxKind) -> bool | 47 | fn can_cast(token: SyntaxKind) -> bool |
@@ -64,22 +59,6 @@ pub trait AstToken { | |||
64 | } | 59 | } |
65 | } | 60 | } |
66 | 61 | ||
67 | mod support { | ||
68 | use super::{AstChildren, AstNode, AstToken, SyntaxNode}; | ||
69 | |||
70 | pub(super) fn child<N: AstNode>(parent: &SyntaxNode) -> Option<N> { | ||
71 | parent.children().find_map(N::cast) | ||
72 | } | ||
73 | |||
74 | pub(super) fn children<N: AstNode>(parent: &SyntaxNode) -> AstChildren<N> { | ||
75 | AstChildren::new(parent) | ||
76 | } | ||
77 | |||
78 | pub(super) fn token<T: AstToken>(parent: &SyntaxNode) -> Option<T> { | ||
79 | parent.children_with_tokens().filter_map(|it| it.into_token()).find_map(T::cast) | ||
80 | } | ||
81 | } | ||
82 | |||
83 | /// An iterator over `SyntaxNode` children of a particular AST type. | 62 | /// An iterator over `SyntaxNode` children of a particular AST type. |
84 | #[derive(Debug, Clone)] | 63 | #[derive(Debug, Clone)] |
85 | pub struct AstChildren<N> { | 64 | pub struct AstChildren<N> { |
@@ -100,12 +79,25 @@ impl<N: AstNode> Iterator for AstChildren<N> { | |||
100 | } | 79 | } |
101 | } | 80 | } |
102 | 81 | ||
103 | fn child_opt<P: AstNode + ?Sized, C: AstNode>(parent: &P) -> Option<C> { | 82 | mod support { |
104 | children(parent).next() | 83 | use super::{AstChildren, AstNode, SyntaxKind, SyntaxNode, SyntaxToken}; |
84 | |||
85 | pub(super) fn child<N: AstNode>(parent: &SyntaxNode) -> Option<N> { | ||
86 | parent.children().find_map(N::cast) | ||
87 | } | ||
88 | |||
89 | pub(super) fn children<N: AstNode>(parent: &SyntaxNode) -> AstChildren<N> { | ||
90 | AstChildren::new(parent) | ||
91 | } | ||
92 | |||
93 | pub(super) fn token(parent: &SyntaxNode, kind: SyntaxKind) -> Option<SyntaxToken> { | ||
94 | parent.children_with_tokens().filter_map(|it| it.into_token()).find(|it| it.kind() == kind) | ||
95 | } | ||
105 | } | 96 | } |
106 | 97 | ||
107 | fn children<P: AstNode + ?Sized, C: AstNode>(parent: &P) -> AstChildren<C> { | 98 | #[test] |
108 | AstChildren::new(parent.syntax()) | 99 | fn assert_ast_is_object_safe() { |
100 | fn _f(_: &dyn AstNode, _: &dyn NameOwner) {} | ||
109 | } | 101 | } |
110 | 102 | ||
111 | #[test] | 103 | #[test] |
@@ -287,7 +279,7 @@ where | |||
287 | let pred = predicates.next().unwrap(); | 279 | let pred = predicates.next().unwrap(); |
288 | let mut bounds = pred.type_bound_list().unwrap().bounds(); | 280 | let mut bounds = pred.type_bound_list().unwrap().bounds(); |
289 | 281 | ||
290 | assert_eq!("'a", pred.lifetime().unwrap().text()); | 282 | assert_eq!("'a", pred.lifetime_token().unwrap().text()); |
291 | 283 | ||
292 | assert_bound("'b", bounds.next()); | 284 | assert_bound("'b", bounds.next()); |
293 | assert_bound("'c", bounds.next()); | 285 | assert_bound("'c", bounds.next()); |
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs index d79310995..9e5411ee5 100644 --- a/crates/ra_syntax/src/ast/edit.rs +++ b/crates/ra_syntax/src/ast/edit.rs | |||
@@ -6,7 +6,7 @@ use std::{iter, ops::RangeInclusive}; | |||
6 | use arrayvec::ArrayVec; | 6 | use arrayvec::ArrayVec; |
7 | 7 | ||
8 | use crate::{ | 8 | use crate::{ |
9 | algo, | 9 | algo::{self, neighbor, SyntaxRewriter}, |
10 | ast::{ | 10 | ast::{ |
11 | self, | 11 | self, |
12 | make::{self, tokens}, | 12 | make::{self, tokens}, |
@@ -16,7 +16,6 @@ use crate::{ | |||
16 | SyntaxKind::{ATTR, COMMENT, WHITESPACE}, | 16 | SyntaxKind::{ATTR, COMMENT, WHITESPACE}, |
17 | SyntaxNode, SyntaxToken, T, | 17 | SyntaxNode, SyntaxToken, T, |
18 | }; | 18 | }; |
19 | use algo::{neighbor, SyntaxRewriter}; | ||
20 | 19 | ||
21 | impl ast::BinExpr { | 20 | impl ast::BinExpr { |
22 | #[must_use] | 21 | #[must_use] |
@@ -96,10 +95,10 @@ impl ast::ItemList { | |||
96 | leading_indent(it.syntax()).unwrap_or_default().to_string(), | 95 | leading_indent(it.syntax()).unwrap_or_default().to_string(), |
97 | InsertPosition::After(it.syntax().clone().into()), | 96 | InsertPosition::After(it.syntax().clone().into()), |
98 | ), | 97 | ), |
99 | None => match self.l_curly() { | 98 | None => match self.l_curly_token() { |
100 | Some(it) => ( | 99 | Some(it) => ( |
101 | " ".to_string() + &leading_indent(self.syntax()).unwrap_or_default(), | 100 | " ".to_string() + &leading_indent(self.syntax()).unwrap_or_default(), |
102 | InsertPosition::After(it.syntax().clone().into()), | 101 | InsertPosition::After(it.into()), |
103 | ), | 102 | ), |
104 | None => return self.clone(), | 103 | None => return self.clone(), |
105 | }, | 104 | }, |
@@ -142,8 +141,8 @@ impl ast::RecordFieldList { | |||
142 | 141 | ||
143 | macro_rules! after_l_curly { | 142 | macro_rules! after_l_curly { |
144 | () => {{ | 143 | () => {{ |
145 | let anchor = match self.l_curly() { | 144 | let anchor = match self.l_curly_token() { |
146 | Some(it) => it.syntax().clone().into(), | 145 | Some(it) => it.into(), |
147 | None => return self.clone(), | 146 | None => return self.clone(), |
148 | }; | 147 | }; |
149 | InsertPosition::After(anchor) | 148 | InsertPosition::After(anchor) |
@@ -190,15 +189,15 @@ impl ast::RecordFieldList { | |||
190 | impl ast::TypeParam { | 189 | impl ast::TypeParam { |
191 | #[must_use] | 190 | #[must_use] |
192 | pub fn remove_bounds(&self) -> ast::TypeParam { | 191 | pub fn remove_bounds(&self) -> ast::TypeParam { |
193 | let colon = match self.colon() { | 192 | let colon = match self.colon_token() { |
194 | Some(it) => it, | 193 | Some(it) => it, |
195 | None => return self.clone(), | 194 | None => return self.clone(), |
196 | }; | 195 | }; |
197 | let end = match self.type_bound_list() { | 196 | let end = match self.type_bound_list() { |
198 | Some(it) => it.syntax().clone().into(), | 197 | Some(it) => it.syntax().clone().into(), |
199 | None => colon.syntax().clone().into(), | 198 | None => colon.clone().into(), |
200 | }; | 199 | }; |
201 | self.replace_children(colon.syntax().clone().into()..=end, iter::empty()) | 200 | self.replace_children(colon.into()..=end, iter::empty()) |
202 | } | 201 | } |
203 | } | 202 | } |
204 | 203 | ||
@@ -301,7 +300,7 @@ impl ast::UseTree { | |||
301 | suffix.clone(), | 300 | suffix.clone(), |
302 | self.use_tree_list(), | 301 | self.use_tree_list(), |
303 | self.alias(), | 302 | self.alias(), |
304 | self.star().is_some(), | 303 | self.star_token().is_some(), |
305 | ); | 304 | ); |
306 | let nested = make::use_tree_list(iter::once(use_tree)); | 305 | let nested = make::use_tree_list(iter::once(use_tree)); |
307 | return make::use_tree(prefix.clone(), Some(nested), None, false); | 306 | return make::use_tree(prefix.clone(), Some(nested), None, false); |
diff --git a/crates/ra_syntax/src/ast/expr_extensions.rs b/crates/ra_syntax/src/ast/expr_extensions.rs index 40c8fca3b..93aa3d45f 100644 --- a/crates/ra_syntax/src/ast/expr_extensions.rs +++ b/crates/ra_syntax/src/ast/expr_extensions.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! Various extension methods to ast Expr Nodes, which are hard to code-generate. | 1 | //! Various extension methods to ast Expr Nodes, which are hard to code-generate. |
2 | 2 | ||
3 | use crate::{ | 3 | use crate::{ |
4 | ast::{self, child_opt, children, AstChildren, AstNode}, | 4 | ast::{self, support, AstChildren, AstNode}, |
5 | SmolStr, | 5 | SmolStr, |
6 | SyntaxKind::*, | 6 | SyntaxKind::*, |
7 | SyntaxToken, T, | 7 | SyntaxToken, T, |
@@ -36,7 +36,7 @@ impl ast::IfExpr { | |||
36 | let res = match self.blocks().nth(1) { | 36 | let res = match self.blocks().nth(1) { |
37 | Some(block) => ElseBranch::Block(block), | 37 | Some(block) => ElseBranch::Block(block), |
38 | None => { | 38 | None => { |
39 | let elif: ast::IfExpr = child_opt(self)?; | 39 | let elif: ast::IfExpr = support::child(self.syntax())?; |
40 | ElseBranch::IfExpr(elif) | 40 | ElseBranch::IfExpr(elif) |
41 | } | 41 | } |
42 | }; | 42 | }; |
@@ -44,17 +44,7 @@ impl ast::IfExpr { | |||
44 | } | 44 | } |
45 | 45 | ||
46 | fn blocks(&self) -> AstChildren<ast::BlockExpr> { | 46 | fn blocks(&self) -> AstChildren<ast::BlockExpr> { |
47 | children(self) | 47 | support::children(self.syntax()) |
48 | } | ||
49 | } | ||
50 | |||
51 | impl ast::RefExpr { | ||
52 | pub fn is_mut(&self) -> bool { | ||
53 | self.syntax().children_with_tokens().any(|n| n.kind() == T![mut]) | ||
54 | } | ||
55 | |||
56 | pub fn raw_token(&self) -> Option<SyntaxToken> { | ||
57 | None // FIXME: implement &raw | ||
58 | } | 48 | } |
59 | } | 49 | } |
60 | 50 | ||
@@ -212,15 +202,15 @@ impl ast::BinExpr { | |||
212 | } | 202 | } |
213 | 203 | ||
214 | pub fn lhs(&self) -> Option<ast::Expr> { | 204 | pub fn lhs(&self) -> Option<ast::Expr> { |
215 | children(self).next() | 205 | support::children(self.syntax()).next() |
216 | } | 206 | } |
217 | 207 | ||
218 | pub fn rhs(&self) -> Option<ast::Expr> { | 208 | pub fn rhs(&self) -> Option<ast::Expr> { |
219 | children(self).nth(1) | 209 | support::children(self.syntax()).nth(1) |
220 | } | 210 | } |
221 | 211 | ||
222 | pub fn sub_exprs(&self) -> (Option<ast::Expr>, Option<ast::Expr>) { | 212 | pub fn sub_exprs(&self) -> (Option<ast::Expr>, Option<ast::Expr>) { |
223 | let mut children = children(self); | 213 | let mut children = support::children(self.syntax()); |
224 | let first = children.next(); | 214 | let first = children.next(); |
225 | let second = children.next(); | 215 | let second = children.next(); |
226 | (first, second) | 216 | (first, second) |
@@ -275,10 +265,10 @@ impl ast::RangeExpr { | |||
275 | 265 | ||
276 | impl ast::IndexExpr { | 266 | impl ast::IndexExpr { |
277 | pub fn base(&self) -> Option<ast::Expr> { | 267 | pub fn base(&self) -> Option<ast::Expr> { |
278 | children(self).next() | 268 | support::children(self.syntax()).next() |
279 | } | 269 | } |
280 | pub fn index(&self) -> Option<ast::Expr> { | 270 | pub fn index(&self) -> Option<ast::Expr> { |
281 | children(self).nth(1) | 271 | support::children(self.syntax()).nth(1) |
282 | } | 272 | } |
283 | } | 273 | } |
284 | 274 | ||
@@ -291,11 +281,11 @@ impl ast::ArrayExpr { | |||
291 | pub fn kind(&self) -> ArrayExprKind { | 281 | pub fn kind(&self) -> ArrayExprKind { |
292 | if self.is_repeat() { | 282 | if self.is_repeat() { |
293 | ArrayExprKind::Repeat { | 283 | ArrayExprKind::Repeat { |
294 | initializer: children(self).next(), | 284 | initializer: support::children(self.syntax()).next(), |
295 | repeat: children(self).nth(1), | 285 | repeat: support::children(self.syntax()).nth(1), |
296 | } | 286 | } |
297 | } else { | 287 | } else { |
298 | ArrayExprKind::ElementList(children(self)) | 288 | ArrayExprKind::ElementList(support::children(self.syntax())) |
299 | } | 289 | } |
300 | } | 290 | } |
301 | 291 | ||
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs index 33fe60762..63e272fbf 100644 --- a/crates/ra_syntax/src/ast/extensions.rs +++ b/crates/ra_syntax/src/ast/extensions.rs | |||
@@ -2,16 +2,12 @@ | |||
2 | //! Extensions for various expressions live in a sibling `expr_extensions` module. | 2 | //! Extensions for various expressions live in a sibling `expr_extensions` module. |
3 | 3 | ||
4 | use itertools::Itertools; | 4 | use itertools::Itertools; |
5 | use ra_parser::SyntaxKind; | ||
5 | 6 | ||
6 | use crate::{ | 7 | use crate::{ |
7 | ast::{ | 8 | ast::{self, support, AstNode, AttrInput, NameOwner, SyntaxNode}, |
8 | self, child_opt, children, support, AstNode, AstToken, AttrInput, NameOwner, SyntaxNode, | 9 | SmolStr, SyntaxElement, SyntaxToken, T, |
9 | }, | ||
10 | SmolStr, SyntaxElement, | ||
11 | SyntaxKind::*, | ||
12 | SyntaxToken, T, | ||
13 | }; | 10 | }; |
14 | use ra_parser::SyntaxKind; | ||
15 | 11 | ||
16 | impl ast::Name { | 12 | impl ast::Name { |
17 | pub fn text(&self) -> &SmolStr { | 13 | pub fn text(&self) -> &SmolStr { |
@@ -25,13 +21,7 @@ impl ast::NameRef { | |||
25 | } | 21 | } |
26 | 22 | ||
27 | pub fn as_tuple_field(&self) -> Option<usize> { | 23 | pub fn as_tuple_field(&self) -> Option<usize> { |
28 | self.syntax().children_with_tokens().find_map(|c| { | 24 | self.text().parse().ok() |
29 | if c.kind() == SyntaxKind::INT_NUMBER { | ||
30 | c.as_token().and_then(|tok| tok.text().as_str().parse().ok()) | ||
31 | } else { | ||
32 | None | ||
33 | } | ||
34 | }) | ||
35 | } | 25 | } |
36 | } | 26 | } |
37 | 27 | ||
@@ -87,7 +77,7 @@ impl ast::Attr { | |||
87 | first_token.and_then(|token| token.next_token()).as_ref().map(SyntaxToken::kind); | 77 | first_token.and_then(|token| token.next_token()).as_ref().map(SyntaxToken::kind); |
88 | 78 | ||
89 | match (first_token_kind, second_token_kind) { | 79 | match (first_token_kind, second_token_kind) { |
90 | (Some(SyntaxKind::POUND), Some(SyntaxKind::EXCL)) => AttrKind::Inner, | 80 | (Some(SyntaxKind::POUND), Some(T![!])) => AttrKind::Inner, |
91 | _ => AttrKind::Outer, | 81 | _ => AttrKind::Outer, |
92 | } | 82 | } |
93 | } | 83 | } |
@@ -140,15 +130,6 @@ impl ast::Path { | |||
140 | } | 130 | } |
141 | } | 131 | } |
142 | 132 | ||
143 | impl ast::Module { | ||
144 | pub fn has_semi(&self) -> bool { | ||
145 | match self.syntax().last_child_or_token() { | ||
146 | None => false, | ||
147 | Some(node) => node.kind() == T![;], | ||
148 | } | ||
149 | } | ||
150 | } | ||
151 | |||
152 | impl ast::UseTreeList { | 133 | impl ast::UseTreeList { |
153 | pub fn parent_use_tree(&self) -> ast::UseTree { | 134 | pub fn parent_use_tree(&self) -> ast::UseTree { |
154 | self.syntax() | 135 | self.syntax() |
@@ -174,15 +155,11 @@ impl ast::ImplDef { | |||
174 | } | 155 | } |
175 | 156 | ||
176 | fn target(&self) -> (Option<ast::TypeRef>, Option<ast::TypeRef>) { | 157 | fn target(&self) -> (Option<ast::TypeRef>, Option<ast::TypeRef>) { |
177 | let mut types = children(self); | 158 | let mut types = support::children(self.syntax()); |
178 | let first = types.next(); | 159 | let first = types.next(); |
179 | let second = types.next(); | 160 | let second = types.next(); |
180 | (first, second) | 161 | (first, second) |
181 | } | 162 | } |
182 | |||
183 | pub fn is_negative(&self) -> bool { | ||
184 | self.syntax().children_with_tokens().any(|t| t.kind() == T![!]) | ||
185 | } | ||
186 | } | 163 | } |
187 | 164 | ||
188 | #[derive(Debug, Clone, PartialEq, Eq)] | 165 | #[derive(Debug, Clone, PartialEq, Eq)] |
@@ -194,9 +171,9 @@ pub enum StructKind { | |||
194 | 171 | ||
195 | impl StructKind { | 172 | impl StructKind { |
196 | fn from_node<N: AstNode>(node: &N) -> StructKind { | 173 | fn from_node<N: AstNode>(node: &N) -> StructKind { |
197 | if let Some(nfdl) = child_opt::<_, ast::RecordFieldDefList>(node) { | 174 | if let Some(nfdl) = support::child::<ast::RecordFieldDefList>(node.syntax()) { |
198 | StructKind::Record(nfdl) | 175 | StructKind::Record(nfdl) |
199 | } else if let Some(pfl) = child_opt::<_, ast::TupleFieldDefList>(node) { | 176 | } else if let Some(pfl) = support::child::<ast::TupleFieldDefList>(node.syntax()) { |
200 | StructKind::Tuple(pfl) | 177 | StructKind::Tuple(pfl) |
201 | } else { | 178 | } else { |
202 | StructKind::Unit | 179 | StructKind::Unit |
@@ -210,6 +187,36 @@ impl ast::StructDef { | |||
210 | } | 187 | } |
211 | } | 188 | } |
212 | 189 | ||
190 | impl ast::RecordField { | ||
191 | pub fn for_field_name(field_name: &ast::NameRef) -> Option<ast::RecordField> { | ||
192 | let candidate = | ||
193 | field_name.syntax().parent().and_then(ast::RecordField::cast).or_else(|| { | ||
194 | field_name.syntax().ancestors().nth(4).and_then(ast::RecordField::cast) | ||
195 | })?; | ||
196 | if candidate.field_name().as_ref() == Some(field_name) { | ||
197 | Some(candidate) | ||
198 | } else { | ||
199 | None | ||
200 | } | ||
201 | } | ||
202 | |||
203 | /// Deals with field init shorthand | ||
204 | pub fn field_name(&self) -> Option<ast::NameRef> { | ||
205 | if let Some(name_ref) = self.name_ref() { | ||
206 | return Some(name_ref); | ||
207 | } | ||
208 | if let Some(ast::Expr::PathExpr(expr)) = self.expr() { | ||
209 | let path = expr.path()?; | ||
210 | let segment = path.segment()?; | ||
211 | let name_ref = segment.name_ref()?; | ||
212 | if path.qualifier().is_none() { | ||
213 | return Some(name_ref); | ||
214 | } | ||
215 | } | ||
216 | None | ||
217 | } | ||
218 | } | ||
219 | |||
213 | impl ast::EnumVariant { | 220 | impl ast::EnumVariant { |
214 | pub fn parent_enum(&self) -> ast::EnumDef { | 221 | pub fn parent_enum(&self) -> ast::EnumDef { |
215 | self.syntax() | 222 | self.syntax() |
@@ -223,41 +230,6 @@ impl ast::EnumVariant { | |||
223 | } | 230 | } |
224 | } | 231 | } |
225 | 232 | ||
226 | impl ast::FnDef { | ||
227 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { | ||
228 | self.syntax() | ||
229 | .last_child_or_token() | ||
230 | .and_then(|it| it.into_token()) | ||
231 | .filter(|it| it.kind() == T![;]) | ||
232 | } | ||
233 | |||
234 | pub fn is_async(&self) -> bool { | ||
235 | self.syntax().children_with_tokens().any(|it| it.kind() == T![async]) | ||
236 | } | ||
237 | } | ||
238 | |||
239 | impl ast::LetStmt { | ||
240 | pub fn has_semi(&self) -> bool { | ||
241 | match self.syntax().last_child_or_token() { | ||
242 | None => false, | ||
243 | Some(node) => node.kind() == T![;], | ||
244 | } | ||
245 | } | ||
246 | |||
247 | pub fn eq_token(&self) -> Option<SyntaxToken> { | ||
248 | self.syntax().children_with_tokens().find(|t| t.kind() == EQ).and_then(|it| it.into_token()) | ||
249 | } | ||
250 | } | ||
251 | |||
252 | impl ast::ExprStmt { | ||
253 | pub fn has_semi(&self) -> bool { | ||
254 | match self.syntax().last_child_or_token() { | ||
255 | None => false, | ||
256 | Some(node) => node.kind() == T![;], | ||
257 | } | ||
258 | } | ||
259 | } | ||
260 | |||
261 | #[derive(Debug, Clone, PartialEq, Eq)] | 233 | #[derive(Debug, Clone, PartialEq, Eq)] |
262 | pub enum FieldKind { | 234 | pub enum FieldKind { |
263 | Name(ast::NameRef), | 235 | Name(ast::NameRef), |
@@ -286,25 +258,6 @@ impl ast::FieldExpr { | |||
286 | } | 258 | } |
287 | } | 259 | } |
288 | 260 | ||
289 | impl ast::RefPat { | ||
290 | pub fn is_mut(&self) -> bool { | ||
291 | self.syntax().children_with_tokens().any(|n| n.kind() == T![mut]) | ||
292 | } | ||
293 | } | ||
294 | |||
295 | impl ast::BindPat { | ||
296 | pub fn is_mutable(&self) -> bool { | ||
297 | self.syntax().children_with_tokens().any(|n| n.kind() == T![mut]) | ||
298 | } | ||
299 | |||
300 | pub fn is_ref(&self) -> bool { | ||
301 | self.syntax().children_with_tokens().any(|n| n.kind() == T![ref]) | ||
302 | } | ||
303 | pub fn has_at(&self) -> bool { | ||
304 | self.syntax().children_with_tokens().any(|it| it.kind() == T![@]) | ||
305 | } | ||
306 | } | ||
307 | |||
308 | pub struct SlicePatComponents { | 261 | pub struct SlicePatComponents { |
309 | pub prefix: Vec<ast::Pat>, | 262 | pub prefix: Vec<ast::Pat>, |
310 | pub slice: Option<ast::Pat>, | 263 | pub slice: Option<ast::Pat>, |
@@ -339,18 +292,6 @@ impl ast::SlicePat { | |||
339 | } | 292 | } |
340 | } | 293 | } |
341 | 294 | ||
342 | impl ast::PointerType { | ||
343 | pub fn is_mut(&self) -> bool { | ||
344 | self.syntax().children_with_tokens().any(|n| n.kind() == T![mut]) | ||
345 | } | ||
346 | } | ||
347 | |||
348 | impl ast::ReferenceType { | ||
349 | pub fn is_mut(&self) -> bool { | ||
350 | self.syntax().children_with_tokens().any(|n| n.kind() == T![mut]) | ||
351 | } | ||
352 | } | ||
353 | |||
354 | #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] | 295 | #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] |
355 | pub enum SelfParamKind { | 296 | pub enum SelfParamKind { |
356 | /// self | 297 | /// self |
@@ -363,8 +304,8 @@ pub enum SelfParamKind { | |||
363 | 304 | ||
364 | impl ast::SelfParam { | 305 | impl ast::SelfParam { |
365 | pub fn kind(&self) -> SelfParamKind { | 306 | pub fn kind(&self) -> SelfParamKind { |
366 | if self.amp().is_some() { | 307 | if self.amp_token().is_some() { |
367 | if self.amp_mut_kw().is_some() { | 308 | if self.mut_token().is_some() { |
368 | SelfParamKind::MutRef | 309 | SelfParamKind::MutRef |
369 | } else { | 310 | } else { |
370 | SelfParamKind::Ref | 311 | SelfParamKind::Ref |
@@ -373,24 +314,6 @@ impl ast::SelfParam { | |||
373 | SelfParamKind::Owned | 314 | SelfParamKind::Owned |
374 | } | 315 | } |
375 | } | 316 | } |
376 | |||
377 | /// the "mut" in "mut self", not the one in "&mut self" | ||
378 | pub fn mut_kw(&self) -> Option<ast::MutKw> { | ||
379 | self.syntax() | ||
380 | .children_with_tokens() | ||
381 | .filter_map(|it| it.into_token()) | ||
382 | .take_while(|it| it.kind() != T![&]) | ||
383 | .find_map(ast::MutKw::cast) | ||
384 | } | ||
385 | |||
386 | /// the "mut" in "&mut self", not the one in "mut self" | ||
387 | pub fn amp_mut_kw(&self) -> Option<ast::MutKw> { | ||
388 | self.syntax() | ||
389 | .children_with_tokens() | ||
390 | .filter_map(|it| it.into_token()) | ||
391 | .skip_while(|it| it.kind() != T![&]) | ||
392 | .find_map(ast::MutKw::cast) | ||
393 | } | ||
394 | } | 317 | } |
395 | 318 | ||
396 | #[derive(Clone, Debug, PartialEq, Eq, Hash)] | 319 | #[derive(Clone, Debug, PartialEq, Eq, Hash)] |
@@ -400,53 +323,43 @@ pub enum TypeBoundKind { | |||
400 | /// for<'a> ... | 323 | /// for<'a> ... |
401 | ForType(ast::ForType), | 324 | ForType(ast::ForType), |
402 | /// 'a | 325 | /// 'a |
403 | Lifetime(ast::Lifetime), | 326 | Lifetime(SyntaxToken), |
404 | } | 327 | } |
405 | 328 | ||
406 | impl ast::TypeBound { | 329 | impl ast::TypeBound { |
407 | pub fn kind(&self) -> TypeBoundKind { | 330 | pub fn kind(&self) -> TypeBoundKind { |
408 | if let Some(path_type) = children(self).next() { | 331 | if let Some(path_type) = support::children(self.syntax()).next() { |
409 | TypeBoundKind::PathType(path_type) | 332 | TypeBoundKind::PathType(path_type) |
410 | } else if let Some(for_type) = children(self).next() { | 333 | } else if let Some(for_type) = support::children(self.syntax()).next() { |
411 | TypeBoundKind::ForType(for_type) | 334 | TypeBoundKind::ForType(for_type) |
412 | } else if let Some(lifetime) = self.lifetime() { | 335 | } else if let Some(lifetime) = self.lifetime_token() { |
413 | TypeBoundKind::Lifetime(lifetime) | 336 | TypeBoundKind::Lifetime(lifetime) |
414 | } else { | 337 | } else { |
415 | unreachable!() | 338 | unreachable!() |
416 | } | 339 | } |
417 | } | 340 | } |
418 | 341 | ||
419 | pub fn has_question_mark(&self) -> bool { | 342 | pub fn const_question_token(&self) -> Option<SyntaxToken> { |
420 | self.question().is_some() | ||
421 | } | ||
422 | |||
423 | pub fn const_question(&self) -> Option<ast::Question> { | ||
424 | self.syntax() | 343 | self.syntax() |
425 | .children_with_tokens() | 344 | .children_with_tokens() |
426 | .filter_map(|it| it.into_token()) | 345 | .filter_map(|it| it.into_token()) |
427 | .take_while(|it| it.kind() != T![const]) | 346 | .take_while(|it| it.kind() != T![const]) |
428 | .find_map(ast::Question::cast) | 347 | .find(|it| it.kind() == T![?]) |
429 | } | 348 | } |
430 | 349 | ||
431 | pub fn question(&self) -> Option<ast::Question> { | 350 | pub fn question_token(&self) -> Option<SyntaxToken> { |
432 | if self.const_kw().is_some() { | 351 | if self.const_token().is_some() { |
433 | self.syntax() | 352 | self.syntax() |
434 | .children_with_tokens() | 353 | .children_with_tokens() |
435 | .filter_map(|it| it.into_token()) | 354 | .filter_map(|it| it.into_token()) |
436 | .skip_while(|it| it.kind() != T![const]) | 355 | .skip_while(|it| it.kind() != T![const]) |
437 | .find_map(ast::Question::cast) | 356 | .find(|it| it.kind() == T![?]) |
438 | } else { | 357 | } else { |
439 | support::token(&self.syntax) | 358 | support::token(&self.syntax, T![?]) |
440 | } | 359 | } |
441 | } | 360 | } |
442 | } | 361 | } |
443 | 362 | ||
444 | impl ast::TraitDef { | ||
445 | pub fn is_auto(&self) -> bool { | ||
446 | self.syntax().children_with_tokens().any(|t| t.kind() == T![auto]) | ||
447 | } | ||
448 | } | ||
449 | |||
450 | pub enum VisibilityKind { | 363 | pub enum VisibilityKind { |
451 | In(ast::Path), | 364 | In(ast::Path), |
452 | PubCrate, | 365 | PubCrate, |
@@ -457,30 +370,18 @@ pub enum VisibilityKind { | |||
457 | 370 | ||
458 | impl ast::Visibility { | 371 | impl ast::Visibility { |
459 | pub fn kind(&self) -> VisibilityKind { | 372 | pub fn kind(&self) -> VisibilityKind { |
460 | if let Some(path) = children(self).next() { | 373 | if let Some(path) = support::children(self.syntax()).next() { |
461 | VisibilityKind::In(path) | 374 | VisibilityKind::In(path) |
462 | } else if self.is_pub_crate() { | 375 | } else if self.crate_token().is_some() { |
463 | VisibilityKind::PubCrate | 376 | VisibilityKind::PubCrate |
464 | } else if self.is_pub_super() { | 377 | } else if self.super_token().is_some() { |
465 | VisibilityKind::PubSuper | 378 | VisibilityKind::PubSuper |
466 | } else if self.is_pub_self() { | 379 | } else if self.self_token().is_some() { |
467 | VisibilityKind::PubSuper | 380 | VisibilityKind::PubSuper |
468 | } else { | 381 | } else { |
469 | VisibilityKind::Pub | 382 | VisibilityKind::Pub |
470 | } | 383 | } |
471 | } | 384 | } |
472 | |||
473 | fn is_pub_crate(&self) -> bool { | ||
474 | self.syntax().children_with_tokens().any(|it| it.kind() == T![crate]) | ||
475 | } | ||
476 | |||
477 | fn is_pub_super(&self) -> bool { | ||
478 | self.syntax().children_with_tokens().any(|it| it.kind() == T![super]) | ||
479 | } | ||
480 | |||
481 | fn is_pub_self(&self) -> bool { | ||
482 | self.syntax().children_with_tokens().any(|it| it.kind() == T![self]) | ||
483 | } | ||
484 | } | 385 | } |
485 | 386 | ||
486 | impl ast::MacroCall { | 387 | impl ast::MacroCall { |
@@ -495,12 +396,12 @@ impl ast::MacroCall { | |||
495 | } | 396 | } |
496 | 397 | ||
497 | impl ast::LifetimeParam { | 398 | impl ast::LifetimeParam { |
498 | pub fn lifetime_bounds(&self) -> impl Iterator<Item = ast::Lifetime> { | 399 | pub fn lifetime_bounds(&self) -> impl Iterator<Item = SyntaxToken> { |
499 | self.syntax() | 400 | self.syntax() |
500 | .children_with_tokens() | 401 | .children_with_tokens() |
501 | .filter_map(|it| it.into_token()) | 402 | .filter_map(|it| it.into_token()) |
502 | .skip_while(|x| x.kind() != T![:]) | 403 | .skip_while(|x| x.kind() != T![:]) |
503 | .filter_map(ast::Lifetime::cast) | 404 | .filter(|it| it.kind() == T![lifetime]) |
504 | } | 405 | } |
505 | } | 406 | } |
506 | 407 | ||
@@ -508,7 +409,7 @@ impl ast::RangePat { | |||
508 | pub fn start(&self) -> Option<ast::Pat> { | 409 | pub fn start(&self) -> Option<ast::Pat> { |
509 | self.syntax() | 410 | self.syntax() |
510 | .children_with_tokens() | 411 | .children_with_tokens() |
511 | .take_while(|it| !ast::RangeSeparator::can_cast(it.kind())) | 412 | .take_while(|it| !(it.kind() == T![..] || it.kind() == T![..=])) |
512 | .filter_map(|it| it.into_node()) | 413 | .filter_map(|it| it.into_node()) |
513 | .find_map(ast::Pat::cast) | 414 | .find_map(ast::Pat::cast) |
514 | } | 415 | } |
@@ -516,18 +417,24 @@ impl ast::RangePat { | |||
516 | pub fn end(&self) -> Option<ast::Pat> { | 417 | pub fn end(&self) -> Option<ast::Pat> { |
517 | self.syntax() | 418 | self.syntax() |
518 | .children_with_tokens() | 419 | .children_with_tokens() |
519 | .skip_while(|it| !ast::RangeSeparator::can_cast(it.kind())) | 420 | .skip_while(|it| !(it.kind() == T![..] || it.kind() == T![..=])) |
520 | .filter_map(|it| it.into_node()) | 421 | .filter_map(|it| it.into_node()) |
521 | .find_map(ast::Pat::cast) | 422 | .find_map(ast::Pat::cast) |
522 | } | 423 | } |
523 | } | 424 | } |
524 | 425 | ||
525 | impl ast::TokenTree { | 426 | impl ast::TokenTree { |
526 | pub fn left_delimiter(&self) -> Option<ast::LeftDelimiter> { | 427 | pub fn left_delimiter_token(&self) -> Option<SyntaxToken> { |
527 | self.syntax().first_child_or_token()?.into_token().and_then(ast::LeftDelimiter::cast) | 428 | self.syntax().first_child_or_token()?.into_token().filter(|it| match it.kind() { |
429 | T!['{'] | T!['('] | T!['['] => true, | ||
430 | _ => false, | ||
431 | }) | ||
528 | } | 432 | } |
529 | 433 | ||
530 | pub fn right_delimiter(&self) -> Option<ast::RightDelimiter> { | 434 | pub fn right_delimiter_token(&self) -> Option<SyntaxToken> { |
531 | self.syntax().last_child_or_token()?.into_token().and_then(ast::RightDelimiter::cast) | 435 | self.syntax().last_child_or_token()?.into_token().filter(|it| match it.kind() { |
436 | T!['{'] | T!['('] | T!['['] => true, | ||
437 | _ => false, | ||
438 | }) | ||
532 | } | 439 | } |
533 | } | 440 | } |
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 8b348ad6e..f1098755b 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -1,11 +1,11 @@ | |||
1 | //! Generated file, do not edit by hand, see `xtask/src/codegen` | 1 | //! Generated file, do not edit by hand, see `xtask/src/codegen` |
2 | 2 | ||
3 | use super::tokens::*; | ||
4 | use crate::{ | 3 | use crate::{ |
5 | ast::{self, support, AstChildren, AstNode}, | 4 | ast::{self, support, AstChildren, AstNode}, |
6 | SyntaxKind::{self, *}, | 5 | SyntaxKind::{self, *}, |
7 | SyntaxNode, | 6 | SyntaxNode, SyntaxToken, T, |
8 | }; | 7 | }; |
8 | |||
9 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 9 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
10 | pub struct SourceFile { | 10 | pub struct SourceFile { |
11 | pub(crate) syntax: SyntaxNode, | 11 | pub(crate) syntax: SyntaxNode, |
@@ -22,11 +22,11 @@ impl AstNode for SourceFile { | |||
22 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 22 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
23 | } | 23 | } |
24 | impl ast::ModuleItemOwner for SourceFile {} | 24 | impl ast::ModuleItemOwner for SourceFile {} |
25 | impl ast::FnDefOwner for SourceFile {} | ||
26 | impl ast::AttrsOwner for SourceFile {} | 25 | impl ast::AttrsOwner for SourceFile {} |
27 | impl SourceFile { | 26 | impl SourceFile { |
28 | pub fn modules(&self) -> AstChildren<Module> { support::children(&self.syntax) } | 27 | pub fn modules(&self) -> AstChildren<Module> { support::children(&self.syntax) } |
29 | } | 28 | } |
29 | |||
30 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 30 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
31 | pub struct FnDef { | 31 | pub struct FnDef { |
32 | pub(crate) syntax: SyntaxNode, | 32 | pub(crate) syntax: SyntaxNode, |
@@ -49,16 +49,17 @@ impl ast::DocCommentsOwner for FnDef {} | |||
49 | impl ast::AttrsOwner for FnDef {} | 49 | impl ast::AttrsOwner for FnDef {} |
50 | impl FnDef { | 50 | impl FnDef { |
51 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } | 51 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } |
52 | pub fn const_kw(&self) -> Option<ConstKw> { support::token(&self.syntax) } | 52 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } |
53 | pub fn default_kw(&self) -> Option<DefaultKw> { support::token(&self.syntax) } | 53 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } |
54 | pub fn async_kw(&self) -> Option<AsyncKw> { support::token(&self.syntax) } | 54 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } |
55 | pub fn unsafe_kw(&self) -> Option<UnsafeKw> { support::token(&self.syntax) } | 55 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } |
56 | pub fn fn_kw(&self) -> Option<FnKw> { support::token(&self.syntax) } | 56 | pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) } |
57 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | 57 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } |
58 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | 58 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } |
59 | pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) } | 59 | pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) } |
60 | pub fn semi(&self) -> Option<Semi> { support::token(&self.syntax) } | 60 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
61 | } | 61 | } |
62 | |||
62 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 63 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
63 | pub struct RetType { | 64 | pub struct RetType { |
64 | pub(crate) syntax: SyntaxNode, | 65 | pub(crate) syntax: SyntaxNode, |
@@ -75,9 +76,10 @@ impl AstNode for RetType { | |||
75 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 76 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
76 | } | 77 | } |
77 | impl RetType { | 78 | impl RetType { |
78 | pub fn thin_arrow(&self) -> Option<ThinArrow> { support::token(&self.syntax) } | 79 | pub fn thin_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![->]) } |
79 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 80 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
80 | } | 81 | } |
82 | |||
81 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 83 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
82 | pub struct StructDef { | 84 | pub struct StructDef { |
83 | pub(crate) syntax: SyntaxNode, | 85 | pub(crate) syntax: SyntaxNode, |
@@ -99,10 +101,11 @@ impl ast::TypeParamsOwner for StructDef {} | |||
99 | impl ast::AttrsOwner for StructDef {} | 101 | impl ast::AttrsOwner for StructDef {} |
100 | impl ast::DocCommentsOwner for StructDef {} | 102 | impl ast::DocCommentsOwner for StructDef {} |
101 | impl StructDef { | 103 | impl StructDef { |
102 | pub fn struct_kw(&self) -> Option<StructKw> { support::token(&self.syntax) } | 104 | pub fn struct_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![struct]) } |
103 | pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } | 105 | pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } |
104 | pub fn semi(&self) -> Option<Semi> { support::token(&self.syntax) } | 106 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
105 | } | 107 | } |
108 | |||
106 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 109 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
107 | pub struct UnionDef { | 110 | pub struct UnionDef { |
108 | pub(crate) syntax: SyntaxNode, | 111 | pub(crate) syntax: SyntaxNode, |
@@ -124,11 +127,12 @@ impl ast::TypeParamsOwner for UnionDef {} | |||
124 | impl ast::AttrsOwner for UnionDef {} | 127 | impl ast::AttrsOwner for UnionDef {} |
125 | impl ast::DocCommentsOwner for UnionDef {} | 128 | impl ast::DocCommentsOwner for UnionDef {} |
126 | impl UnionDef { | 129 | impl UnionDef { |
127 | pub fn union_kw(&self) -> Option<UnionKw> { support::token(&self.syntax) } | 130 | pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) } |
128 | pub fn record_field_def_list(&self) -> Option<RecordFieldDefList> { | 131 | pub fn record_field_def_list(&self) -> Option<RecordFieldDefList> { |
129 | support::child(&self.syntax) | 132 | support::child(&self.syntax) |
130 | } | 133 | } |
131 | } | 134 | } |
135 | |||
132 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 136 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
133 | pub struct RecordFieldDefList { | 137 | pub struct RecordFieldDefList { |
134 | pub(crate) syntax: SyntaxNode, | 138 | pub(crate) syntax: SyntaxNode, |
@@ -145,10 +149,11 @@ impl AstNode for RecordFieldDefList { | |||
145 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 149 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
146 | } | 150 | } |
147 | impl RecordFieldDefList { | 151 | impl RecordFieldDefList { |
148 | pub fn l_curly(&self) -> Option<LCurly> { support::token(&self.syntax) } | 152 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
149 | pub fn fields(&self) -> AstChildren<RecordFieldDef> { support::children(&self.syntax) } | 153 | pub fn fields(&self) -> AstChildren<RecordFieldDef> { support::children(&self.syntax) } |
150 | pub fn r_curly(&self) -> Option<RCurly> { support::token(&self.syntax) } | 154 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
151 | } | 155 | } |
156 | |||
152 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 157 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
153 | pub struct RecordFieldDef { | 158 | pub struct RecordFieldDef { |
154 | pub(crate) syntax: SyntaxNode, | 159 | pub(crate) syntax: SyntaxNode, |
@@ -170,6 +175,7 @@ impl ast::AttrsOwner for RecordFieldDef {} | |||
170 | impl ast::DocCommentsOwner for RecordFieldDef {} | 175 | impl ast::DocCommentsOwner for RecordFieldDef {} |
171 | impl ast::TypeAscriptionOwner for RecordFieldDef {} | 176 | impl ast::TypeAscriptionOwner for RecordFieldDef {} |
172 | impl RecordFieldDef {} | 177 | impl RecordFieldDef {} |
178 | |||
173 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 179 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
174 | pub struct TupleFieldDefList { | 180 | pub struct TupleFieldDefList { |
175 | pub(crate) syntax: SyntaxNode, | 181 | pub(crate) syntax: SyntaxNode, |
@@ -186,10 +192,11 @@ impl AstNode for TupleFieldDefList { | |||
186 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 192 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
187 | } | 193 | } |
188 | impl TupleFieldDefList { | 194 | impl TupleFieldDefList { |
189 | pub fn l_paren(&self) -> Option<LParen> { support::token(&self.syntax) } | 195 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
190 | pub fn fields(&self) -> AstChildren<TupleFieldDef> { support::children(&self.syntax) } | 196 | pub fn fields(&self) -> AstChildren<TupleFieldDef> { support::children(&self.syntax) } |
191 | pub fn r_paren(&self) -> Option<RParen> { support::token(&self.syntax) } | 197 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
192 | } | 198 | } |
199 | |||
193 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 200 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
194 | pub struct TupleFieldDef { | 201 | pub struct TupleFieldDef { |
195 | pub(crate) syntax: SyntaxNode, | 202 | pub(crate) syntax: SyntaxNode, |
@@ -210,6 +217,7 @@ impl ast::AttrsOwner for TupleFieldDef {} | |||
210 | impl TupleFieldDef { | 217 | impl TupleFieldDef { |
211 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 218 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
212 | } | 219 | } |
220 | |||
213 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 221 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
214 | pub struct EnumDef { | 222 | pub struct EnumDef { |
215 | pub(crate) syntax: SyntaxNode, | 223 | pub(crate) syntax: SyntaxNode, |
@@ -231,9 +239,10 @@ impl ast::TypeParamsOwner for EnumDef {} | |||
231 | impl ast::AttrsOwner for EnumDef {} | 239 | impl ast::AttrsOwner for EnumDef {} |
232 | impl ast::DocCommentsOwner for EnumDef {} | 240 | impl ast::DocCommentsOwner for EnumDef {} |
233 | impl EnumDef { | 241 | impl EnumDef { |
234 | pub fn enum_kw(&self) -> Option<EnumKw> { support::token(&self.syntax) } | 242 | pub fn enum_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![enum]) } |
235 | pub fn variant_list(&self) -> Option<EnumVariantList> { support::child(&self.syntax) } | 243 | pub fn variant_list(&self) -> Option<EnumVariantList> { support::child(&self.syntax) } |
236 | } | 244 | } |
245 | |||
237 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 246 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
238 | pub struct EnumVariantList { | 247 | pub struct EnumVariantList { |
239 | pub(crate) syntax: SyntaxNode, | 248 | pub(crate) syntax: SyntaxNode, |
@@ -250,10 +259,11 @@ impl AstNode for EnumVariantList { | |||
250 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 259 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
251 | } | 260 | } |
252 | impl EnumVariantList { | 261 | impl EnumVariantList { |
253 | pub fn l_curly(&self) -> Option<LCurly> { support::token(&self.syntax) } | 262 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
254 | pub fn variants(&self) -> AstChildren<EnumVariant> { support::children(&self.syntax) } | 263 | pub fn variants(&self) -> AstChildren<EnumVariant> { support::children(&self.syntax) } |
255 | pub fn r_curly(&self) -> Option<RCurly> { support::token(&self.syntax) } | 264 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
256 | } | 265 | } |
266 | |||
257 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 267 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
258 | pub struct EnumVariant { | 268 | pub struct EnumVariant { |
259 | pub(crate) syntax: SyntaxNode, | 269 | pub(crate) syntax: SyntaxNode, |
@@ -275,9 +285,10 @@ impl ast::DocCommentsOwner for EnumVariant {} | |||
275 | impl ast::AttrsOwner for EnumVariant {} | 285 | impl ast::AttrsOwner for EnumVariant {} |
276 | impl EnumVariant { | 286 | impl EnumVariant { |
277 | pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } | 287 | pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } |
278 | pub fn eq(&self) -> Option<Eq> { support::token(&self.syntax) } | 288 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
279 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 289 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
280 | } | 290 | } |
291 | |||
281 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 292 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
282 | pub struct TraitDef { | 293 | pub struct TraitDef { |
283 | pub(crate) syntax: SyntaxNode, | 294 | pub(crate) syntax: SyntaxNode, |
@@ -300,11 +311,12 @@ impl ast::DocCommentsOwner for TraitDef {} | |||
300 | impl ast::TypeParamsOwner for TraitDef {} | 311 | impl ast::TypeParamsOwner for TraitDef {} |
301 | impl ast::TypeBoundsOwner for TraitDef {} | 312 | impl ast::TypeBoundsOwner for TraitDef {} |
302 | impl TraitDef { | 313 | impl TraitDef { |
303 | pub fn unsafe_kw(&self) -> Option<UnsafeKw> { support::token(&self.syntax) } | 314 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } |
304 | pub fn auto_kw(&self) -> Option<AutoKw> { support::token(&self.syntax) } | 315 | pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) } |
305 | pub fn trait_kw(&self) -> Option<TraitKw> { support::token(&self.syntax) } | 316 | pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) } |
306 | pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } | 317 | pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } |
307 | } | 318 | } |
319 | |||
308 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 320 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
309 | pub struct Module { | 321 | pub struct Module { |
310 | pub(crate) syntax: SyntaxNode, | 322 | pub(crate) syntax: SyntaxNode, |
@@ -325,10 +337,11 @@ impl ast::NameOwner for Module {} | |||
325 | impl ast::AttrsOwner for Module {} | 337 | impl ast::AttrsOwner for Module {} |
326 | impl ast::DocCommentsOwner for Module {} | 338 | impl ast::DocCommentsOwner for Module {} |
327 | impl Module { | 339 | impl Module { |
328 | pub fn mod_kw(&self) -> Option<ModKw> { support::token(&self.syntax) } | 340 | pub fn mod_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mod]) } |
329 | pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } | 341 | pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } |
330 | pub fn semi(&self) -> Option<Semi> { support::token(&self.syntax) } | 342 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
331 | } | 343 | } |
344 | |||
332 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 345 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
333 | pub struct ItemList { | 346 | pub struct ItemList { |
334 | pub(crate) syntax: SyntaxNode, | 347 | pub(crate) syntax: SyntaxNode, |
@@ -344,13 +357,13 @@ impl AstNode for ItemList { | |||
344 | } | 357 | } |
345 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 358 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
346 | } | 359 | } |
347 | impl ast::FnDefOwner for ItemList {} | ||
348 | impl ast::ModuleItemOwner for ItemList {} | 360 | impl ast::ModuleItemOwner for ItemList {} |
349 | impl ItemList { | 361 | impl ItemList { |
350 | pub fn l_curly(&self) -> Option<LCurly> { support::token(&self.syntax) } | 362 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
351 | pub fn impl_items(&self) -> AstChildren<ImplItem> { support::children(&self.syntax) } | 363 | pub fn impl_items(&self) -> AstChildren<ImplItem> { support::children(&self.syntax) } |
352 | pub fn r_curly(&self) -> Option<RCurly> { support::token(&self.syntax) } | 364 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
353 | } | 365 | } |
366 | |||
354 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 367 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
355 | pub struct ConstDef { | 368 | pub struct ConstDef { |
356 | pub(crate) syntax: SyntaxNode, | 369 | pub(crate) syntax: SyntaxNode, |
@@ -373,12 +386,13 @@ impl ast::AttrsOwner for ConstDef {} | |||
373 | impl ast::DocCommentsOwner for ConstDef {} | 386 | impl ast::DocCommentsOwner for ConstDef {} |
374 | impl ast::TypeAscriptionOwner for ConstDef {} | 387 | impl ast::TypeAscriptionOwner for ConstDef {} |
375 | impl ConstDef { | 388 | impl ConstDef { |
376 | pub fn default_kw(&self) -> Option<DefaultKw> { support::token(&self.syntax) } | 389 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } |
377 | pub fn const_kw(&self) -> Option<ConstKw> { support::token(&self.syntax) } | 390 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } |
378 | pub fn eq(&self) -> Option<Eq> { support::token(&self.syntax) } | 391 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
379 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | 392 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } |
380 | pub fn semi(&self) -> Option<Semi> { support::token(&self.syntax) } | 393 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
381 | } | 394 | } |
395 | |||
382 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 396 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
383 | pub struct StaticDef { | 397 | pub struct StaticDef { |
384 | pub(crate) syntax: SyntaxNode, | 398 | pub(crate) syntax: SyntaxNode, |
@@ -401,12 +415,13 @@ impl ast::AttrsOwner for StaticDef {} | |||
401 | impl ast::DocCommentsOwner for StaticDef {} | 415 | impl ast::DocCommentsOwner for StaticDef {} |
402 | impl ast::TypeAscriptionOwner for StaticDef {} | 416 | impl ast::TypeAscriptionOwner for StaticDef {} |
403 | impl StaticDef { | 417 | impl StaticDef { |
404 | pub fn static_kw(&self) -> Option<StaticKw> { support::token(&self.syntax) } | 418 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } |
405 | pub fn mut_kw(&self) -> Option<MutKw> { support::token(&self.syntax) } | 419 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
406 | pub fn eq(&self) -> Option<Eq> { support::token(&self.syntax) } | 420 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
407 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | 421 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } |
408 | pub fn semi(&self) -> Option<Semi> { support::token(&self.syntax) } | 422 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
409 | } | 423 | } |
424 | |||
410 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 425 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
411 | pub struct TypeAliasDef { | 426 | pub struct TypeAliasDef { |
412 | pub(crate) syntax: SyntaxNode, | 427 | pub(crate) syntax: SyntaxNode, |
@@ -429,12 +444,13 @@ impl ast::AttrsOwner for TypeAliasDef {} | |||
429 | impl ast::DocCommentsOwner for TypeAliasDef {} | 444 | impl ast::DocCommentsOwner for TypeAliasDef {} |
430 | impl ast::TypeBoundsOwner for TypeAliasDef {} | 445 | impl ast::TypeBoundsOwner for TypeAliasDef {} |
431 | impl TypeAliasDef { | 446 | impl TypeAliasDef { |
432 | pub fn default_kw(&self) -> Option<DefaultKw> { support::token(&self.syntax) } | 447 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } |
433 | pub fn type_kw(&self) -> Option<TypeKw> { support::token(&self.syntax) } | 448 | pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) } |
434 | pub fn eq(&self) -> Option<Eq> { support::token(&self.syntax) } | 449 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
435 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 450 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
436 | pub fn semi(&self) -> Option<Semi> { support::token(&self.syntax) } | 451 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
437 | } | 452 | } |
453 | |||
438 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 454 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
439 | pub struct ImplDef { | 455 | pub struct ImplDef { |
440 | pub(crate) syntax: SyntaxNode, | 456 | pub(crate) syntax: SyntaxNode, |
@@ -453,14 +469,15 @@ impl AstNode for ImplDef { | |||
453 | impl ast::TypeParamsOwner for ImplDef {} | 469 | impl ast::TypeParamsOwner for ImplDef {} |
454 | impl ast::AttrsOwner for ImplDef {} | 470 | impl ast::AttrsOwner for ImplDef {} |
455 | impl ImplDef { | 471 | impl ImplDef { |
456 | pub fn default_kw(&self) -> Option<DefaultKw> { support::token(&self.syntax) } | 472 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } |
457 | pub fn const_kw(&self) -> Option<ConstKw> { support::token(&self.syntax) } | 473 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } |
458 | pub fn unsafe_kw(&self) -> Option<UnsafeKw> { support::token(&self.syntax) } | 474 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } |
459 | pub fn impl_kw(&self) -> Option<ImplKw> { support::token(&self.syntax) } | 475 | pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } |
460 | pub fn excl(&self) -> Option<Excl> { support::token(&self.syntax) } | 476 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } |
461 | pub fn for_kw(&self) -> Option<ForKw> { support::token(&self.syntax) } | 477 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } |
462 | pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } | 478 | pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } |
463 | } | 479 | } |
480 | |||
464 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 481 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
465 | pub struct ParenType { | 482 | pub struct ParenType { |
466 | pub(crate) syntax: SyntaxNode, | 483 | pub(crate) syntax: SyntaxNode, |
@@ -477,10 +494,11 @@ impl AstNode for ParenType { | |||
477 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 494 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
478 | } | 495 | } |
479 | impl ParenType { | 496 | impl ParenType { |
480 | pub fn l_paren(&self) -> Option<LParen> { support::token(&self.syntax) } | 497 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
481 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 498 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
482 | pub fn r_paren(&self) -> Option<RParen> { support::token(&self.syntax) } | 499 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
483 | } | 500 | } |
501 | |||
484 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 502 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
485 | pub struct TupleType { | 503 | pub struct TupleType { |
486 | pub(crate) syntax: SyntaxNode, | 504 | pub(crate) syntax: SyntaxNode, |
@@ -497,10 +515,11 @@ impl AstNode for TupleType { | |||
497 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 515 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
498 | } | 516 | } |
499 | impl TupleType { | 517 | impl TupleType { |
500 | pub fn l_paren(&self) -> Option<LParen> { support::token(&self.syntax) } | 518 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
501 | pub fn fields(&self) -> AstChildren<TypeRef> { support::children(&self.syntax) } | 519 | pub fn fields(&self) -> AstChildren<TypeRef> { support::children(&self.syntax) } |
502 | pub fn r_paren(&self) -> Option<RParen> { support::token(&self.syntax) } | 520 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
503 | } | 521 | } |
522 | |||
504 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 523 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
505 | pub struct NeverType { | 524 | pub struct NeverType { |
506 | pub(crate) syntax: SyntaxNode, | 525 | pub(crate) syntax: SyntaxNode, |
@@ -517,8 +536,9 @@ impl AstNode for NeverType { | |||
517 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 536 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
518 | } | 537 | } |
519 | impl NeverType { | 538 | impl NeverType { |
520 | pub fn excl(&self) -> Option<Excl> { support::token(&self.syntax) } | 539 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } |
521 | } | 540 | } |
541 | |||
522 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 542 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
523 | pub struct PathType { | 543 | pub struct PathType { |
524 | pub(crate) syntax: SyntaxNode, | 544 | pub(crate) syntax: SyntaxNode, |
@@ -537,6 +557,7 @@ impl AstNode for PathType { | |||
537 | impl PathType { | 557 | impl PathType { |
538 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 558 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
539 | } | 559 | } |
560 | |||
540 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 561 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
541 | pub struct PointerType { | 562 | pub struct PointerType { |
542 | pub(crate) syntax: SyntaxNode, | 563 | pub(crate) syntax: SyntaxNode, |
@@ -553,10 +574,12 @@ impl AstNode for PointerType { | |||
553 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 574 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
554 | } | 575 | } |
555 | impl PointerType { | 576 | impl PointerType { |
556 | pub fn star(&self) -> Option<Star> { support::token(&self.syntax) } | 577 | pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } |
557 | pub fn const_kw(&self) -> Option<ConstKw> { support::token(&self.syntax) } | 578 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } |
579 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
558 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 580 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
559 | } | 581 | } |
582 | |||
560 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 583 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
561 | pub struct ArrayType { | 584 | pub struct ArrayType { |
562 | pub(crate) syntax: SyntaxNode, | 585 | pub(crate) syntax: SyntaxNode, |
@@ -573,12 +596,13 @@ impl AstNode for ArrayType { | |||
573 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 596 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
574 | } | 597 | } |
575 | impl ArrayType { | 598 | impl ArrayType { |
576 | pub fn l_brack(&self) -> Option<LBrack> { support::token(&self.syntax) } | 599 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
577 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 600 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
578 | pub fn semi(&self) -> Option<Semi> { support::token(&self.syntax) } | 601 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
579 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 602 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
580 | pub fn r_brack(&self) -> Option<RBrack> { support::token(&self.syntax) } | 603 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
581 | } | 604 | } |
605 | |||
582 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 606 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
583 | pub struct SliceType { | 607 | pub struct SliceType { |
584 | pub(crate) syntax: SyntaxNode, | 608 | pub(crate) syntax: SyntaxNode, |
@@ -595,10 +619,11 @@ impl AstNode for SliceType { | |||
595 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 619 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
596 | } | 620 | } |
597 | impl SliceType { | 621 | impl SliceType { |
598 | pub fn l_brack(&self) -> Option<LBrack> { support::token(&self.syntax) } | 622 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
599 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 623 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
600 | pub fn r_brack(&self) -> Option<RBrack> { support::token(&self.syntax) } | 624 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
601 | } | 625 | } |
626 | |||
602 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 627 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
603 | pub struct ReferenceType { | 628 | pub struct ReferenceType { |
604 | pub(crate) syntax: SyntaxNode, | 629 | pub(crate) syntax: SyntaxNode, |
@@ -615,11 +640,14 @@ impl AstNode for ReferenceType { | |||
615 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 640 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
616 | } | 641 | } |
617 | impl ReferenceType { | 642 | impl ReferenceType { |
618 | pub fn amp(&self) -> Option<Amp> { support::token(&self.syntax) } | 643 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } |
619 | pub fn lifetime(&self) -> Option<Lifetime> { support::token(&self.syntax) } | 644 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
620 | pub fn mut_kw(&self) -> Option<MutKw> { support::token(&self.syntax) } | 645 | support::token(&self.syntax, T![lifetime]) |
646 | } | ||
647 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
621 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 648 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
622 | } | 649 | } |
650 | |||
623 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 651 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
624 | pub struct PlaceholderType { | 652 | pub struct PlaceholderType { |
625 | pub(crate) syntax: SyntaxNode, | 653 | pub(crate) syntax: SyntaxNode, |
@@ -636,8 +664,9 @@ impl AstNode for PlaceholderType { | |||
636 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 664 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
637 | } | 665 | } |
638 | impl PlaceholderType { | 666 | impl PlaceholderType { |
639 | pub fn underscore(&self) -> Option<Underscore> { support::token(&self.syntax) } | 667 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } |
640 | } | 668 | } |
669 | |||
641 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 670 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
642 | pub struct FnPointerType { | 671 | pub struct FnPointerType { |
643 | pub(crate) syntax: SyntaxNode, | 672 | pub(crate) syntax: SyntaxNode, |
@@ -655,11 +684,12 @@ impl AstNode for FnPointerType { | |||
655 | } | 684 | } |
656 | impl FnPointerType { | 685 | impl FnPointerType { |
657 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } | 686 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } |
658 | pub fn unsafe_kw(&self) -> Option<UnsafeKw> { support::token(&self.syntax) } | 687 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } |
659 | pub fn fn_kw(&self) -> Option<FnKw> { support::token(&self.syntax) } | 688 | pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) } |
660 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | 689 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } |
661 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | 690 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } |
662 | } | 691 | } |
692 | |||
663 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 693 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
664 | pub struct ForType { | 694 | pub struct ForType { |
665 | pub(crate) syntax: SyntaxNode, | 695 | pub(crate) syntax: SyntaxNode, |
@@ -676,10 +706,11 @@ impl AstNode for ForType { | |||
676 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 706 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
677 | } | 707 | } |
678 | impl ForType { | 708 | impl ForType { |
679 | pub fn for_kw(&self) -> Option<ForKw> { support::token(&self.syntax) } | 709 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } |
680 | pub fn type_param_list(&self) -> Option<TypeParamList> { support::child(&self.syntax) } | 710 | pub fn type_param_list(&self) -> Option<TypeParamList> { support::child(&self.syntax) } |
681 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 711 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
682 | } | 712 | } |
713 | |||
683 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 714 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
684 | pub struct ImplTraitType { | 715 | pub struct ImplTraitType { |
685 | pub(crate) syntax: SyntaxNode, | 716 | pub(crate) syntax: SyntaxNode, |
@@ -697,8 +728,9 @@ impl AstNode for ImplTraitType { | |||
697 | } | 728 | } |
698 | impl ast::TypeBoundsOwner for ImplTraitType {} | 729 | impl ast::TypeBoundsOwner for ImplTraitType {} |
699 | impl ImplTraitType { | 730 | impl ImplTraitType { |
700 | pub fn impl_kw(&self) -> Option<ImplKw> { support::token(&self.syntax) } | 731 | pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } |
701 | } | 732 | } |
733 | |||
702 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 734 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
703 | pub struct DynTraitType { | 735 | pub struct DynTraitType { |
704 | pub(crate) syntax: SyntaxNode, | 736 | pub(crate) syntax: SyntaxNode, |
@@ -716,8 +748,9 @@ impl AstNode for DynTraitType { | |||
716 | } | 748 | } |
717 | impl ast::TypeBoundsOwner for DynTraitType {} | 749 | impl ast::TypeBoundsOwner for DynTraitType {} |
718 | impl DynTraitType { | 750 | impl DynTraitType { |
719 | pub fn dyn_kw(&self) -> Option<DynKw> { support::token(&self.syntax) } | 751 | pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![dyn]) } |
720 | } | 752 | } |
753 | |||
721 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 754 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
722 | pub struct TupleExpr { | 755 | pub struct TupleExpr { |
723 | pub(crate) syntax: SyntaxNode, | 756 | pub(crate) syntax: SyntaxNode, |
@@ -735,10 +768,11 @@ impl AstNode for TupleExpr { | |||
735 | } | 768 | } |
736 | impl ast::AttrsOwner for TupleExpr {} | 769 | impl ast::AttrsOwner for TupleExpr {} |
737 | impl TupleExpr { | 770 | impl TupleExpr { |
738 | pub fn l_paren(&self) -> Option<LParen> { support::token(&self.syntax) } | 771 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
739 | pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } | 772 | pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } |
740 | pub fn r_paren(&self) -> Option<RParen> { support::token(&self.syntax) } | 773 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
741 | } | 774 | } |
775 | |||
742 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 776 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
743 | pub struct ArrayExpr { | 777 | pub struct ArrayExpr { |
744 | pub(crate) syntax: SyntaxNode, | 778 | pub(crate) syntax: SyntaxNode, |
@@ -756,11 +790,12 @@ impl AstNode for ArrayExpr { | |||
756 | } | 790 | } |
757 | impl ast::AttrsOwner for ArrayExpr {} | 791 | impl ast::AttrsOwner for ArrayExpr {} |
758 | impl ArrayExpr { | 792 | impl ArrayExpr { |
759 | pub fn l_brack(&self) -> Option<LBrack> { support::token(&self.syntax) } | 793 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
760 | pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } | 794 | pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } |
761 | pub fn semi(&self) -> Option<Semi> { support::token(&self.syntax) } | 795 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
762 | pub fn r_brack(&self) -> Option<RBrack> { support::token(&self.syntax) } | 796 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
763 | } | 797 | } |
798 | |||
764 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 799 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
765 | pub struct ParenExpr { | 800 | pub struct ParenExpr { |
766 | pub(crate) syntax: SyntaxNode, | 801 | pub(crate) syntax: SyntaxNode, |
@@ -778,10 +813,11 @@ impl AstNode for ParenExpr { | |||
778 | } | 813 | } |
779 | impl ast::AttrsOwner for ParenExpr {} | 814 | impl ast::AttrsOwner for ParenExpr {} |
780 | impl ParenExpr { | 815 | impl ParenExpr { |
781 | pub fn l_paren(&self) -> Option<LParen> { support::token(&self.syntax) } | 816 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
782 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 817 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
783 | pub fn r_paren(&self) -> Option<RParen> { support::token(&self.syntax) } | 818 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
784 | } | 819 | } |
820 | |||
785 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 821 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
786 | pub struct PathExpr { | 822 | pub struct PathExpr { |
787 | pub(crate) syntax: SyntaxNode, | 823 | pub(crate) syntax: SyntaxNode, |
@@ -800,6 +836,7 @@ impl AstNode for PathExpr { | |||
800 | impl PathExpr { | 836 | impl PathExpr { |
801 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 837 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
802 | } | 838 | } |
839 | |||
803 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 840 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
804 | pub struct LambdaExpr { | 841 | pub struct LambdaExpr { |
805 | pub(crate) syntax: SyntaxNode, | 842 | pub(crate) syntax: SyntaxNode, |
@@ -817,13 +854,14 @@ impl AstNode for LambdaExpr { | |||
817 | } | 854 | } |
818 | impl ast::AttrsOwner for LambdaExpr {} | 855 | impl ast::AttrsOwner for LambdaExpr {} |
819 | impl LambdaExpr { | 856 | impl LambdaExpr { |
820 | pub fn static_kw(&self) -> Option<StaticKw> { support::token(&self.syntax) } | 857 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } |
821 | pub fn async_kw(&self) -> Option<AsyncKw> { support::token(&self.syntax) } | 858 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } |
822 | pub fn move_kw(&self) -> Option<MoveKw> { support::token(&self.syntax) } | 859 | pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) } |
823 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | 860 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } |
824 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | 861 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } |
825 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | 862 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } |
826 | } | 863 | } |
864 | |||
827 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 865 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
828 | pub struct IfExpr { | 866 | pub struct IfExpr { |
829 | pub(crate) syntax: SyntaxNode, | 867 | pub(crate) syntax: SyntaxNode, |
@@ -841,9 +879,10 @@ impl AstNode for IfExpr { | |||
841 | } | 879 | } |
842 | impl ast::AttrsOwner for IfExpr {} | 880 | impl ast::AttrsOwner for IfExpr {} |
843 | impl IfExpr { | 881 | impl IfExpr { |
844 | pub fn if_kw(&self) -> Option<IfKw> { support::token(&self.syntax) } | 882 | pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } |
845 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } | 883 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } |
846 | } | 884 | } |
885 | |||
847 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 886 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
848 | pub struct LoopExpr { | 887 | pub struct LoopExpr { |
849 | pub(crate) syntax: SyntaxNode, | 888 | pub(crate) syntax: SyntaxNode, |
@@ -862,8 +901,9 @@ impl AstNode for LoopExpr { | |||
862 | impl ast::AttrsOwner for LoopExpr {} | 901 | impl ast::AttrsOwner for LoopExpr {} |
863 | impl ast::LoopBodyOwner for LoopExpr {} | 902 | impl ast::LoopBodyOwner for LoopExpr {} |
864 | impl LoopExpr { | 903 | impl LoopExpr { |
865 | pub fn loop_kw(&self) -> Option<LoopKw> { support::token(&self.syntax) } | 904 | pub fn loop_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![loop]) } |
866 | } | 905 | } |
906 | |||
867 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 907 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
868 | pub struct TryBlockExpr { | 908 | pub struct TryBlockExpr { |
869 | pub(crate) syntax: SyntaxNode, | 909 | pub(crate) syntax: SyntaxNode, |
@@ -881,9 +921,10 @@ impl AstNode for TryBlockExpr { | |||
881 | } | 921 | } |
882 | impl ast::AttrsOwner for TryBlockExpr {} | 922 | impl ast::AttrsOwner for TryBlockExpr {} |
883 | impl TryBlockExpr { | 923 | impl TryBlockExpr { |
884 | pub fn try_kw(&self) -> Option<TryKw> { support::token(&self.syntax) } | 924 | pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) } |
885 | pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) } | 925 | pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) } |
886 | } | 926 | } |
927 | |||
887 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 928 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
888 | pub struct ForExpr { | 929 | pub struct ForExpr { |
889 | pub(crate) syntax: SyntaxNode, | 930 | pub(crate) syntax: SyntaxNode, |
@@ -902,11 +943,12 @@ impl AstNode for ForExpr { | |||
902 | impl ast::AttrsOwner for ForExpr {} | 943 | impl ast::AttrsOwner for ForExpr {} |
903 | impl ast::LoopBodyOwner for ForExpr {} | 944 | impl ast::LoopBodyOwner for ForExpr {} |
904 | impl ForExpr { | 945 | impl ForExpr { |
905 | pub fn for_kw(&self) -> Option<ForKw> { support::token(&self.syntax) } | 946 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } |
906 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 947 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
907 | pub fn in_kw(&self) -> Option<InKw> { support::token(&self.syntax) } | 948 | pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) } |
908 | pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) } | 949 | pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) } |
909 | } | 950 | } |
951 | |||
910 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 952 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
911 | pub struct WhileExpr { | 953 | pub struct WhileExpr { |
912 | pub(crate) syntax: SyntaxNode, | 954 | pub(crate) syntax: SyntaxNode, |
@@ -925,9 +967,10 @@ impl AstNode for WhileExpr { | |||
925 | impl ast::AttrsOwner for WhileExpr {} | 967 | impl ast::AttrsOwner for WhileExpr {} |
926 | impl ast::LoopBodyOwner for WhileExpr {} | 968 | impl ast::LoopBodyOwner for WhileExpr {} |
927 | impl WhileExpr { | 969 | impl WhileExpr { |
928 | pub fn while_kw(&self) -> Option<WhileKw> { support::token(&self.syntax) } | 970 | pub fn while_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![while]) } |
929 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } | 971 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } |
930 | } | 972 | } |
973 | |||
931 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 974 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
932 | pub struct ContinueExpr { | 975 | pub struct ContinueExpr { |
933 | pub(crate) syntax: SyntaxNode, | 976 | pub(crate) syntax: SyntaxNode, |
@@ -945,9 +988,14 @@ impl AstNode for ContinueExpr { | |||
945 | } | 988 | } |
946 | impl ast::AttrsOwner for ContinueExpr {} | 989 | impl ast::AttrsOwner for ContinueExpr {} |
947 | impl ContinueExpr { | 990 | impl ContinueExpr { |
948 | pub fn continue_kw(&self) -> Option<ContinueKw> { support::token(&self.syntax) } | 991 | pub fn continue_token(&self) -> Option<SyntaxToken> { |
949 | pub fn lifetime(&self) -> Option<Lifetime> { support::token(&self.syntax) } | 992 | support::token(&self.syntax, T![continue]) |
993 | } | ||
994 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
995 | support::token(&self.syntax, T![lifetime]) | ||
996 | } | ||
950 | } | 997 | } |
998 | |||
951 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 999 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
952 | pub struct BreakExpr { | 1000 | pub struct BreakExpr { |
953 | pub(crate) syntax: SyntaxNode, | 1001 | pub(crate) syntax: SyntaxNode, |
@@ -965,10 +1013,13 @@ impl AstNode for BreakExpr { | |||
965 | } | 1013 | } |
966 | impl ast::AttrsOwner for BreakExpr {} | 1014 | impl ast::AttrsOwner for BreakExpr {} |
967 | impl BreakExpr { | 1015 | impl BreakExpr { |
968 | pub fn break_kw(&self) -> Option<BreakKw> { support::token(&self.syntax) } | 1016 | pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) } |
969 | pub fn lifetime(&self) -> Option<Lifetime> { support::token(&self.syntax) } | 1017 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
1018 | support::token(&self.syntax, T![lifetime]) | ||
1019 | } | ||
970 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1020 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
971 | } | 1021 | } |
1022 | |||
972 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1023 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
973 | pub struct Label { | 1024 | pub struct Label { |
974 | pub(crate) syntax: SyntaxNode, | 1025 | pub(crate) syntax: SyntaxNode, |
@@ -985,8 +1036,11 @@ impl AstNode for Label { | |||
985 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1036 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
986 | } | 1037 | } |
987 | impl Label { | 1038 | impl Label { |
988 | pub fn lifetime(&self) -> Option<Lifetime> { support::token(&self.syntax) } | 1039 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
1040 | support::token(&self.syntax, T![lifetime]) | ||
1041 | } | ||
989 | } | 1042 | } |
1043 | |||
990 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1044 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
991 | pub struct BlockExpr { | 1045 | pub struct BlockExpr { |
992 | pub(crate) syntax: SyntaxNode, | 1046 | pub(crate) syntax: SyntaxNode, |
@@ -1005,9 +1059,10 @@ impl AstNode for BlockExpr { | |||
1005 | impl ast::AttrsOwner for BlockExpr {} | 1059 | impl ast::AttrsOwner for BlockExpr {} |
1006 | impl BlockExpr { | 1060 | impl BlockExpr { |
1007 | pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } | 1061 | pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } |
1008 | pub fn unsafe_kw(&self) -> Option<UnsafeKw> { support::token(&self.syntax) } | 1062 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } |
1009 | pub fn block(&self) -> Option<Block> { support::child(&self.syntax) } | 1063 | pub fn block(&self) -> Option<Block> { support::child(&self.syntax) } |
1010 | } | 1064 | } |
1065 | |||
1011 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1066 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1012 | pub struct ReturnExpr { | 1067 | pub struct ReturnExpr { |
1013 | pub(crate) syntax: SyntaxNode, | 1068 | pub(crate) syntax: SyntaxNode, |
@@ -1027,6 +1082,7 @@ impl ast::AttrsOwner for ReturnExpr {} | |||
1027 | impl ReturnExpr { | 1082 | impl ReturnExpr { |
1028 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1083 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1029 | } | 1084 | } |
1085 | |||
1030 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1086 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1031 | pub struct CallExpr { | 1087 | pub struct CallExpr { |
1032 | pub(crate) syntax: SyntaxNode, | 1088 | pub(crate) syntax: SyntaxNode, |
@@ -1046,6 +1102,7 @@ impl ast::ArgListOwner for CallExpr {} | |||
1046 | impl CallExpr { | 1102 | impl CallExpr { |
1047 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1103 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1048 | } | 1104 | } |
1105 | |||
1049 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1106 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1050 | pub struct MethodCallExpr { | 1107 | pub struct MethodCallExpr { |
1051 | pub(crate) syntax: SyntaxNode, | 1108 | pub(crate) syntax: SyntaxNode, |
@@ -1065,10 +1122,11 @@ impl ast::AttrsOwner for MethodCallExpr {} | |||
1065 | impl ast::ArgListOwner for MethodCallExpr {} | 1122 | impl ast::ArgListOwner for MethodCallExpr {} |
1066 | impl MethodCallExpr { | 1123 | impl MethodCallExpr { |
1067 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1124 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1068 | pub fn dot(&self) -> Option<Dot> { support::token(&self.syntax) } | 1125 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } |
1069 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 1126 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
1070 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } | 1127 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } |
1071 | } | 1128 | } |
1129 | |||
1072 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1130 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1073 | pub struct IndexExpr { | 1131 | pub struct IndexExpr { |
1074 | pub(crate) syntax: SyntaxNode, | 1132 | pub(crate) syntax: SyntaxNode, |
@@ -1086,9 +1144,10 @@ impl AstNode for IndexExpr { | |||
1086 | } | 1144 | } |
1087 | impl ast::AttrsOwner for IndexExpr {} | 1145 | impl ast::AttrsOwner for IndexExpr {} |
1088 | impl IndexExpr { | 1146 | impl IndexExpr { |
1089 | pub fn l_brack(&self) -> Option<LBrack> { support::token(&self.syntax) } | 1147 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
1090 | pub fn r_brack(&self) -> Option<RBrack> { support::token(&self.syntax) } | 1148 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
1091 | } | 1149 | } |
1150 | |||
1092 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1151 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1093 | pub struct FieldExpr { | 1152 | pub struct FieldExpr { |
1094 | pub(crate) syntax: SyntaxNode, | 1153 | pub(crate) syntax: SyntaxNode, |
@@ -1107,9 +1166,10 @@ impl AstNode for FieldExpr { | |||
1107 | impl ast::AttrsOwner for FieldExpr {} | 1166 | impl ast::AttrsOwner for FieldExpr {} |
1108 | impl FieldExpr { | 1167 | impl FieldExpr { |
1109 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1168 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1110 | pub fn dot(&self) -> Option<Dot> { support::token(&self.syntax) } | 1169 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } |
1111 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 1170 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
1112 | } | 1171 | } |
1172 | |||
1113 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1173 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1114 | pub struct AwaitExpr { | 1174 | pub struct AwaitExpr { |
1115 | pub(crate) syntax: SyntaxNode, | 1175 | pub(crate) syntax: SyntaxNode, |
@@ -1128,9 +1188,10 @@ impl AstNode for AwaitExpr { | |||
1128 | impl ast::AttrsOwner for AwaitExpr {} | 1188 | impl ast::AttrsOwner for AwaitExpr {} |
1129 | impl AwaitExpr { | 1189 | impl AwaitExpr { |
1130 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1190 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1131 | pub fn dot(&self) -> Option<Dot> { support::token(&self.syntax) } | 1191 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } |
1132 | pub fn await_kw(&self) -> Option<AwaitKw> { support::token(&self.syntax) } | 1192 | pub fn await_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![await]) } |
1133 | } | 1193 | } |
1194 | |||
1134 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1195 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1135 | pub struct TryExpr { | 1196 | pub struct TryExpr { |
1136 | pub(crate) syntax: SyntaxNode, | 1197 | pub(crate) syntax: SyntaxNode, |
@@ -1148,9 +1209,10 @@ impl AstNode for TryExpr { | |||
1148 | } | 1209 | } |
1149 | impl ast::AttrsOwner for TryExpr {} | 1210 | impl ast::AttrsOwner for TryExpr {} |
1150 | impl TryExpr { | 1211 | impl TryExpr { |
1151 | pub fn try_kw(&self) -> Option<TryKw> { support::token(&self.syntax) } | 1212 | pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) } |
1152 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1213 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1153 | } | 1214 | } |
1215 | |||
1154 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1216 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1155 | pub struct CastExpr { | 1217 | pub struct CastExpr { |
1156 | pub(crate) syntax: SyntaxNode, | 1218 | pub(crate) syntax: SyntaxNode, |
@@ -1169,9 +1231,10 @@ impl AstNode for CastExpr { | |||
1169 | impl ast::AttrsOwner for CastExpr {} | 1231 | impl ast::AttrsOwner for CastExpr {} |
1170 | impl CastExpr { | 1232 | impl CastExpr { |
1171 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1233 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1172 | pub fn as_kw(&self) -> Option<AsKw> { support::token(&self.syntax) } | 1234 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } |
1173 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 1235 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
1174 | } | 1236 | } |
1237 | |||
1175 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1238 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1176 | pub struct RefExpr { | 1239 | pub struct RefExpr { |
1177 | pub(crate) syntax: SyntaxNode, | 1240 | pub(crate) syntax: SyntaxNode, |
@@ -1189,11 +1252,12 @@ impl AstNode for RefExpr { | |||
1189 | } | 1252 | } |
1190 | impl ast::AttrsOwner for RefExpr {} | 1253 | impl ast::AttrsOwner for RefExpr {} |
1191 | impl RefExpr { | 1254 | impl RefExpr { |
1192 | pub fn amp(&self) -> Option<Amp> { support::token(&self.syntax) } | 1255 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } |
1193 | pub fn raw_kw(&self) -> Option<RawKw> { support::token(&self.syntax) } | 1256 | pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) } |
1194 | pub fn mut_kw(&self) -> Option<MutKw> { support::token(&self.syntax) } | 1257 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
1195 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1258 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1196 | } | 1259 | } |
1260 | |||
1197 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1261 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1198 | pub struct PrefixExpr { | 1262 | pub struct PrefixExpr { |
1199 | pub(crate) syntax: SyntaxNode, | 1263 | pub(crate) syntax: SyntaxNode, |
@@ -1211,9 +1275,9 @@ impl AstNode for PrefixExpr { | |||
1211 | } | 1275 | } |
1212 | impl ast::AttrsOwner for PrefixExpr {} | 1276 | impl ast::AttrsOwner for PrefixExpr {} |
1213 | impl PrefixExpr { | 1277 | impl PrefixExpr { |
1214 | pub fn prefix_op(&self) -> Option<PrefixOp> { support::token(&self.syntax) } | ||
1215 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1278 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1216 | } | 1279 | } |
1280 | |||
1217 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1281 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1218 | pub struct BoxExpr { | 1282 | pub struct BoxExpr { |
1219 | pub(crate) syntax: SyntaxNode, | 1283 | pub(crate) syntax: SyntaxNode, |
@@ -1231,9 +1295,10 @@ impl AstNode for BoxExpr { | |||
1231 | } | 1295 | } |
1232 | impl ast::AttrsOwner for BoxExpr {} | 1296 | impl ast::AttrsOwner for BoxExpr {} |
1233 | impl BoxExpr { | 1297 | impl BoxExpr { |
1234 | pub fn box_kw(&self) -> Option<BoxKw> { support::token(&self.syntax) } | 1298 | pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) } |
1235 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1299 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1236 | } | 1300 | } |
1301 | |||
1237 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1302 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1238 | pub struct RangeExpr { | 1303 | pub struct RangeExpr { |
1239 | pub(crate) syntax: SyntaxNode, | 1304 | pub(crate) syntax: SyntaxNode, |
@@ -1250,9 +1315,8 @@ impl AstNode for RangeExpr { | |||
1250 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1315 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1251 | } | 1316 | } |
1252 | impl ast::AttrsOwner for RangeExpr {} | 1317 | impl ast::AttrsOwner for RangeExpr {} |
1253 | impl RangeExpr { | 1318 | impl RangeExpr {} |
1254 | pub fn range_op(&self) -> Option<RangeOp> { support::token(&self.syntax) } | 1319 | |
1255 | } | ||
1256 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1320 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1257 | pub struct BinExpr { | 1321 | pub struct BinExpr { |
1258 | pub(crate) syntax: SyntaxNode, | 1322 | pub(crate) syntax: SyntaxNode, |
@@ -1269,9 +1333,8 @@ impl AstNode for BinExpr { | |||
1269 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1333 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1270 | } | 1334 | } |
1271 | impl ast::AttrsOwner for BinExpr {} | 1335 | impl ast::AttrsOwner for BinExpr {} |
1272 | impl BinExpr { | 1336 | impl BinExpr {} |
1273 | pub fn bin_op(&self) -> Option<BinOp> { support::token(&self.syntax) } | 1337 | |
1274 | } | ||
1275 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1338 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1276 | pub struct Literal { | 1339 | pub struct Literal { |
1277 | pub(crate) syntax: SyntaxNode, | 1340 | pub(crate) syntax: SyntaxNode, |
@@ -1287,9 +1350,8 @@ impl AstNode for Literal { | |||
1287 | } | 1350 | } |
1288 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1351 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1289 | } | 1352 | } |
1290 | impl Literal { | 1353 | impl Literal {} |
1291 | pub fn literal_token(&self) -> Option<LiteralToken> { support::token(&self.syntax) } | 1354 | |
1292 | } | ||
1293 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1355 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1294 | pub struct MatchExpr { | 1356 | pub struct MatchExpr { |
1295 | pub(crate) syntax: SyntaxNode, | 1357 | pub(crate) syntax: SyntaxNode, |
@@ -1307,10 +1369,11 @@ impl AstNode for MatchExpr { | |||
1307 | } | 1369 | } |
1308 | impl ast::AttrsOwner for MatchExpr {} | 1370 | impl ast::AttrsOwner for MatchExpr {} |
1309 | impl MatchExpr { | 1371 | impl MatchExpr { |
1310 | pub fn match_kw(&self) -> Option<MatchKw> { support::token(&self.syntax) } | 1372 | pub fn match_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![match]) } |
1311 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1373 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1312 | pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) } | 1374 | pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) } |
1313 | } | 1375 | } |
1376 | |||
1314 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1377 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1315 | pub struct MatchArmList { | 1378 | pub struct MatchArmList { |
1316 | pub(crate) syntax: SyntaxNode, | 1379 | pub(crate) syntax: SyntaxNode, |
@@ -1328,10 +1391,11 @@ impl AstNode for MatchArmList { | |||
1328 | } | 1391 | } |
1329 | impl ast::AttrsOwner for MatchArmList {} | 1392 | impl ast::AttrsOwner for MatchArmList {} |
1330 | impl MatchArmList { | 1393 | impl MatchArmList { |
1331 | pub fn l_curly(&self) -> Option<LCurly> { support::token(&self.syntax) } | 1394 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
1332 | pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) } | 1395 | pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) } |
1333 | pub fn r_curly(&self) -> Option<RCurly> { support::token(&self.syntax) } | 1396 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
1334 | } | 1397 | } |
1398 | |||
1335 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1399 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1336 | pub struct MatchArm { | 1400 | pub struct MatchArm { |
1337 | pub(crate) syntax: SyntaxNode, | 1401 | pub(crate) syntax: SyntaxNode, |
@@ -1351,9 +1415,10 @@ impl ast::AttrsOwner for MatchArm {} | |||
1351 | impl MatchArm { | 1415 | impl MatchArm { |
1352 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 1416 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
1353 | pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) } | 1417 | pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) } |
1354 | pub fn fat_arrow(&self) -> Option<FatArrow> { support::token(&self.syntax) } | 1418 | pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) } |
1355 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1419 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1356 | } | 1420 | } |
1421 | |||
1357 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1422 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1358 | pub struct MatchGuard { | 1423 | pub struct MatchGuard { |
1359 | pub(crate) syntax: SyntaxNode, | 1424 | pub(crate) syntax: SyntaxNode, |
@@ -1370,9 +1435,10 @@ impl AstNode for MatchGuard { | |||
1370 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1435 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1371 | } | 1436 | } |
1372 | impl MatchGuard { | 1437 | impl MatchGuard { |
1373 | pub fn if_kw(&self) -> Option<IfKw> { support::token(&self.syntax) } | 1438 | pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } |
1374 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1439 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1375 | } | 1440 | } |
1441 | |||
1376 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1442 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1377 | pub struct RecordLit { | 1443 | pub struct RecordLit { |
1378 | pub(crate) syntax: SyntaxNode, | 1444 | pub(crate) syntax: SyntaxNode, |
@@ -1392,6 +1458,7 @@ impl RecordLit { | |||
1392 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 1458 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
1393 | pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) } | 1459 | pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) } |
1394 | } | 1460 | } |
1461 | |||
1395 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1462 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1396 | pub struct RecordFieldList { | 1463 | pub struct RecordFieldList { |
1397 | pub(crate) syntax: SyntaxNode, | 1464 | pub(crate) syntax: SyntaxNode, |
@@ -1408,12 +1475,13 @@ impl AstNode for RecordFieldList { | |||
1408 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1475 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1409 | } | 1476 | } |
1410 | impl RecordFieldList { | 1477 | impl RecordFieldList { |
1411 | pub fn l_curly(&self) -> Option<LCurly> { support::token(&self.syntax) } | 1478 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
1412 | pub fn fields(&self) -> AstChildren<RecordField> { support::children(&self.syntax) } | 1479 | pub fn fields(&self) -> AstChildren<RecordField> { support::children(&self.syntax) } |
1413 | pub fn dotdot(&self) -> Option<Dotdot> { support::token(&self.syntax) } | 1480 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } |
1414 | pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) } | 1481 | pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) } |
1415 | pub fn r_curly(&self) -> Option<RCurly> { support::token(&self.syntax) } | 1482 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
1416 | } | 1483 | } |
1484 | |||
1417 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1485 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1418 | pub struct RecordField { | 1486 | pub struct RecordField { |
1419 | pub(crate) syntax: SyntaxNode, | 1487 | pub(crate) syntax: SyntaxNode, |
@@ -1432,9 +1500,10 @@ impl AstNode for RecordField { | |||
1432 | impl ast::AttrsOwner for RecordField {} | 1500 | impl ast::AttrsOwner for RecordField {} |
1433 | impl RecordField { | 1501 | impl RecordField { |
1434 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 1502 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
1435 | pub fn colon(&self) -> Option<Colon> { support::token(&self.syntax) } | 1503 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
1436 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1504 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1437 | } | 1505 | } |
1506 | |||
1438 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1507 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1439 | pub struct OrPat { | 1508 | pub struct OrPat { |
1440 | pub(crate) syntax: SyntaxNode, | 1509 | pub(crate) syntax: SyntaxNode, |
@@ -1453,6 +1522,7 @@ impl AstNode for OrPat { | |||
1453 | impl OrPat { | 1522 | impl OrPat { |
1454 | pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | 1523 | pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) } |
1455 | } | 1524 | } |
1525 | |||
1456 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1526 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1457 | pub struct ParenPat { | 1527 | pub struct ParenPat { |
1458 | pub(crate) syntax: SyntaxNode, | 1528 | pub(crate) syntax: SyntaxNode, |
@@ -1469,10 +1539,11 @@ impl AstNode for ParenPat { | |||
1469 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1539 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1470 | } | 1540 | } |
1471 | impl ParenPat { | 1541 | impl ParenPat { |
1472 | pub fn l_paren(&self) -> Option<LParen> { support::token(&self.syntax) } | 1542 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
1473 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 1543 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
1474 | pub fn r_paren(&self) -> Option<RParen> { support::token(&self.syntax) } | 1544 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
1475 | } | 1545 | } |
1546 | |||
1476 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1547 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1477 | pub struct RefPat { | 1548 | pub struct RefPat { |
1478 | pub(crate) syntax: SyntaxNode, | 1549 | pub(crate) syntax: SyntaxNode, |
@@ -1489,10 +1560,11 @@ impl AstNode for RefPat { | |||
1489 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1560 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1490 | } | 1561 | } |
1491 | impl RefPat { | 1562 | impl RefPat { |
1492 | pub fn amp(&self) -> Option<Amp> { support::token(&self.syntax) } | 1563 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } |
1493 | pub fn mut_kw(&self) -> Option<MutKw> { support::token(&self.syntax) } | 1564 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
1494 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 1565 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
1495 | } | 1566 | } |
1567 | |||
1496 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1568 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1497 | pub struct BoxPat { | 1569 | pub struct BoxPat { |
1498 | pub(crate) syntax: SyntaxNode, | 1570 | pub(crate) syntax: SyntaxNode, |
@@ -1509,9 +1581,10 @@ impl AstNode for BoxPat { | |||
1509 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1581 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1510 | } | 1582 | } |
1511 | impl BoxPat { | 1583 | impl BoxPat { |
1512 | pub fn box_kw(&self) -> Option<BoxKw> { support::token(&self.syntax) } | 1584 | pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) } |
1513 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 1585 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
1514 | } | 1586 | } |
1587 | |||
1515 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1588 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1516 | pub struct BindPat { | 1589 | pub struct BindPat { |
1517 | pub(crate) syntax: SyntaxNode, | 1590 | pub(crate) syntax: SyntaxNode, |
@@ -1530,10 +1603,12 @@ impl AstNode for BindPat { | |||
1530 | impl ast::AttrsOwner for BindPat {} | 1603 | impl ast::AttrsOwner for BindPat {} |
1531 | impl ast::NameOwner for BindPat {} | 1604 | impl ast::NameOwner for BindPat {} |
1532 | impl BindPat { | 1605 | impl BindPat { |
1533 | pub fn ref_kw(&self) -> Option<RefKw> { support::token(&self.syntax) } | 1606 | pub fn ref_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ref]) } |
1534 | pub fn mut_kw(&self) -> Option<MutKw> { support::token(&self.syntax) } | 1607 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
1608 | pub fn at_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![@]) } | ||
1535 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 1609 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
1536 | } | 1610 | } |
1611 | |||
1537 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1612 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1538 | pub struct PlaceholderPat { | 1613 | pub struct PlaceholderPat { |
1539 | pub(crate) syntax: SyntaxNode, | 1614 | pub(crate) syntax: SyntaxNode, |
@@ -1550,8 +1625,9 @@ impl AstNode for PlaceholderPat { | |||
1550 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1625 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1551 | } | 1626 | } |
1552 | impl PlaceholderPat { | 1627 | impl PlaceholderPat { |
1553 | pub fn underscore(&self) -> Option<Underscore> { support::token(&self.syntax) } | 1628 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } |
1554 | } | 1629 | } |
1630 | |||
1555 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1631 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1556 | pub struct DotDotPat { | 1632 | pub struct DotDotPat { |
1557 | pub(crate) syntax: SyntaxNode, | 1633 | pub(crate) syntax: SyntaxNode, |
@@ -1568,8 +1644,9 @@ impl AstNode for DotDotPat { | |||
1568 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1644 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1569 | } | 1645 | } |
1570 | impl DotDotPat { | 1646 | impl DotDotPat { |
1571 | pub fn dotdot(&self) -> Option<Dotdot> { support::token(&self.syntax) } | 1647 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } |
1572 | } | 1648 | } |
1649 | |||
1573 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1650 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1574 | pub struct PathPat { | 1651 | pub struct PathPat { |
1575 | pub(crate) syntax: SyntaxNode, | 1652 | pub(crate) syntax: SyntaxNode, |
@@ -1588,6 +1665,7 @@ impl AstNode for PathPat { | |||
1588 | impl PathPat { | 1665 | impl PathPat { |
1589 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 1666 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
1590 | } | 1667 | } |
1668 | |||
1591 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1669 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1592 | pub struct SlicePat { | 1670 | pub struct SlicePat { |
1593 | pub(crate) syntax: SyntaxNode, | 1671 | pub(crate) syntax: SyntaxNode, |
@@ -1604,10 +1682,11 @@ impl AstNode for SlicePat { | |||
1604 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1682 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1605 | } | 1683 | } |
1606 | impl SlicePat { | 1684 | impl SlicePat { |
1607 | pub fn l_brack(&self) -> Option<LBrack> { support::token(&self.syntax) } | 1685 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
1608 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | 1686 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } |
1609 | pub fn r_brack(&self) -> Option<RBrack> { support::token(&self.syntax) } | 1687 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
1610 | } | 1688 | } |
1689 | |||
1611 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1690 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1612 | pub struct RangePat { | 1691 | pub struct RangePat { |
1613 | pub(crate) syntax: SyntaxNode, | 1692 | pub(crate) syntax: SyntaxNode, |
@@ -1623,9 +1702,8 @@ impl AstNode for RangePat { | |||
1623 | } | 1702 | } |
1624 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1703 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1625 | } | 1704 | } |
1626 | impl RangePat { | 1705 | impl RangePat {} |
1627 | pub fn range_separator(&self) -> Option<RangeSeparator> { support::token(&self.syntax) } | 1706 | |
1628 | } | ||
1629 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1707 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1630 | pub struct LiteralPat { | 1708 | pub struct LiteralPat { |
1631 | pub(crate) syntax: SyntaxNode, | 1709 | pub(crate) syntax: SyntaxNode, |
@@ -1644,6 +1722,7 @@ impl AstNode for LiteralPat { | |||
1644 | impl LiteralPat { | 1722 | impl LiteralPat { |
1645 | pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } | 1723 | pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } |
1646 | } | 1724 | } |
1725 | |||
1647 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1726 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1648 | pub struct MacroPat { | 1727 | pub struct MacroPat { |
1649 | pub(crate) syntax: SyntaxNode, | 1728 | pub(crate) syntax: SyntaxNode, |
@@ -1662,6 +1741,7 @@ impl AstNode for MacroPat { | |||
1662 | impl MacroPat { | 1741 | impl MacroPat { |
1663 | pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } | 1742 | pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } |
1664 | } | 1743 | } |
1744 | |||
1665 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1745 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1666 | pub struct RecordPat { | 1746 | pub struct RecordPat { |
1667 | pub(crate) syntax: SyntaxNode, | 1747 | pub(crate) syntax: SyntaxNode, |
@@ -1683,6 +1763,7 @@ impl RecordPat { | |||
1683 | } | 1763 | } |
1684 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 1764 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
1685 | } | 1765 | } |
1766 | |||
1686 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1767 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1687 | pub struct RecordFieldPatList { | 1768 | pub struct RecordFieldPatList { |
1688 | pub(crate) syntax: SyntaxNode, | 1769 | pub(crate) syntax: SyntaxNode, |
@@ -1699,15 +1780,16 @@ impl AstNode for RecordFieldPatList { | |||
1699 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1780 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1700 | } | 1781 | } |
1701 | impl RecordFieldPatList { | 1782 | impl RecordFieldPatList { |
1702 | pub fn l_curly(&self) -> Option<LCurly> { support::token(&self.syntax) } | 1783 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
1703 | pub fn pats(&self) -> AstChildren<RecordInnerPat> { support::children(&self.syntax) } | 1784 | pub fn pats(&self) -> AstChildren<RecordInnerPat> { support::children(&self.syntax) } |
1704 | pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> { | 1785 | pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> { |
1705 | support::children(&self.syntax) | 1786 | support::children(&self.syntax) |
1706 | } | 1787 | } |
1707 | pub fn bind_pats(&self) -> AstChildren<BindPat> { support::children(&self.syntax) } | 1788 | pub fn bind_pats(&self) -> AstChildren<BindPat> { support::children(&self.syntax) } |
1708 | pub fn dotdot(&self) -> Option<Dotdot> { support::token(&self.syntax) } | 1789 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } |
1709 | pub fn r_curly(&self) -> Option<RCurly> { support::token(&self.syntax) } | 1790 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
1710 | } | 1791 | } |
1792 | |||
1711 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1793 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1712 | pub struct RecordFieldPat { | 1794 | pub struct RecordFieldPat { |
1713 | pub(crate) syntax: SyntaxNode, | 1795 | pub(crate) syntax: SyntaxNode, |
@@ -1726,9 +1808,10 @@ impl AstNode for RecordFieldPat { | |||
1726 | impl ast::AttrsOwner for RecordFieldPat {} | 1808 | impl ast::AttrsOwner for RecordFieldPat {} |
1727 | impl ast::NameOwner for RecordFieldPat {} | 1809 | impl ast::NameOwner for RecordFieldPat {} |
1728 | impl RecordFieldPat { | 1810 | impl RecordFieldPat { |
1729 | pub fn colon(&self) -> Option<Colon> { support::token(&self.syntax) } | 1811 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
1730 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 1812 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
1731 | } | 1813 | } |
1814 | |||
1732 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1815 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1733 | pub struct TupleStructPat { | 1816 | pub struct TupleStructPat { |
1734 | pub(crate) syntax: SyntaxNode, | 1817 | pub(crate) syntax: SyntaxNode, |
@@ -1746,10 +1829,11 @@ impl AstNode for TupleStructPat { | |||
1746 | } | 1829 | } |
1747 | impl TupleStructPat { | 1830 | impl TupleStructPat { |
1748 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 1831 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
1749 | pub fn l_paren(&self) -> Option<LParen> { support::token(&self.syntax) } | 1832 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
1750 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | 1833 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } |
1751 | pub fn r_paren(&self) -> Option<RParen> { support::token(&self.syntax) } | 1834 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
1752 | } | 1835 | } |
1836 | |||
1753 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1837 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1754 | pub struct TuplePat { | 1838 | pub struct TuplePat { |
1755 | pub(crate) syntax: SyntaxNode, | 1839 | pub(crate) syntax: SyntaxNode, |
@@ -1766,10 +1850,11 @@ impl AstNode for TuplePat { | |||
1766 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1850 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1767 | } | 1851 | } |
1768 | impl TuplePat { | 1852 | impl TuplePat { |
1769 | pub fn l_paren(&self) -> Option<LParen> { support::token(&self.syntax) } | 1853 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
1770 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | 1854 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } |
1771 | pub fn r_paren(&self) -> Option<RParen> { support::token(&self.syntax) } | 1855 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
1772 | } | 1856 | } |
1857 | |||
1773 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1858 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1774 | pub struct Visibility { | 1859 | pub struct Visibility { |
1775 | pub(crate) syntax: SyntaxNode, | 1860 | pub(crate) syntax: SyntaxNode, |
@@ -1786,11 +1871,12 @@ impl AstNode for Visibility { | |||
1786 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1871 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1787 | } | 1872 | } |
1788 | impl Visibility { | 1873 | impl Visibility { |
1789 | pub fn pub_kw(&self) -> Option<PubKw> { support::token(&self.syntax) } | 1874 | pub fn pub_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![pub]) } |
1790 | pub fn super_kw(&self) -> Option<SuperKw> { support::token(&self.syntax) } | 1875 | pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) } |
1791 | pub fn self_kw(&self) -> Option<SelfKw> { support::token(&self.syntax) } | 1876 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } |
1792 | pub fn crate_kw(&self) -> Option<CrateKw> { support::token(&self.syntax) } | 1877 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } |
1793 | } | 1878 | } |
1879 | |||
1794 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1880 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1795 | pub struct Name { | 1881 | pub struct Name { |
1796 | pub(crate) syntax: SyntaxNode, | 1882 | pub(crate) syntax: SyntaxNode, |
@@ -1807,8 +1893,9 @@ impl AstNode for Name { | |||
1807 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1893 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1808 | } | 1894 | } |
1809 | impl Name { | 1895 | impl Name { |
1810 | pub fn ident(&self) -> Option<Ident> { support::token(&self.syntax) } | 1896 | pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } |
1811 | } | 1897 | } |
1898 | |||
1812 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1899 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1813 | pub struct NameRef { | 1900 | pub struct NameRef { |
1814 | pub(crate) syntax: SyntaxNode, | 1901 | pub(crate) syntax: SyntaxNode, |
@@ -1824,9 +1911,8 @@ impl AstNode for NameRef { | |||
1824 | } | 1911 | } |
1825 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1912 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1826 | } | 1913 | } |
1827 | impl NameRef { | 1914 | impl NameRef {} |
1828 | pub fn name_ref_token(&self) -> Option<NameRefToken> { support::token(&self.syntax) } | 1915 | |
1829 | } | ||
1830 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1916 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1831 | pub struct MacroCall { | 1917 | pub struct MacroCall { |
1832 | pub(crate) syntax: SyntaxNode, | 1918 | pub(crate) syntax: SyntaxNode, |
@@ -1847,10 +1933,11 @@ impl ast::AttrsOwner for MacroCall {} | |||
1847 | impl ast::DocCommentsOwner for MacroCall {} | 1933 | impl ast::DocCommentsOwner for MacroCall {} |
1848 | impl MacroCall { | 1934 | impl MacroCall { |
1849 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 1935 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
1850 | pub fn excl(&self) -> Option<Excl> { support::token(&self.syntax) } | 1936 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } |
1851 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } | 1937 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } |
1852 | pub fn semi(&self) -> Option<Semi> { support::token(&self.syntax) } | 1938 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
1853 | } | 1939 | } |
1940 | |||
1854 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1941 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1855 | pub struct Attr { | 1942 | pub struct Attr { |
1856 | pub(crate) syntax: SyntaxNode, | 1943 | pub(crate) syntax: SyntaxNode, |
@@ -1867,14 +1954,15 @@ impl AstNode for Attr { | |||
1867 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1954 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1868 | } | 1955 | } |
1869 | impl Attr { | 1956 | impl Attr { |
1870 | pub fn pound(&self) -> Option<Pound> { support::token(&self.syntax) } | 1957 | pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) } |
1871 | pub fn excl(&self) -> Option<Excl> { support::token(&self.syntax) } | 1958 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } |
1872 | pub fn l_brack(&self) -> Option<LBrack> { support::token(&self.syntax) } | 1959 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
1873 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 1960 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
1874 | pub fn eq(&self) -> Option<Eq> { support::token(&self.syntax) } | 1961 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
1875 | pub fn input(&self) -> Option<AttrInput> { support::child(&self.syntax) } | 1962 | pub fn input(&self) -> Option<AttrInput> { support::child(&self.syntax) } |
1876 | pub fn r_brack(&self) -> Option<RBrack> { support::token(&self.syntax) } | 1963 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
1877 | } | 1964 | } |
1965 | |||
1878 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1966 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1879 | pub struct TokenTree { | 1967 | pub struct TokenTree { |
1880 | pub(crate) syntax: SyntaxNode, | 1968 | pub(crate) syntax: SyntaxNode, |
@@ -1891,6 +1979,7 @@ impl AstNode for TokenTree { | |||
1891 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1979 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1892 | } | 1980 | } |
1893 | impl TokenTree {} | 1981 | impl TokenTree {} |
1982 | |||
1894 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1983 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1895 | pub struct TypeParamList { | 1984 | pub struct TypeParamList { |
1896 | pub(crate) syntax: SyntaxNode, | 1985 | pub(crate) syntax: SyntaxNode, |
@@ -1907,13 +1996,14 @@ impl AstNode for TypeParamList { | |||
1907 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1996 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1908 | } | 1997 | } |
1909 | impl TypeParamList { | 1998 | impl TypeParamList { |
1910 | pub fn l_angle(&self) -> Option<LAngle> { support::token(&self.syntax) } | 1999 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } |
1911 | pub fn generic_params(&self) -> AstChildren<GenericParam> { support::children(&self.syntax) } | 2000 | pub fn generic_params(&self) -> AstChildren<GenericParam> { support::children(&self.syntax) } |
1912 | pub fn type_params(&self) -> AstChildren<TypeParam> { support::children(&self.syntax) } | 2001 | pub fn type_params(&self) -> AstChildren<TypeParam> { support::children(&self.syntax) } |
1913 | pub fn lifetime_params(&self) -> AstChildren<LifetimeParam> { support::children(&self.syntax) } | 2002 | pub fn lifetime_params(&self) -> AstChildren<LifetimeParam> { support::children(&self.syntax) } |
1914 | pub fn const_params(&self) -> AstChildren<ConstParam> { support::children(&self.syntax) } | 2003 | pub fn const_params(&self) -> AstChildren<ConstParam> { support::children(&self.syntax) } |
1915 | pub fn r_angle(&self) -> Option<RAngle> { support::token(&self.syntax) } | 2004 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } |
1916 | } | 2005 | } |
2006 | |||
1917 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2007 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1918 | pub struct TypeParam { | 2008 | pub struct TypeParam { |
1919 | pub(crate) syntax: SyntaxNode, | 2009 | pub(crate) syntax: SyntaxNode, |
@@ -1933,9 +2023,10 @@ impl ast::NameOwner for TypeParam {} | |||
1933 | impl ast::AttrsOwner for TypeParam {} | 2023 | impl ast::AttrsOwner for TypeParam {} |
1934 | impl ast::TypeBoundsOwner for TypeParam {} | 2024 | impl ast::TypeBoundsOwner for TypeParam {} |
1935 | impl TypeParam { | 2025 | impl TypeParam { |
1936 | pub fn eq(&self) -> Option<Eq> { support::token(&self.syntax) } | 2026 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
1937 | pub fn default_type(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 2027 | pub fn default_type(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
1938 | } | 2028 | } |
2029 | |||
1939 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2030 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1940 | pub struct ConstParam { | 2031 | pub struct ConstParam { |
1941 | pub(crate) syntax: SyntaxNode, | 2032 | pub(crate) syntax: SyntaxNode, |
@@ -1955,9 +2046,10 @@ impl ast::NameOwner for ConstParam {} | |||
1955 | impl ast::AttrsOwner for ConstParam {} | 2046 | impl ast::AttrsOwner for ConstParam {} |
1956 | impl ast::TypeAscriptionOwner for ConstParam {} | 2047 | impl ast::TypeAscriptionOwner for ConstParam {} |
1957 | impl ConstParam { | 2048 | impl ConstParam { |
1958 | pub fn eq(&self) -> Option<Eq> { support::token(&self.syntax) } | 2049 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
1959 | pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) } | 2050 | pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) } |
1960 | } | 2051 | } |
2052 | |||
1961 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2053 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1962 | pub struct LifetimeParam { | 2054 | pub struct LifetimeParam { |
1963 | pub(crate) syntax: SyntaxNode, | 2055 | pub(crate) syntax: SyntaxNode, |
@@ -1975,8 +2067,11 @@ impl AstNode for LifetimeParam { | |||
1975 | } | 2067 | } |
1976 | impl ast::AttrsOwner for LifetimeParam {} | 2068 | impl ast::AttrsOwner for LifetimeParam {} |
1977 | impl LifetimeParam { | 2069 | impl LifetimeParam { |
1978 | pub fn lifetime(&self) -> Option<Lifetime> { support::token(&self.syntax) } | 2070 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
2071 | support::token(&self.syntax, T![lifetime]) | ||
2072 | } | ||
1979 | } | 2073 | } |
2074 | |||
1980 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2075 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1981 | pub struct TypeBound { | 2076 | pub struct TypeBound { |
1982 | pub(crate) syntax: SyntaxNode, | 2077 | pub(crate) syntax: SyntaxNode, |
@@ -1993,10 +2088,13 @@ impl AstNode for TypeBound { | |||
1993 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2088 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1994 | } | 2089 | } |
1995 | impl TypeBound { | 2090 | impl TypeBound { |
1996 | pub fn lifetime(&self) -> Option<Lifetime> { support::token(&self.syntax) } | 2091 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
1997 | pub fn const_kw(&self) -> Option<ConstKw> { support::token(&self.syntax) } | 2092 | support::token(&self.syntax, T![lifetime]) |
2093 | } | ||
2094 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
1998 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 2095 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
1999 | } | 2096 | } |
2097 | |||
2000 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2098 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2001 | pub struct TypeBoundList { | 2099 | pub struct TypeBoundList { |
2002 | pub(crate) syntax: SyntaxNode, | 2100 | pub(crate) syntax: SyntaxNode, |
@@ -2015,6 +2113,7 @@ impl AstNode for TypeBoundList { | |||
2015 | impl TypeBoundList { | 2113 | impl TypeBoundList { |
2016 | pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } | 2114 | pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } |
2017 | } | 2115 | } |
2116 | |||
2018 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2117 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2019 | pub struct WherePred { | 2118 | pub struct WherePred { |
2020 | pub(crate) syntax: SyntaxNode, | 2119 | pub(crate) syntax: SyntaxNode, |
@@ -2032,9 +2131,12 @@ impl AstNode for WherePred { | |||
2032 | } | 2131 | } |
2033 | impl ast::TypeBoundsOwner for WherePred {} | 2132 | impl ast::TypeBoundsOwner for WherePred {} |
2034 | impl WherePred { | 2133 | impl WherePred { |
2035 | pub fn lifetime(&self) -> Option<Lifetime> { support::token(&self.syntax) } | 2134 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
2135 | support::token(&self.syntax, T![lifetime]) | ||
2136 | } | ||
2036 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 2137 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
2037 | } | 2138 | } |
2139 | |||
2038 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2140 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2039 | pub struct WhereClause { | 2141 | pub struct WhereClause { |
2040 | pub(crate) syntax: SyntaxNode, | 2142 | pub(crate) syntax: SyntaxNode, |
@@ -2051,9 +2153,10 @@ impl AstNode for WhereClause { | |||
2051 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2153 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2052 | } | 2154 | } |
2053 | impl WhereClause { | 2155 | impl WhereClause { |
2054 | pub fn where_kw(&self) -> Option<WhereKw> { support::token(&self.syntax) } | 2156 | pub fn where_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![where]) } |
2055 | pub fn predicates(&self) -> AstChildren<WherePred> { support::children(&self.syntax) } | 2157 | pub fn predicates(&self) -> AstChildren<WherePred> { support::children(&self.syntax) } |
2056 | } | 2158 | } |
2159 | |||
2057 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2160 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2058 | pub struct Abi { | 2161 | pub struct Abi { |
2059 | pub(crate) syntax: SyntaxNode, | 2162 | pub(crate) syntax: SyntaxNode, |
@@ -2069,9 +2172,8 @@ impl AstNode for Abi { | |||
2069 | } | 2172 | } |
2070 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2173 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2071 | } | 2174 | } |
2072 | impl Abi { | 2175 | impl Abi {} |
2073 | pub fn string(&self) -> Option<String> { support::token(&self.syntax) } | 2176 | |
2074 | } | ||
2075 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2177 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2076 | pub struct ExprStmt { | 2178 | pub struct ExprStmt { |
2077 | pub(crate) syntax: SyntaxNode, | 2179 | pub(crate) syntax: SyntaxNode, |
@@ -2090,8 +2192,9 @@ impl AstNode for ExprStmt { | |||
2090 | impl ast::AttrsOwner for ExprStmt {} | 2192 | impl ast::AttrsOwner for ExprStmt {} |
2091 | impl ExprStmt { | 2193 | impl ExprStmt { |
2092 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 2194 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
2093 | pub fn semi(&self) -> Option<Semi> { support::token(&self.syntax) } | 2195 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
2094 | } | 2196 | } |
2197 | |||
2095 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2198 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2096 | pub struct LetStmt { | 2199 | pub struct LetStmt { |
2097 | pub(crate) syntax: SyntaxNode, | 2200 | pub(crate) syntax: SyntaxNode, |
@@ -2110,11 +2213,13 @@ impl AstNode for LetStmt { | |||
2110 | impl ast::AttrsOwner for LetStmt {} | 2213 | impl ast::AttrsOwner for LetStmt {} |
2111 | impl ast::TypeAscriptionOwner for LetStmt {} | 2214 | impl ast::TypeAscriptionOwner for LetStmt {} |
2112 | impl LetStmt { | 2215 | impl LetStmt { |
2113 | pub fn let_kw(&self) -> Option<LetKw> { support::token(&self.syntax) } | 2216 | pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } |
2114 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 2217 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
2115 | pub fn eq(&self) -> Option<Eq> { support::token(&self.syntax) } | 2218 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
2116 | pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) } | 2219 | pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) } |
2220 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
2117 | } | 2221 | } |
2222 | |||
2118 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2223 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2119 | pub struct Condition { | 2224 | pub struct Condition { |
2120 | pub(crate) syntax: SyntaxNode, | 2225 | pub(crate) syntax: SyntaxNode, |
@@ -2131,11 +2236,12 @@ impl AstNode for Condition { | |||
2131 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2236 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2132 | } | 2237 | } |
2133 | impl Condition { | 2238 | impl Condition { |
2134 | pub fn let_kw(&self) -> Option<LetKw> { support::token(&self.syntax) } | 2239 | pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } |
2135 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 2240 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
2136 | pub fn eq(&self) -> Option<Eq> { support::token(&self.syntax) } | 2241 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
2137 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 2242 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
2138 | } | 2243 | } |
2244 | |||
2139 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2245 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2140 | pub struct Block { | 2246 | pub struct Block { |
2141 | pub(crate) syntax: SyntaxNode, | 2247 | pub(crate) syntax: SyntaxNode, |
@@ -2154,11 +2260,12 @@ impl AstNode for Block { | |||
2154 | impl ast::AttrsOwner for Block {} | 2260 | impl ast::AttrsOwner for Block {} |
2155 | impl ast::ModuleItemOwner for Block {} | 2261 | impl ast::ModuleItemOwner for Block {} |
2156 | impl Block { | 2262 | impl Block { |
2157 | pub fn l_curly(&self) -> Option<LCurly> { support::token(&self.syntax) } | 2263 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
2158 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } | 2264 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } |
2159 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 2265 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
2160 | pub fn r_curly(&self) -> Option<RCurly> { support::token(&self.syntax) } | 2266 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
2161 | } | 2267 | } |
2268 | |||
2162 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2269 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2163 | pub struct ParamList { | 2270 | pub struct ParamList { |
2164 | pub(crate) syntax: SyntaxNode, | 2271 | pub(crate) syntax: SyntaxNode, |
@@ -2175,11 +2282,12 @@ impl AstNode for ParamList { | |||
2175 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2282 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2176 | } | 2283 | } |
2177 | impl ParamList { | 2284 | impl ParamList { |
2178 | pub fn l_paren(&self) -> Option<LParen> { support::token(&self.syntax) } | 2285 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
2179 | pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) } | 2286 | pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) } |
2180 | pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) } | 2287 | pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) } |
2181 | pub fn r_paren(&self) -> Option<RParen> { support::token(&self.syntax) } | 2288 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
2182 | } | 2289 | } |
2290 | |||
2183 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2291 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2184 | pub struct SelfParam { | 2292 | pub struct SelfParam { |
2185 | pub(crate) syntax: SyntaxNode, | 2293 | pub(crate) syntax: SyntaxNode, |
@@ -2198,10 +2306,14 @@ impl AstNode for SelfParam { | |||
2198 | impl ast::TypeAscriptionOwner for SelfParam {} | 2306 | impl ast::TypeAscriptionOwner for SelfParam {} |
2199 | impl ast::AttrsOwner for SelfParam {} | 2307 | impl ast::AttrsOwner for SelfParam {} |
2200 | impl SelfParam { | 2308 | impl SelfParam { |
2201 | pub fn amp(&self) -> Option<Amp> { support::token(&self.syntax) } | 2309 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } |
2202 | pub fn lifetime(&self) -> Option<Lifetime> { support::token(&self.syntax) } | 2310 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
2203 | pub fn self_kw(&self) -> Option<SelfKw> { support::token(&self.syntax) } | 2311 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
2312 | support::token(&self.syntax, T![lifetime]) | ||
2313 | } | ||
2314 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
2204 | } | 2315 | } |
2316 | |||
2205 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2317 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2206 | pub struct Param { | 2318 | pub struct Param { |
2207 | pub(crate) syntax: SyntaxNode, | 2319 | pub(crate) syntax: SyntaxNode, |
@@ -2221,8 +2333,9 @@ impl ast::TypeAscriptionOwner for Param {} | |||
2221 | impl ast::AttrsOwner for Param {} | 2333 | impl ast::AttrsOwner for Param {} |
2222 | impl Param { | 2334 | impl Param { |
2223 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 2335 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
2224 | pub fn dotdotdot(&self) -> Option<Dotdotdot> { support::token(&self.syntax) } | 2336 | pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) } |
2225 | } | 2337 | } |
2338 | |||
2226 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2339 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2227 | pub struct UseItem { | 2340 | pub struct UseItem { |
2228 | pub(crate) syntax: SyntaxNode, | 2341 | pub(crate) syntax: SyntaxNode, |
@@ -2241,9 +2354,10 @@ impl AstNode for UseItem { | |||
2241 | impl ast::AttrsOwner for UseItem {} | 2354 | impl ast::AttrsOwner for UseItem {} |
2242 | impl ast::VisibilityOwner for UseItem {} | 2355 | impl ast::VisibilityOwner for UseItem {} |
2243 | impl UseItem { | 2356 | impl UseItem { |
2244 | pub fn use_kw(&self) -> Option<UseKw> { support::token(&self.syntax) } | 2357 | pub fn use_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![use]) } |
2245 | pub fn use_tree(&self) -> Option<UseTree> { support::child(&self.syntax) } | 2358 | pub fn use_tree(&self) -> Option<UseTree> { support::child(&self.syntax) } |
2246 | } | 2359 | } |
2360 | |||
2247 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2361 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2248 | pub struct UseTree { | 2362 | pub struct UseTree { |
2249 | pub(crate) syntax: SyntaxNode, | 2363 | pub(crate) syntax: SyntaxNode, |
@@ -2261,10 +2375,11 @@ impl AstNode for UseTree { | |||
2261 | } | 2375 | } |
2262 | impl UseTree { | 2376 | impl UseTree { |
2263 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 2377 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
2264 | pub fn star(&self) -> Option<Star> { support::token(&self.syntax) } | 2378 | pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } |
2265 | pub fn use_tree_list(&self) -> Option<UseTreeList> { support::child(&self.syntax) } | 2379 | pub fn use_tree_list(&self) -> Option<UseTreeList> { support::child(&self.syntax) } |
2266 | pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) } | 2380 | pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) } |
2267 | } | 2381 | } |
2382 | |||
2268 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2383 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2269 | pub struct Alias { | 2384 | pub struct Alias { |
2270 | pub(crate) syntax: SyntaxNode, | 2385 | pub(crate) syntax: SyntaxNode, |
@@ -2282,8 +2397,9 @@ impl AstNode for Alias { | |||
2282 | } | 2397 | } |
2283 | impl ast::NameOwner for Alias {} | 2398 | impl ast::NameOwner for Alias {} |
2284 | impl Alias { | 2399 | impl Alias { |
2285 | pub fn as_kw(&self) -> Option<AsKw> { support::token(&self.syntax) } | 2400 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } |
2286 | } | 2401 | } |
2402 | |||
2287 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2403 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2288 | pub struct UseTreeList { | 2404 | pub struct UseTreeList { |
2289 | pub(crate) syntax: SyntaxNode, | 2405 | pub(crate) syntax: SyntaxNode, |
@@ -2300,10 +2416,11 @@ impl AstNode for UseTreeList { | |||
2300 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2416 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2301 | } | 2417 | } |
2302 | impl UseTreeList { | 2418 | impl UseTreeList { |
2303 | pub fn l_curly(&self) -> Option<LCurly> { support::token(&self.syntax) } | 2419 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
2304 | pub fn use_trees(&self) -> AstChildren<UseTree> { support::children(&self.syntax) } | 2420 | pub fn use_trees(&self) -> AstChildren<UseTree> { support::children(&self.syntax) } |
2305 | pub fn r_curly(&self) -> Option<RCurly> { support::token(&self.syntax) } | 2421 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
2306 | } | 2422 | } |
2423 | |||
2307 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2424 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2308 | pub struct ExternCrateItem { | 2425 | pub struct ExternCrateItem { |
2309 | pub(crate) syntax: SyntaxNode, | 2426 | pub(crate) syntax: SyntaxNode, |
@@ -2322,11 +2439,12 @@ impl AstNode for ExternCrateItem { | |||
2322 | impl ast::AttrsOwner for ExternCrateItem {} | 2439 | impl ast::AttrsOwner for ExternCrateItem {} |
2323 | impl ast::VisibilityOwner for ExternCrateItem {} | 2440 | impl ast::VisibilityOwner for ExternCrateItem {} |
2324 | impl ExternCrateItem { | 2441 | impl ExternCrateItem { |
2325 | pub fn extern_kw(&self) -> Option<ExternKw> { support::token(&self.syntax) } | 2442 | pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) } |
2326 | pub fn crate_kw(&self) -> Option<CrateKw> { support::token(&self.syntax) } | 2443 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } |
2327 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 2444 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
2328 | pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) } | 2445 | pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) } |
2329 | } | 2446 | } |
2447 | |||
2330 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2448 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2331 | pub struct ArgList { | 2449 | pub struct ArgList { |
2332 | pub(crate) syntax: SyntaxNode, | 2450 | pub(crate) syntax: SyntaxNode, |
@@ -2343,10 +2461,11 @@ impl AstNode for ArgList { | |||
2343 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2461 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2344 | } | 2462 | } |
2345 | impl ArgList { | 2463 | impl ArgList { |
2346 | pub fn l_paren(&self) -> Option<LParen> { support::token(&self.syntax) } | 2464 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
2347 | pub fn args(&self) -> AstChildren<Expr> { support::children(&self.syntax) } | 2465 | pub fn args(&self) -> AstChildren<Expr> { support::children(&self.syntax) } |
2348 | pub fn r_paren(&self) -> Option<RParen> { support::token(&self.syntax) } | 2466 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
2349 | } | 2467 | } |
2468 | |||
2350 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2469 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2351 | pub struct Path { | 2470 | pub struct Path { |
2352 | pub(crate) syntax: SyntaxNode, | 2471 | pub(crate) syntax: SyntaxNode, |
@@ -2366,6 +2485,7 @@ impl Path { | |||
2366 | pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) } | 2485 | pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) } |
2367 | pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) } | 2486 | pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) } |
2368 | } | 2487 | } |
2488 | |||
2369 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2489 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2370 | pub struct PathSegment { | 2490 | pub struct PathSegment { |
2371 | pub(crate) syntax: SyntaxNode, | 2491 | pub(crate) syntax: SyntaxNode, |
@@ -2382,15 +2502,16 @@ impl AstNode for PathSegment { | |||
2382 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2502 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2383 | } | 2503 | } |
2384 | impl PathSegment { | 2504 | impl PathSegment { |
2385 | pub fn coloncolon(&self) -> Option<Coloncolon> { support::token(&self.syntax) } | 2505 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } |
2386 | pub fn l_angle(&self) -> Option<LAngle> { support::token(&self.syntax) } | 2506 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } |
2387 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 2507 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
2388 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } | 2508 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } |
2389 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | 2509 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } |
2390 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | 2510 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } |
2391 | pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) } | 2511 | pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) } |
2392 | pub fn r_angle(&self) -> Option<RAngle> { support::token(&self.syntax) } | 2512 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } |
2393 | } | 2513 | } |
2514 | |||
2394 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2515 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2395 | pub struct TypeArgList { | 2516 | pub struct TypeArgList { |
2396 | pub(crate) syntax: SyntaxNode, | 2517 | pub(crate) syntax: SyntaxNode, |
@@ -2407,15 +2528,16 @@ impl AstNode for TypeArgList { | |||
2407 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2528 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2408 | } | 2529 | } |
2409 | impl TypeArgList { | 2530 | impl TypeArgList { |
2410 | pub fn coloncolon(&self) -> Option<Coloncolon> { support::token(&self.syntax) } | 2531 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } |
2411 | pub fn l_angle(&self) -> Option<LAngle> { support::token(&self.syntax) } | 2532 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } |
2412 | pub fn generic_args(&self) -> AstChildren<GenericArg> { support::children(&self.syntax) } | 2533 | pub fn generic_args(&self) -> AstChildren<GenericArg> { support::children(&self.syntax) } |
2413 | pub fn type_args(&self) -> AstChildren<TypeArg> { support::children(&self.syntax) } | 2534 | pub fn type_args(&self) -> AstChildren<TypeArg> { support::children(&self.syntax) } |
2414 | pub fn lifetime_args(&self) -> AstChildren<LifetimeArg> { support::children(&self.syntax) } | 2535 | pub fn lifetime_args(&self) -> AstChildren<LifetimeArg> { support::children(&self.syntax) } |
2415 | pub fn assoc_type_args(&self) -> AstChildren<AssocTypeArg> { support::children(&self.syntax) } | 2536 | pub fn assoc_type_args(&self) -> AstChildren<AssocTypeArg> { support::children(&self.syntax) } |
2416 | pub fn const_args(&self) -> AstChildren<ConstArg> { support::children(&self.syntax) } | 2537 | pub fn const_args(&self) -> AstChildren<ConstArg> { support::children(&self.syntax) } |
2417 | pub fn r_angle(&self) -> Option<RAngle> { support::token(&self.syntax) } | 2538 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } |
2418 | } | 2539 | } |
2540 | |||
2419 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2541 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2420 | pub struct TypeArg { | 2542 | pub struct TypeArg { |
2421 | pub(crate) syntax: SyntaxNode, | 2543 | pub(crate) syntax: SyntaxNode, |
@@ -2434,6 +2556,7 @@ impl AstNode for TypeArg { | |||
2434 | impl TypeArg { | 2556 | impl TypeArg { |
2435 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 2557 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
2436 | } | 2558 | } |
2559 | |||
2437 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2560 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2438 | pub struct AssocTypeArg { | 2561 | pub struct AssocTypeArg { |
2439 | pub(crate) syntax: SyntaxNode, | 2562 | pub(crate) syntax: SyntaxNode, |
@@ -2452,9 +2575,10 @@ impl AstNode for AssocTypeArg { | |||
2452 | impl ast::TypeBoundsOwner for AssocTypeArg {} | 2575 | impl ast::TypeBoundsOwner for AssocTypeArg {} |
2453 | impl AssocTypeArg { | 2576 | impl AssocTypeArg { |
2454 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 2577 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
2455 | pub fn eq(&self) -> Option<Eq> { support::token(&self.syntax) } | 2578 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
2456 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 2579 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
2457 | } | 2580 | } |
2581 | |||
2458 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2582 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2459 | pub struct LifetimeArg { | 2583 | pub struct LifetimeArg { |
2460 | pub(crate) syntax: SyntaxNode, | 2584 | pub(crate) syntax: SyntaxNode, |
@@ -2471,8 +2595,11 @@ impl AstNode for LifetimeArg { | |||
2471 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2595 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2472 | } | 2596 | } |
2473 | impl LifetimeArg { | 2597 | impl LifetimeArg { |
2474 | pub fn lifetime(&self) -> Option<Lifetime> { support::token(&self.syntax) } | 2598 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
2599 | support::token(&self.syntax, T![lifetime]) | ||
2600 | } | ||
2475 | } | 2601 | } |
2602 | |||
2476 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2603 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2477 | pub struct ConstArg { | 2604 | pub struct ConstArg { |
2478 | pub(crate) syntax: SyntaxNode, | 2605 | pub(crate) syntax: SyntaxNode, |
@@ -2490,9 +2617,10 @@ impl AstNode for ConstArg { | |||
2490 | } | 2617 | } |
2491 | impl ConstArg { | 2618 | impl ConstArg { |
2492 | pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } | 2619 | pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } |
2493 | pub fn eq(&self) -> Option<Eq> { support::token(&self.syntax) } | 2620 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
2494 | pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } | 2621 | pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } |
2495 | } | 2622 | } |
2623 | |||
2496 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2624 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2497 | pub struct MacroItems { | 2625 | pub struct MacroItems { |
2498 | pub(crate) syntax: SyntaxNode, | 2626 | pub(crate) syntax: SyntaxNode, |
@@ -2509,8 +2637,8 @@ impl AstNode for MacroItems { | |||
2509 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2637 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2510 | } | 2638 | } |
2511 | impl ast::ModuleItemOwner for MacroItems {} | 2639 | impl ast::ModuleItemOwner for MacroItems {} |
2512 | impl ast::FnDefOwner for MacroItems {} | ||
2513 | impl MacroItems {} | 2640 | impl MacroItems {} |
2641 | |||
2514 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2642 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2515 | pub struct MacroStmts { | 2643 | pub struct MacroStmts { |
2516 | pub(crate) syntax: SyntaxNode, | 2644 | pub(crate) syntax: SyntaxNode, |
@@ -2530,6 +2658,7 @@ impl MacroStmts { | |||
2530 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } | 2658 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } |
2531 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 2659 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
2532 | } | 2660 | } |
2661 | |||
2533 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2662 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2534 | pub struct ExternItemList { | 2663 | pub struct ExternItemList { |
2535 | pub(crate) syntax: SyntaxNode, | 2664 | pub(crate) syntax: SyntaxNode, |
@@ -2545,13 +2674,13 @@ impl AstNode for ExternItemList { | |||
2545 | } | 2674 | } |
2546 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2675 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2547 | } | 2676 | } |
2548 | impl ast::FnDefOwner for ExternItemList {} | ||
2549 | impl ast::ModuleItemOwner for ExternItemList {} | 2677 | impl ast::ModuleItemOwner for ExternItemList {} |
2550 | impl ExternItemList { | 2678 | impl ExternItemList { |
2551 | pub fn l_curly(&self) -> Option<LCurly> { support::token(&self.syntax) } | 2679 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
2552 | pub fn extern_items(&self) -> AstChildren<ExternItem> { support::children(&self.syntax) } | 2680 | pub fn extern_items(&self) -> AstChildren<ExternItem> { support::children(&self.syntax) } |
2553 | pub fn r_curly(&self) -> Option<RCurly> { support::token(&self.syntax) } | 2681 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
2554 | } | 2682 | } |
2683 | |||
2555 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2684 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2556 | pub struct ExternBlock { | 2685 | pub struct ExternBlock { |
2557 | pub(crate) syntax: SyntaxNode, | 2686 | pub(crate) syntax: SyntaxNode, |
@@ -2571,6 +2700,7 @@ impl ExternBlock { | |||
2571 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } | 2700 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } |
2572 | pub fn extern_item_list(&self) -> Option<ExternItemList> { support::child(&self.syntax) } | 2701 | pub fn extern_item_list(&self) -> Option<ExternItemList> { support::child(&self.syntax) } |
2573 | } | 2702 | } |
2703 | |||
2574 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2704 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2575 | pub struct MetaItem { | 2705 | pub struct MetaItem { |
2576 | pub(crate) syntax: SyntaxNode, | 2706 | pub(crate) syntax: SyntaxNode, |
@@ -2588,10 +2718,11 @@ impl AstNode for MetaItem { | |||
2588 | } | 2718 | } |
2589 | impl MetaItem { | 2719 | impl MetaItem { |
2590 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 2720 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
2591 | pub fn eq(&self) -> Option<Eq> { support::token(&self.syntax) } | 2721 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
2592 | pub fn attr_input(&self) -> Option<AttrInput> { support::child(&self.syntax) } | 2722 | pub fn attr_input(&self) -> Option<AttrInput> { support::child(&self.syntax) } |
2593 | pub fn nested_meta_items(&self) -> AstChildren<MetaItem> { support::children(&self.syntax) } | 2723 | pub fn nested_meta_items(&self) -> AstChildren<MetaItem> { support::children(&self.syntax) } |
2594 | } | 2724 | } |
2725 | |||
2595 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2726 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2596 | pub struct MacroDef { | 2727 | pub struct MacroDef { |
2597 | pub(crate) syntax: SyntaxNode, | 2728 | pub(crate) syntax: SyntaxNode, |
@@ -2611,6 +2742,7 @@ impl MacroDef { | |||
2611 | pub fn name(&self) -> Option<Name> { support::child(&self.syntax) } | 2742 | pub fn name(&self) -> Option<Name> { support::child(&self.syntax) } |
2612 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } | 2743 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } |
2613 | } | 2744 | } |
2745 | |||
2614 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2746 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2615 | pub enum NominalDef { | 2747 | pub enum NominalDef { |
2616 | StructDef(StructDef), | 2748 | StructDef(StructDef), |
@@ -2653,6 +2785,7 @@ impl AstNode for NominalDef { | |||
2653 | impl ast::NameOwner for NominalDef {} | 2785 | impl ast::NameOwner for NominalDef {} |
2654 | impl ast::TypeParamsOwner for NominalDef {} | 2786 | impl ast::TypeParamsOwner for NominalDef {} |
2655 | impl ast::AttrsOwner for NominalDef {} | 2787 | impl ast::AttrsOwner for NominalDef {} |
2788 | |||
2656 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2789 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2657 | pub enum GenericParam { | 2790 | pub enum GenericParam { |
2658 | LifetimeParam(LifetimeParam), | 2791 | LifetimeParam(LifetimeParam), |
@@ -2692,6 +2825,7 @@ impl AstNode for GenericParam { | |||
2692 | } | 2825 | } |
2693 | } | 2826 | } |
2694 | } | 2827 | } |
2828 | |||
2695 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2829 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2696 | pub enum GenericArg { | 2830 | pub enum GenericArg { |
2697 | LifetimeArg(LifetimeArg), | 2831 | LifetimeArg(LifetimeArg), |
@@ -2737,6 +2871,7 @@ impl AstNode for GenericArg { | |||
2737 | } | 2871 | } |
2738 | } | 2872 | } |
2739 | } | 2873 | } |
2874 | |||
2740 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2875 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2741 | pub enum TypeRef { | 2876 | pub enum TypeRef { |
2742 | ParenType(ParenType), | 2877 | ParenType(ParenType), |
@@ -2838,6 +2973,7 @@ impl AstNode for TypeRef { | |||
2838 | } | 2973 | } |
2839 | } | 2974 | } |
2840 | } | 2975 | } |
2976 | |||
2841 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2977 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2842 | pub enum ModuleItem { | 2978 | pub enum ModuleItem { |
2843 | StructDef(StructDef), | 2979 | StructDef(StructDef), |
@@ -2948,6 +3084,7 @@ impl AstNode for ModuleItem { | |||
2948 | impl ast::NameOwner for ModuleItem {} | 3084 | impl ast::NameOwner for ModuleItem {} |
2949 | impl ast::AttrsOwner for ModuleItem {} | 3085 | impl ast::AttrsOwner for ModuleItem {} |
2950 | impl ast::VisibilityOwner for ModuleItem {} | 3086 | impl ast::VisibilityOwner for ModuleItem {} |
3087 | |||
2951 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3088 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2952 | pub enum ImplItem { | 3089 | pub enum ImplItem { |
2953 | FnDef(FnDef), | 3090 | FnDef(FnDef), |
@@ -2989,6 +3126,7 @@ impl AstNode for ImplItem { | |||
2989 | } | 3126 | } |
2990 | impl ast::NameOwner for ImplItem {} | 3127 | impl ast::NameOwner for ImplItem {} |
2991 | impl ast::AttrsOwner for ImplItem {} | 3128 | impl ast::AttrsOwner for ImplItem {} |
3129 | |||
2992 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3130 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2993 | pub enum ExternItem { | 3131 | pub enum ExternItem { |
2994 | FnDef(FnDef), | 3132 | FnDef(FnDef), |
@@ -3025,6 +3163,7 @@ impl AstNode for ExternItem { | |||
3025 | impl ast::NameOwner for ExternItem {} | 3163 | impl ast::NameOwner for ExternItem {} |
3026 | impl ast::AttrsOwner for ExternItem {} | 3164 | impl ast::AttrsOwner for ExternItem {} |
3027 | impl ast::VisibilityOwner for ExternItem {} | 3165 | impl ast::VisibilityOwner for ExternItem {} |
3166 | |||
3028 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3167 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3029 | pub enum Expr { | 3168 | pub enum Expr { |
3030 | TupleExpr(TupleExpr), | 3169 | TupleExpr(TupleExpr), |
@@ -3238,6 +3377,7 @@ impl AstNode for Expr { | |||
3238 | } | 3377 | } |
3239 | } | 3378 | } |
3240 | impl ast::AttrsOwner for Expr {} | 3379 | impl ast::AttrsOwner for Expr {} |
3380 | |||
3241 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3381 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3242 | pub enum Pat { | 3382 | pub enum Pat { |
3243 | OrPat(OrPat), | 3383 | OrPat(OrPat), |
@@ -3351,6 +3491,7 @@ impl AstNode for Pat { | |||
3351 | } | 3491 | } |
3352 | } | 3492 | } |
3353 | } | 3493 | } |
3494 | |||
3354 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3495 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3355 | pub enum RecordInnerPat { | 3496 | pub enum RecordInnerPat { |
3356 | RecordFieldPat(RecordFieldPat), | 3497 | RecordFieldPat(RecordFieldPat), |
@@ -3384,6 +3525,7 @@ impl AstNode for RecordInnerPat { | |||
3384 | } | 3525 | } |
3385 | } | 3526 | } |
3386 | } | 3527 | } |
3528 | |||
3387 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3529 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3388 | pub enum AttrInput { | 3530 | pub enum AttrInput { |
3389 | Literal(Literal), | 3531 | Literal(Literal), |
@@ -3417,6 +3559,7 @@ impl AstNode for AttrInput { | |||
3417 | } | 3559 | } |
3418 | } | 3560 | } |
3419 | } | 3561 | } |
3562 | |||
3420 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3563 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3421 | pub enum Stmt { | 3564 | pub enum Stmt { |
3422 | LetStmt(LetStmt), | 3565 | LetStmt(LetStmt), |
@@ -3450,6 +3593,7 @@ impl AstNode for Stmt { | |||
3450 | } | 3593 | } |
3451 | } | 3594 | } |
3452 | } | 3595 | } |
3596 | |||
3453 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3597 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3454 | pub enum FieldDefList { | 3598 | pub enum FieldDefList { |
3455 | RecordFieldDefList(RecordFieldDefList), | 3599 | RecordFieldDefList(RecordFieldDefList), |
diff --git a/crates/ra_syntax/src/ast/generated/tokens.rs b/crates/ra_syntax/src/ast/generated/tokens.rs index e64b8bce6..f91befaac 100644 --- a/crates/ra_syntax/src/ast/generated/tokens.rs +++ b/crates/ra_syntax/src/ast/generated/tokens.rs | |||
@@ -5,2146 +5,7 @@ use crate::{ | |||
5 | SyntaxKind::{self, *}, | 5 | SyntaxKind::{self, *}, |
6 | SyntaxToken, | 6 | SyntaxToken, |
7 | }; | 7 | }; |
8 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 8 | |
9 | pub struct Semi { | ||
10 | pub(crate) syntax: SyntaxToken, | ||
11 | } | ||
12 | impl std::fmt::Display for Semi { | ||
13 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
14 | std::fmt::Display::fmt(&self.syntax, f) | ||
15 | } | ||
16 | } | ||
17 | impl AstToken for Semi { | ||
18 | fn can_cast(kind: SyntaxKind) -> bool { kind == SEMI } | ||
19 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
20 | if Self::can_cast(syntax.kind()) { | ||
21 | Some(Self { syntax }) | ||
22 | } else { | ||
23 | None | ||
24 | } | ||
25 | } | ||
26 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
27 | } | ||
28 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
29 | pub struct Comma { | ||
30 | pub(crate) syntax: SyntaxToken, | ||
31 | } | ||
32 | impl std::fmt::Display for Comma { | ||
33 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
34 | std::fmt::Display::fmt(&self.syntax, f) | ||
35 | } | ||
36 | } | ||
37 | impl AstToken for Comma { | ||
38 | fn can_cast(kind: SyntaxKind) -> bool { kind == COMMA } | ||
39 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
40 | if Self::can_cast(syntax.kind()) { | ||
41 | Some(Self { syntax }) | ||
42 | } else { | ||
43 | None | ||
44 | } | ||
45 | } | ||
46 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
47 | } | ||
48 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
49 | pub struct LParen { | ||
50 | pub(crate) syntax: SyntaxToken, | ||
51 | } | ||
52 | impl std::fmt::Display for LParen { | ||
53 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
54 | std::fmt::Display::fmt(&self.syntax, f) | ||
55 | } | ||
56 | } | ||
57 | impl AstToken for LParen { | ||
58 | fn can_cast(kind: SyntaxKind) -> bool { kind == L_PAREN } | ||
59 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
60 | if Self::can_cast(syntax.kind()) { | ||
61 | Some(Self { syntax }) | ||
62 | } else { | ||
63 | None | ||
64 | } | ||
65 | } | ||
66 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
67 | } | ||
68 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
69 | pub struct RParen { | ||
70 | pub(crate) syntax: SyntaxToken, | ||
71 | } | ||
72 | impl std::fmt::Display for RParen { | ||
73 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
74 | std::fmt::Display::fmt(&self.syntax, f) | ||
75 | } | ||
76 | } | ||
77 | impl AstToken for RParen { | ||
78 | fn can_cast(kind: SyntaxKind) -> bool { kind == R_PAREN } | ||
79 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
80 | if Self::can_cast(syntax.kind()) { | ||
81 | Some(Self { syntax }) | ||
82 | } else { | ||
83 | None | ||
84 | } | ||
85 | } | ||
86 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
87 | } | ||
88 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
89 | pub struct LCurly { | ||
90 | pub(crate) syntax: SyntaxToken, | ||
91 | } | ||
92 | impl std::fmt::Display for LCurly { | ||
93 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
94 | std::fmt::Display::fmt(&self.syntax, f) | ||
95 | } | ||
96 | } | ||
97 | impl AstToken for LCurly { | ||
98 | fn can_cast(kind: SyntaxKind) -> bool { kind == L_CURLY } | ||
99 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
100 | if Self::can_cast(syntax.kind()) { | ||
101 | Some(Self { syntax }) | ||
102 | } else { | ||
103 | None | ||
104 | } | ||
105 | } | ||
106 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
107 | } | ||
108 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
109 | pub struct RCurly { | ||
110 | pub(crate) syntax: SyntaxToken, | ||
111 | } | ||
112 | impl std::fmt::Display for RCurly { | ||
113 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
114 | std::fmt::Display::fmt(&self.syntax, f) | ||
115 | } | ||
116 | } | ||
117 | impl AstToken for RCurly { | ||
118 | fn can_cast(kind: SyntaxKind) -> bool { kind == R_CURLY } | ||
119 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
120 | if Self::can_cast(syntax.kind()) { | ||
121 | Some(Self { syntax }) | ||
122 | } else { | ||
123 | None | ||
124 | } | ||
125 | } | ||
126 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
127 | } | ||
128 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
129 | pub struct LBrack { | ||
130 | pub(crate) syntax: SyntaxToken, | ||
131 | } | ||
132 | impl std::fmt::Display for LBrack { | ||
133 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
134 | std::fmt::Display::fmt(&self.syntax, f) | ||
135 | } | ||
136 | } | ||
137 | impl AstToken for LBrack { | ||
138 | fn can_cast(kind: SyntaxKind) -> bool { kind == L_BRACK } | ||
139 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
140 | if Self::can_cast(syntax.kind()) { | ||
141 | Some(Self { syntax }) | ||
142 | } else { | ||
143 | None | ||
144 | } | ||
145 | } | ||
146 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
147 | } | ||
148 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
149 | pub struct RBrack { | ||
150 | pub(crate) syntax: SyntaxToken, | ||
151 | } | ||
152 | impl std::fmt::Display for RBrack { | ||
153 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
154 | std::fmt::Display::fmt(&self.syntax, f) | ||
155 | } | ||
156 | } | ||
157 | impl AstToken for RBrack { | ||
158 | fn can_cast(kind: SyntaxKind) -> bool { kind == R_BRACK } | ||
159 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
160 | if Self::can_cast(syntax.kind()) { | ||
161 | Some(Self { syntax }) | ||
162 | } else { | ||
163 | None | ||
164 | } | ||
165 | } | ||
166 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
167 | } | ||
168 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
169 | pub struct LAngle { | ||
170 | pub(crate) syntax: SyntaxToken, | ||
171 | } | ||
172 | impl std::fmt::Display for LAngle { | ||
173 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
174 | std::fmt::Display::fmt(&self.syntax, f) | ||
175 | } | ||
176 | } | ||
177 | impl AstToken for LAngle { | ||
178 | fn can_cast(kind: SyntaxKind) -> bool { kind == L_ANGLE } | ||
179 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
180 | if Self::can_cast(syntax.kind()) { | ||
181 | Some(Self { syntax }) | ||
182 | } else { | ||
183 | None | ||
184 | } | ||
185 | } | ||
186 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
187 | } | ||
188 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
189 | pub struct RAngle { | ||
190 | pub(crate) syntax: SyntaxToken, | ||
191 | } | ||
192 | impl std::fmt::Display for RAngle { | ||
193 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
194 | std::fmt::Display::fmt(&self.syntax, f) | ||
195 | } | ||
196 | } | ||
197 | impl AstToken for RAngle { | ||
198 | fn can_cast(kind: SyntaxKind) -> bool { kind == R_ANGLE } | ||
199 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
200 | if Self::can_cast(syntax.kind()) { | ||
201 | Some(Self { syntax }) | ||
202 | } else { | ||
203 | None | ||
204 | } | ||
205 | } | ||
206 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
207 | } | ||
208 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
209 | pub struct At { | ||
210 | pub(crate) syntax: SyntaxToken, | ||
211 | } | ||
212 | impl std::fmt::Display for At { | ||
213 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
214 | std::fmt::Display::fmt(&self.syntax, f) | ||
215 | } | ||
216 | } | ||
217 | impl AstToken for At { | ||
218 | fn can_cast(kind: SyntaxKind) -> bool { kind == AT } | ||
219 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
220 | if Self::can_cast(syntax.kind()) { | ||
221 | Some(Self { syntax }) | ||
222 | } else { | ||
223 | None | ||
224 | } | ||
225 | } | ||
226 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
227 | } | ||
228 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
229 | pub struct Pound { | ||
230 | pub(crate) syntax: SyntaxToken, | ||
231 | } | ||
232 | impl std::fmt::Display for Pound { | ||
233 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
234 | std::fmt::Display::fmt(&self.syntax, f) | ||
235 | } | ||
236 | } | ||
237 | impl AstToken for Pound { | ||
238 | fn can_cast(kind: SyntaxKind) -> bool { kind == POUND } | ||
239 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
240 | if Self::can_cast(syntax.kind()) { | ||
241 | Some(Self { syntax }) | ||
242 | } else { | ||
243 | None | ||
244 | } | ||
245 | } | ||
246 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
247 | } | ||
248 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
249 | pub struct Tilde { | ||
250 | pub(crate) syntax: SyntaxToken, | ||
251 | } | ||
252 | impl std::fmt::Display for Tilde { | ||
253 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
254 | std::fmt::Display::fmt(&self.syntax, f) | ||
255 | } | ||
256 | } | ||
257 | impl AstToken for Tilde { | ||
258 | fn can_cast(kind: SyntaxKind) -> bool { kind == TILDE } | ||
259 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
260 | if Self::can_cast(syntax.kind()) { | ||
261 | Some(Self { syntax }) | ||
262 | } else { | ||
263 | None | ||
264 | } | ||
265 | } | ||
266 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
267 | } | ||
268 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
269 | pub struct Question { | ||
270 | pub(crate) syntax: SyntaxToken, | ||
271 | } | ||
272 | impl std::fmt::Display for Question { | ||
273 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
274 | std::fmt::Display::fmt(&self.syntax, f) | ||
275 | } | ||
276 | } | ||
277 | impl AstToken for Question { | ||
278 | fn can_cast(kind: SyntaxKind) -> bool { kind == QUESTION } | ||
279 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
280 | if Self::can_cast(syntax.kind()) { | ||
281 | Some(Self { syntax }) | ||
282 | } else { | ||
283 | None | ||
284 | } | ||
285 | } | ||
286 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
287 | } | ||
288 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
289 | pub struct Dollar { | ||
290 | pub(crate) syntax: SyntaxToken, | ||
291 | } | ||
292 | impl std::fmt::Display for Dollar { | ||
293 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
294 | std::fmt::Display::fmt(&self.syntax, f) | ||
295 | } | ||
296 | } | ||
297 | impl AstToken for Dollar { | ||
298 | fn can_cast(kind: SyntaxKind) -> bool { kind == DOLLAR } | ||
299 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
300 | if Self::can_cast(syntax.kind()) { | ||
301 | Some(Self { syntax }) | ||
302 | } else { | ||
303 | None | ||
304 | } | ||
305 | } | ||
306 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
307 | } | ||
308 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
309 | pub struct Amp { | ||
310 | pub(crate) syntax: SyntaxToken, | ||
311 | } | ||
312 | impl std::fmt::Display for Amp { | ||
313 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
314 | std::fmt::Display::fmt(&self.syntax, f) | ||
315 | } | ||
316 | } | ||
317 | impl AstToken for Amp { | ||
318 | fn can_cast(kind: SyntaxKind) -> bool { kind == AMP } | ||
319 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
320 | if Self::can_cast(syntax.kind()) { | ||
321 | Some(Self { syntax }) | ||
322 | } else { | ||
323 | None | ||
324 | } | ||
325 | } | ||
326 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
327 | } | ||
328 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
329 | pub struct Pipe { | ||
330 | pub(crate) syntax: SyntaxToken, | ||
331 | } | ||
332 | impl std::fmt::Display for Pipe { | ||
333 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
334 | std::fmt::Display::fmt(&self.syntax, f) | ||
335 | } | ||
336 | } | ||
337 | impl AstToken for Pipe { | ||
338 | fn can_cast(kind: SyntaxKind) -> bool { kind == PIPE } | ||
339 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
340 | if Self::can_cast(syntax.kind()) { | ||
341 | Some(Self { syntax }) | ||
342 | } else { | ||
343 | None | ||
344 | } | ||
345 | } | ||
346 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
347 | } | ||
348 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
349 | pub struct Plus { | ||
350 | pub(crate) syntax: SyntaxToken, | ||
351 | } | ||
352 | impl std::fmt::Display for Plus { | ||
353 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
354 | std::fmt::Display::fmt(&self.syntax, f) | ||
355 | } | ||
356 | } | ||
357 | impl AstToken for Plus { | ||
358 | fn can_cast(kind: SyntaxKind) -> bool { kind == PLUS } | ||
359 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
360 | if Self::can_cast(syntax.kind()) { | ||
361 | Some(Self { syntax }) | ||
362 | } else { | ||
363 | None | ||
364 | } | ||
365 | } | ||
366 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
367 | } | ||
368 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
369 | pub struct Star { | ||
370 | pub(crate) syntax: SyntaxToken, | ||
371 | } | ||
372 | impl std::fmt::Display for Star { | ||
373 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
374 | std::fmt::Display::fmt(&self.syntax, f) | ||
375 | } | ||
376 | } | ||
377 | impl AstToken for Star { | ||
378 | fn can_cast(kind: SyntaxKind) -> bool { kind == STAR } | ||
379 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
380 | if Self::can_cast(syntax.kind()) { | ||
381 | Some(Self { syntax }) | ||
382 | } else { | ||
383 | None | ||
384 | } | ||
385 | } | ||
386 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
387 | } | ||
388 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
389 | pub struct Slash { | ||
390 | pub(crate) syntax: SyntaxToken, | ||
391 | } | ||
392 | impl std::fmt::Display for Slash { | ||
393 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
394 | std::fmt::Display::fmt(&self.syntax, f) | ||
395 | } | ||
396 | } | ||
397 | impl AstToken for Slash { | ||
398 | fn can_cast(kind: SyntaxKind) -> bool { kind == SLASH } | ||
399 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
400 | if Self::can_cast(syntax.kind()) { | ||
401 | Some(Self { syntax }) | ||
402 | } else { | ||
403 | None | ||
404 | } | ||
405 | } | ||
406 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
407 | } | ||
408 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
409 | pub struct Caret { | ||
410 | pub(crate) syntax: SyntaxToken, | ||
411 | } | ||
412 | impl std::fmt::Display for Caret { | ||
413 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
414 | std::fmt::Display::fmt(&self.syntax, f) | ||
415 | } | ||
416 | } | ||
417 | impl AstToken for Caret { | ||
418 | fn can_cast(kind: SyntaxKind) -> bool { kind == CARET } | ||
419 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
420 | if Self::can_cast(syntax.kind()) { | ||
421 | Some(Self { syntax }) | ||
422 | } else { | ||
423 | None | ||
424 | } | ||
425 | } | ||
426 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
427 | } | ||
428 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
429 | pub struct Percent { | ||
430 | pub(crate) syntax: SyntaxToken, | ||
431 | } | ||
432 | impl std::fmt::Display for Percent { | ||
433 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
434 | std::fmt::Display::fmt(&self.syntax, f) | ||
435 | } | ||
436 | } | ||
437 | impl AstToken for Percent { | ||
438 | fn can_cast(kind: SyntaxKind) -> bool { kind == PERCENT } | ||
439 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
440 | if Self::can_cast(syntax.kind()) { | ||
441 | Some(Self { syntax }) | ||
442 | } else { | ||
443 | None | ||
444 | } | ||
445 | } | ||
446 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
447 | } | ||
448 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
449 | pub struct Underscore { | ||
450 | pub(crate) syntax: SyntaxToken, | ||
451 | } | ||
452 | impl std::fmt::Display for Underscore { | ||
453 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
454 | std::fmt::Display::fmt(&self.syntax, f) | ||
455 | } | ||
456 | } | ||
457 | impl AstToken for Underscore { | ||
458 | fn can_cast(kind: SyntaxKind) -> bool { kind == UNDERSCORE } | ||
459 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
460 | if Self::can_cast(syntax.kind()) { | ||
461 | Some(Self { syntax }) | ||
462 | } else { | ||
463 | None | ||
464 | } | ||
465 | } | ||
466 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
467 | } | ||
468 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
469 | pub struct Dot { | ||
470 | pub(crate) syntax: SyntaxToken, | ||
471 | } | ||
472 | impl std::fmt::Display for Dot { | ||
473 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
474 | std::fmt::Display::fmt(&self.syntax, f) | ||
475 | } | ||
476 | } | ||
477 | impl AstToken for Dot { | ||
478 | fn can_cast(kind: SyntaxKind) -> bool { kind == DOT } | ||
479 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
480 | if Self::can_cast(syntax.kind()) { | ||
481 | Some(Self { syntax }) | ||
482 | } else { | ||
483 | None | ||
484 | } | ||
485 | } | ||
486 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
487 | } | ||
488 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
489 | pub struct Dotdot { | ||
490 | pub(crate) syntax: SyntaxToken, | ||
491 | } | ||
492 | impl std::fmt::Display for Dotdot { | ||
493 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
494 | std::fmt::Display::fmt(&self.syntax, f) | ||
495 | } | ||
496 | } | ||
497 | impl AstToken for Dotdot { | ||
498 | fn can_cast(kind: SyntaxKind) -> bool { kind == DOTDOT } | ||
499 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
500 | if Self::can_cast(syntax.kind()) { | ||
501 | Some(Self { syntax }) | ||
502 | } else { | ||
503 | None | ||
504 | } | ||
505 | } | ||
506 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
507 | } | ||
508 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
509 | pub struct Dotdotdot { | ||
510 | pub(crate) syntax: SyntaxToken, | ||
511 | } | ||
512 | impl std::fmt::Display for Dotdotdot { | ||
513 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
514 | std::fmt::Display::fmt(&self.syntax, f) | ||
515 | } | ||
516 | } | ||
517 | impl AstToken for Dotdotdot { | ||
518 | fn can_cast(kind: SyntaxKind) -> bool { kind == DOTDOTDOT } | ||
519 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
520 | if Self::can_cast(syntax.kind()) { | ||
521 | Some(Self { syntax }) | ||
522 | } else { | ||
523 | None | ||
524 | } | ||
525 | } | ||
526 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
527 | } | ||
528 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
529 | pub struct Dotdoteq { | ||
530 | pub(crate) syntax: SyntaxToken, | ||
531 | } | ||
532 | impl std::fmt::Display for Dotdoteq { | ||
533 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
534 | std::fmt::Display::fmt(&self.syntax, f) | ||
535 | } | ||
536 | } | ||
537 | impl AstToken for Dotdoteq { | ||
538 | fn can_cast(kind: SyntaxKind) -> bool { kind == DOTDOTEQ } | ||
539 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
540 | if Self::can_cast(syntax.kind()) { | ||
541 | Some(Self { syntax }) | ||
542 | } else { | ||
543 | None | ||
544 | } | ||
545 | } | ||
546 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
547 | } | ||
548 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
549 | pub struct Colon { | ||
550 | pub(crate) syntax: SyntaxToken, | ||
551 | } | ||
552 | impl std::fmt::Display for Colon { | ||
553 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
554 | std::fmt::Display::fmt(&self.syntax, f) | ||
555 | } | ||
556 | } | ||
557 | impl AstToken for Colon { | ||
558 | fn can_cast(kind: SyntaxKind) -> bool { kind == COLON } | ||
559 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
560 | if Self::can_cast(syntax.kind()) { | ||
561 | Some(Self { syntax }) | ||
562 | } else { | ||
563 | None | ||
564 | } | ||
565 | } | ||
566 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
567 | } | ||
568 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
569 | pub struct Coloncolon { | ||
570 | pub(crate) syntax: SyntaxToken, | ||
571 | } | ||
572 | impl std::fmt::Display for Coloncolon { | ||
573 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
574 | std::fmt::Display::fmt(&self.syntax, f) | ||
575 | } | ||
576 | } | ||
577 | impl AstToken for Coloncolon { | ||
578 | fn can_cast(kind: SyntaxKind) -> bool { kind == COLONCOLON } | ||
579 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
580 | if Self::can_cast(syntax.kind()) { | ||
581 | Some(Self { syntax }) | ||
582 | } else { | ||
583 | None | ||
584 | } | ||
585 | } | ||
586 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
587 | } | ||
588 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
589 | pub struct Eq { | ||
590 | pub(crate) syntax: SyntaxToken, | ||
591 | } | ||
592 | impl std::fmt::Display for Eq { | ||
593 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
594 | std::fmt::Display::fmt(&self.syntax, f) | ||
595 | } | ||
596 | } | ||
597 | impl AstToken for Eq { | ||
598 | fn can_cast(kind: SyntaxKind) -> bool { kind == EQ } | ||
599 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
600 | if Self::can_cast(syntax.kind()) { | ||
601 | Some(Self { syntax }) | ||
602 | } else { | ||
603 | None | ||
604 | } | ||
605 | } | ||
606 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
607 | } | ||
608 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
609 | pub struct Eqeq { | ||
610 | pub(crate) syntax: SyntaxToken, | ||
611 | } | ||
612 | impl std::fmt::Display for Eqeq { | ||
613 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
614 | std::fmt::Display::fmt(&self.syntax, f) | ||
615 | } | ||
616 | } | ||
617 | impl AstToken for Eqeq { | ||
618 | fn can_cast(kind: SyntaxKind) -> bool { kind == EQEQ } | ||
619 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
620 | if Self::can_cast(syntax.kind()) { | ||
621 | Some(Self { syntax }) | ||
622 | } else { | ||
623 | None | ||
624 | } | ||
625 | } | ||
626 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
627 | } | ||
628 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
629 | pub struct FatArrow { | ||
630 | pub(crate) syntax: SyntaxToken, | ||
631 | } | ||
632 | impl std::fmt::Display for FatArrow { | ||
633 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
634 | std::fmt::Display::fmt(&self.syntax, f) | ||
635 | } | ||
636 | } | ||
637 | impl AstToken for FatArrow { | ||
638 | fn can_cast(kind: SyntaxKind) -> bool { kind == FAT_ARROW } | ||
639 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
640 | if Self::can_cast(syntax.kind()) { | ||
641 | Some(Self { syntax }) | ||
642 | } else { | ||
643 | None | ||
644 | } | ||
645 | } | ||
646 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
647 | } | ||
648 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
649 | pub struct Excl { | ||
650 | pub(crate) syntax: SyntaxToken, | ||
651 | } | ||
652 | impl std::fmt::Display for Excl { | ||
653 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
654 | std::fmt::Display::fmt(&self.syntax, f) | ||
655 | } | ||
656 | } | ||
657 | impl AstToken for Excl { | ||
658 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXCL } | ||
659 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
660 | if Self::can_cast(syntax.kind()) { | ||
661 | Some(Self { syntax }) | ||
662 | } else { | ||
663 | None | ||
664 | } | ||
665 | } | ||
666 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
667 | } | ||
668 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
669 | pub struct Neq { | ||
670 | pub(crate) syntax: SyntaxToken, | ||
671 | } | ||
672 | impl std::fmt::Display for Neq { | ||
673 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
674 | std::fmt::Display::fmt(&self.syntax, f) | ||
675 | } | ||
676 | } | ||
677 | impl AstToken for Neq { | ||
678 | fn can_cast(kind: SyntaxKind) -> bool { kind == NEQ } | ||
679 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
680 | if Self::can_cast(syntax.kind()) { | ||
681 | Some(Self { syntax }) | ||
682 | } else { | ||
683 | None | ||
684 | } | ||
685 | } | ||
686 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
687 | } | ||
688 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
689 | pub struct Minus { | ||
690 | pub(crate) syntax: SyntaxToken, | ||
691 | } | ||
692 | impl std::fmt::Display for Minus { | ||
693 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
694 | std::fmt::Display::fmt(&self.syntax, f) | ||
695 | } | ||
696 | } | ||
697 | impl AstToken for Minus { | ||
698 | fn can_cast(kind: SyntaxKind) -> bool { kind == MINUS } | ||
699 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
700 | if Self::can_cast(syntax.kind()) { | ||
701 | Some(Self { syntax }) | ||
702 | } else { | ||
703 | None | ||
704 | } | ||
705 | } | ||
706 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
707 | } | ||
708 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
709 | pub struct ThinArrow { | ||
710 | pub(crate) syntax: SyntaxToken, | ||
711 | } | ||
712 | impl std::fmt::Display for ThinArrow { | ||
713 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
714 | std::fmt::Display::fmt(&self.syntax, f) | ||
715 | } | ||
716 | } | ||
717 | impl AstToken for ThinArrow { | ||
718 | fn can_cast(kind: SyntaxKind) -> bool { kind == THIN_ARROW } | ||
719 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
720 | if Self::can_cast(syntax.kind()) { | ||
721 | Some(Self { syntax }) | ||
722 | } else { | ||
723 | None | ||
724 | } | ||
725 | } | ||
726 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
727 | } | ||
728 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
729 | pub struct Lteq { | ||
730 | pub(crate) syntax: SyntaxToken, | ||
731 | } | ||
732 | impl std::fmt::Display for Lteq { | ||
733 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
734 | std::fmt::Display::fmt(&self.syntax, f) | ||
735 | } | ||
736 | } | ||
737 | impl AstToken for Lteq { | ||
738 | fn can_cast(kind: SyntaxKind) -> bool { kind == LTEQ } | ||
739 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
740 | if Self::can_cast(syntax.kind()) { | ||
741 | Some(Self { syntax }) | ||
742 | } else { | ||
743 | None | ||
744 | } | ||
745 | } | ||
746 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
747 | } | ||
748 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
749 | pub struct Gteq { | ||
750 | pub(crate) syntax: SyntaxToken, | ||
751 | } | ||
752 | impl std::fmt::Display for Gteq { | ||
753 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
754 | std::fmt::Display::fmt(&self.syntax, f) | ||
755 | } | ||
756 | } | ||
757 | impl AstToken for Gteq { | ||
758 | fn can_cast(kind: SyntaxKind) -> bool { kind == GTEQ } | ||
759 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
760 | if Self::can_cast(syntax.kind()) { | ||
761 | Some(Self { syntax }) | ||
762 | } else { | ||
763 | None | ||
764 | } | ||
765 | } | ||
766 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
767 | } | ||
768 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
769 | pub struct Pluseq { | ||
770 | pub(crate) syntax: SyntaxToken, | ||
771 | } | ||
772 | impl std::fmt::Display for Pluseq { | ||
773 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
774 | std::fmt::Display::fmt(&self.syntax, f) | ||
775 | } | ||
776 | } | ||
777 | impl AstToken for Pluseq { | ||
778 | fn can_cast(kind: SyntaxKind) -> bool { kind == PLUSEQ } | ||
779 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
780 | if Self::can_cast(syntax.kind()) { | ||
781 | Some(Self { syntax }) | ||
782 | } else { | ||
783 | None | ||
784 | } | ||
785 | } | ||
786 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
787 | } | ||
788 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
789 | pub struct Minuseq { | ||
790 | pub(crate) syntax: SyntaxToken, | ||
791 | } | ||
792 | impl std::fmt::Display for Minuseq { | ||
793 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
794 | std::fmt::Display::fmt(&self.syntax, f) | ||
795 | } | ||
796 | } | ||
797 | impl AstToken for Minuseq { | ||
798 | fn can_cast(kind: SyntaxKind) -> bool { kind == MINUSEQ } | ||
799 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
800 | if Self::can_cast(syntax.kind()) { | ||
801 | Some(Self { syntax }) | ||
802 | } else { | ||
803 | None | ||
804 | } | ||
805 | } | ||
806 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
807 | } | ||
808 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
809 | pub struct Pipeeq { | ||
810 | pub(crate) syntax: SyntaxToken, | ||
811 | } | ||
812 | impl std::fmt::Display for Pipeeq { | ||
813 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
814 | std::fmt::Display::fmt(&self.syntax, f) | ||
815 | } | ||
816 | } | ||
817 | impl AstToken for Pipeeq { | ||
818 | fn can_cast(kind: SyntaxKind) -> bool { kind == PIPEEQ } | ||
819 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
820 | if Self::can_cast(syntax.kind()) { | ||
821 | Some(Self { syntax }) | ||
822 | } else { | ||
823 | None | ||
824 | } | ||
825 | } | ||
826 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
827 | } | ||
828 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
829 | pub struct Ampeq { | ||
830 | pub(crate) syntax: SyntaxToken, | ||
831 | } | ||
832 | impl std::fmt::Display for Ampeq { | ||
833 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
834 | std::fmt::Display::fmt(&self.syntax, f) | ||
835 | } | ||
836 | } | ||
837 | impl AstToken for Ampeq { | ||
838 | fn can_cast(kind: SyntaxKind) -> bool { kind == AMPEQ } | ||
839 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
840 | if Self::can_cast(syntax.kind()) { | ||
841 | Some(Self { syntax }) | ||
842 | } else { | ||
843 | None | ||
844 | } | ||
845 | } | ||
846 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
847 | } | ||
848 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
849 | pub struct Careteq { | ||
850 | pub(crate) syntax: SyntaxToken, | ||
851 | } | ||
852 | impl std::fmt::Display for Careteq { | ||
853 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
854 | std::fmt::Display::fmt(&self.syntax, f) | ||
855 | } | ||
856 | } | ||
857 | impl AstToken for Careteq { | ||
858 | fn can_cast(kind: SyntaxKind) -> bool { kind == CARETEQ } | ||
859 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
860 | if Self::can_cast(syntax.kind()) { | ||
861 | Some(Self { syntax }) | ||
862 | } else { | ||
863 | None | ||
864 | } | ||
865 | } | ||
866 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
867 | } | ||
868 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
869 | pub struct Slasheq { | ||
870 | pub(crate) syntax: SyntaxToken, | ||
871 | } | ||
872 | impl std::fmt::Display for Slasheq { | ||
873 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
874 | std::fmt::Display::fmt(&self.syntax, f) | ||
875 | } | ||
876 | } | ||
877 | impl AstToken for Slasheq { | ||
878 | fn can_cast(kind: SyntaxKind) -> bool { kind == SLASHEQ } | ||
879 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
880 | if Self::can_cast(syntax.kind()) { | ||
881 | Some(Self { syntax }) | ||
882 | } else { | ||
883 | None | ||
884 | } | ||
885 | } | ||
886 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
887 | } | ||
888 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
889 | pub struct Stareq { | ||
890 | pub(crate) syntax: SyntaxToken, | ||
891 | } | ||
892 | impl std::fmt::Display for Stareq { | ||
893 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
894 | std::fmt::Display::fmt(&self.syntax, f) | ||
895 | } | ||
896 | } | ||
897 | impl AstToken for Stareq { | ||
898 | fn can_cast(kind: SyntaxKind) -> bool { kind == STAREQ } | ||
899 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
900 | if Self::can_cast(syntax.kind()) { | ||
901 | Some(Self { syntax }) | ||
902 | } else { | ||
903 | None | ||
904 | } | ||
905 | } | ||
906 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
907 | } | ||
908 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
909 | pub struct Percenteq { | ||
910 | pub(crate) syntax: SyntaxToken, | ||
911 | } | ||
912 | impl std::fmt::Display for Percenteq { | ||
913 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
914 | std::fmt::Display::fmt(&self.syntax, f) | ||
915 | } | ||
916 | } | ||
917 | impl AstToken for Percenteq { | ||
918 | fn can_cast(kind: SyntaxKind) -> bool { kind == PERCENTEQ } | ||
919 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
920 | if Self::can_cast(syntax.kind()) { | ||
921 | Some(Self { syntax }) | ||
922 | } else { | ||
923 | None | ||
924 | } | ||
925 | } | ||
926 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
927 | } | ||
928 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
929 | pub struct Ampamp { | ||
930 | pub(crate) syntax: SyntaxToken, | ||
931 | } | ||
932 | impl std::fmt::Display for Ampamp { | ||
933 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
934 | std::fmt::Display::fmt(&self.syntax, f) | ||
935 | } | ||
936 | } | ||
937 | impl AstToken for Ampamp { | ||
938 | fn can_cast(kind: SyntaxKind) -> bool { kind == AMPAMP } | ||
939 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
940 | if Self::can_cast(syntax.kind()) { | ||
941 | Some(Self { syntax }) | ||
942 | } else { | ||
943 | None | ||
944 | } | ||
945 | } | ||
946 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
947 | } | ||
948 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
949 | pub struct Pipepipe { | ||
950 | pub(crate) syntax: SyntaxToken, | ||
951 | } | ||
952 | impl std::fmt::Display for Pipepipe { | ||
953 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
954 | std::fmt::Display::fmt(&self.syntax, f) | ||
955 | } | ||
956 | } | ||
957 | impl AstToken for Pipepipe { | ||
958 | fn can_cast(kind: SyntaxKind) -> bool { kind == PIPEPIPE } | ||
959 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
960 | if Self::can_cast(syntax.kind()) { | ||
961 | Some(Self { syntax }) | ||
962 | } else { | ||
963 | None | ||
964 | } | ||
965 | } | ||
966 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
967 | } | ||
968 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
969 | pub struct Shl { | ||
970 | pub(crate) syntax: SyntaxToken, | ||
971 | } | ||
972 | impl std::fmt::Display for Shl { | ||
973 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
974 | std::fmt::Display::fmt(&self.syntax, f) | ||
975 | } | ||
976 | } | ||
977 | impl AstToken for Shl { | ||
978 | fn can_cast(kind: SyntaxKind) -> bool { kind == SHL } | ||
979 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
980 | if Self::can_cast(syntax.kind()) { | ||
981 | Some(Self { syntax }) | ||
982 | } else { | ||
983 | None | ||
984 | } | ||
985 | } | ||
986 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
987 | } | ||
988 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
989 | pub struct Shr { | ||
990 | pub(crate) syntax: SyntaxToken, | ||
991 | } | ||
992 | impl std::fmt::Display for Shr { | ||
993 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
994 | std::fmt::Display::fmt(&self.syntax, f) | ||
995 | } | ||
996 | } | ||
997 | impl AstToken for Shr { | ||
998 | fn can_cast(kind: SyntaxKind) -> bool { kind == SHR } | ||
999 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1000 | if Self::can_cast(syntax.kind()) { | ||
1001 | Some(Self { syntax }) | ||
1002 | } else { | ||
1003 | None | ||
1004 | } | ||
1005 | } | ||
1006 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1007 | } | ||
1008 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1009 | pub struct Shleq { | ||
1010 | pub(crate) syntax: SyntaxToken, | ||
1011 | } | ||
1012 | impl std::fmt::Display for Shleq { | ||
1013 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1014 | std::fmt::Display::fmt(&self.syntax, f) | ||
1015 | } | ||
1016 | } | ||
1017 | impl AstToken for Shleq { | ||
1018 | fn can_cast(kind: SyntaxKind) -> bool { kind == SHLEQ } | ||
1019 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1020 | if Self::can_cast(syntax.kind()) { | ||
1021 | Some(Self { syntax }) | ||
1022 | } else { | ||
1023 | None | ||
1024 | } | ||
1025 | } | ||
1026 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1027 | } | ||
1028 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1029 | pub struct Shreq { | ||
1030 | pub(crate) syntax: SyntaxToken, | ||
1031 | } | ||
1032 | impl std::fmt::Display for Shreq { | ||
1033 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1034 | std::fmt::Display::fmt(&self.syntax, f) | ||
1035 | } | ||
1036 | } | ||
1037 | impl AstToken for Shreq { | ||
1038 | fn can_cast(kind: SyntaxKind) -> bool { kind == SHREQ } | ||
1039 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1040 | if Self::can_cast(syntax.kind()) { | ||
1041 | Some(Self { syntax }) | ||
1042 | } else { | ||
1043 | None | ||
1044 | } | ||
1045 | } | ||
1046 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1047 | } | ||
1048 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1049 | pub struct AsKw { | ||
1050 | pub(crate) syntax: SyntaxToken, | ||
1051 | } | ||
1052 | impl std::fmt::Display for AsKw { | ||
1053 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1054 | std::fmt::Display::fmt(&self.syntax, f) | ||
1055 | } | ||
1056 | } | ||
1057 | impl AstToken for AsKw { | ||
1058 | fn can_cast(kind: SyntaxKind) -> bool { kind == AS_KW } | ||
1059 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1060 | if Self::can_cast(syntax.kind()) { | ||
1061 | Some(Self { syntax }) | ||
1062 | } else { | ||
1063 | None | ||
1064 | } | ||
1065 | } | ||
1066 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1067 | } | ||
1068 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1069 | pub struct AsyncKw { | ||
1070 | pub(crate) syntax: SyntaxToken, | ||
1071 | } | ||
1072 | impl std::fmt::Display for AsyncKw { | ||
1073 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1074 | std::fmt::Display::fmt(&self.syntax, f) | ||
1075 | } | ||
1076 | } | ||
1077 | impl AstToken for AsyncKw { | ||
1078 | fn can_cast(kind: SyntaxKind) -> bool { kind == ASYNC_KW } | ||
1079 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1080 | if Self::can_cast(syntax.kind()) { | ||
1081 | Some(Self { syntax }) | ||
1082 | } else { | ||
1083 | None | ||
1084 | } | ||
1085 | } | ||
1086 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1087 | } | ||
1088 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1089 | pub struct AwaitKw { | ||
1090 | pub(crate) syntax: SyntaxToken, | ||
1091 | } | ||
1092 | impl std::fmt::Display for AwaitKw { | ||
1093 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1094 | std::fmt::Display::fmt(&self.syntax, f) | ||
1095 | } | ||
1096 | } | ||
1097 | impl AstToken for AwaitKw { | ||
1098 | fn can_cast(kind: SyntaxKind) -> bool { kind == AWAIT_KW } | ||
1099 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1100 | if Self::can_cast(syntax.kind()) { | ||
1101 | Some(Self { syntax }) | ||
1102 | } else { | ||
1103 | None | ||
1104 | } | ||
1105 | } | ||
1106 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1107 | } | ||
1108 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1109 | pub struct BoxKw { | ||
1110 | pub(crate) syntax: SyntaxToken, | ||
1111 | } | ||
1112 | impl std::fmt::Display for BoxKw { | ||
1113 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1114 | std::fmt::Display::fmt(&self.syntax, f) | ||
1115 | } | ||
1116 | } | ||
1117 | impl AstToken for BoxKw { | ||
1118 | fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_KW } | ||
1119 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1120 | if Self::can_cast(syntax.kind()) { | ||
1121 | Some(Self { syntax }) | ||
1122 | } else { | ||
1123 | None | ||
1124 | } | ||
1125 | } | ||
1126 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1127 | } | ||
1128 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1129 | pub struct BreakKw { | ||
1130 | pub(crate) syntax: SyntaxToken, | ||
1131 | } | ||
1132 | impl std::fmt::Display for BreakKw { | ||
1133 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1134 | std::fmt::Display::fmt(&self.syntax, f) | ||
1135 | } | ||
1136 | } | ||
1137 | impl AstToken for BreakKw { | ||
1138 | fn can_cast(kind: SyntaxKind) -> bool { kind == BREAK_KW } | ||
1139 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1140 | if Self::can_cast(syntax.kind()) { | ||
1141 | Some(Self { syntax }) | ||
1142 | } else { | ||
1143 | None | ||
1144 | } | ||
1145 | } | ||
1146 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1147 | } | ||
1148 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1149 | pub struct ConstKw { | ||
1150 | pub(crate) syntax: SyntaxToken, | ||
1151 | } | ||
1152 | impl std::fmt::Display for ConstKw { | ||
1153 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1154 | std::fmt::Display::fmt(&self.syntax, f) | ||
1155 | } | ||
1156 | } | ||
1157 | impl AstToken for ConstKw { | ||
1158 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_KW } | ||
1159 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1160 | if Self::can_cast(syntax.kind()) { | ||
1161 | Some(Self { syntax }) | ||
1162 | } else { | ||
1163 | None | ||
1164 | } | ||
1165 | } | ||
1166 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1167 | } | ||
1168 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1169 | pub struct ContinueKw { | ||
1170 | pub(crate) syntax: SyntaxToken, | ||
1171 | } | ||
1172 | impl std::fmt::Display for ContinueKw { | ||
1173 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1174 | std::fmt::Display::fmt(&self.syntax, f) | ||
1175 | } | ||
1176 | } | ||
1177 | impl AstToken for ContinueKw { | ||
1178 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_KW } | ||
1179 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1180 | if Self::can_cast(syntax.kind()) { | ||
1181 | Some(Self { syntax }) | ||
1182 | } else { | ||
1183 | None | ||
1184 | } | ||
1185 | } | ||
1186 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1187 | } | ||
1188 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1189 | pub struct CrateKw { | ||
1190 | pub(crate) syntax: SyntaxToken, | ||
1191 | } | ||
1192 | impl std::fmt::Display for CrateKw { | ||
1193 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1194 | std::fmt::Display::fmt(&self.syntax, f) | ||
1195 | } | ||
1196 | } | ||
1197 | impl AstToken for CrateKw { | ||
1198 | fn can_cast(kind: SyntaxKind) -> bool { kind == CRATE_KW } | ||
1199 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1200 | if Self::can_cast(syntax.kind()) { | ||
1201 | Some(Self { syntax }) | ||
1202 | } else { | ||
1203 | None | ||
1204 | } | ||
1205 | } | ||
1206 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1207 | } | ||
1208 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1209 | pub struct DynKw { | ||
1210 | pub(crate) syntax: SyntaxToken, | ||
1211 | } | ||
1212 | impl std::fmt::Display for DynKw { | ||
1213 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1214 | std::fmt::Display::fmt(&self.syntax, f) | ||
1215 | } | ||
1216 | } | ||
1217 | impl AstToken for DynKw { | ||
1218 | fn can_cast(kind: SyntaxKind) -> bool { kind == DYN_KW } | ||
1219 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1220 | if Self::can_cast(syntax.kind()) { | ||
1221 | Some(Self { syntax }) | ||
1222 | } else { | ||
1223 | None | ||
1224 | } | ||
1225 | } | ||
1226 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1227 | } | ||
1228 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1229 | pub struct ElseKw { | ||
1230 | pub(crate) syntax: SyntaxToken, | ||
1231 | } | ||
1232 | impl std::fmt::Display for ElseKw { | ||
1233 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1234 | std::fmt::Display::fmt(&self.syntax, f) | ||
1235 | } | ||
1236 | } | ||
1237 | impl AstToken for ElseKw { | ||
1238 | fn can_cast(kind: SyntaxKind) -> bool { kind == ELSE_KW } | ||
1239 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1240 | if Self::can_cast(syntax.kind()) { | ||
1241 | Some(Self { syntax }) | ||
1242 | } else { | ||
1243 | None | ||
1244 | } | ||
1245 | } | ||
1246 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1247 | } | ||
1248 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1249 | pub struct EnumKw { | ||
1250 | pub(crate) syntax: SyntaxToken, | ||
1251 | } | ||
1252 | impl std::fmt::Display for EnumKw { | ||
1253 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1254 | std::fmt::Display::fmt(&self.syntax, f) | ||
1255 | } | ||
1256 | } | ||
1257 | impl AstToken for EnumKw { | ||
1258 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_KW } | ||
1259 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1260 | if Self::can_cast(syntax.kind()) { | ||
1261 | Some(Self { syntax }) | ||
1262 | } else { | ||
1263 | None | ||
1264 | } | ||
1265 | } | ||
1266 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1267 | } | ||
1268 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1269 | pub struct ExternKw { | ||
1270 | pub(crate) syntax: SyntaxToken, | ||
1271 | } | ||
1272 | impl std::fmt::Display for ExternKw { | ||
1273 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1274 | std::fmt::Display::fmt(&self.syntax, f) | ||
1275 | } | ||
1276 | } | ||
1277 | impl AstToken for ExternKw { | ||
1278 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_KW } | ||
1279 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1280 | if Self::can_cast(syntax.kind()) { | ||
1281 | Some(Self { syntax }) | ||
1282 | } else { | ||
1283 | None | ||
1284 | } | ||
1285 | } | ||
1286 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1287 | } | ||
1288 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1289 | pub struct FalseKw { | ||
1290 | pub(crate) syntax: SyntaxToken, | ||
1291 | } | ||
1292 | impl std::fmt::Display for FalseKw { | ||
1293 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1294 | std::fmt::Display::fmt(&self.syntax, f) | ||
1295 | } | ||
1296 | } | ||
1297 | impl AstToken for FalseKw { | ||
1298 | fn can_cast(kind: SyntaxKind) -> bool { kind == FALSE_KW } | ||
1299 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1300 | if Self::can_cast(syntax.kind()) { | ||
1301 | Some(Self { syntax }) | ||
1302 | } else { | ||
1303 | None | ||
1304 | } | ||
1305 | } | ||
1306 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1307 | } | ||
1308 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1309 | pub struct FnKw { | ||
1310 | pub(crate) syntax: SyntaxToken, | ||
1311 | } | ||
1312 | impl std::fmt::Display for FnKw { | ||
1313 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1314 | std::fmt::Display::fmt(&self.syntax, f) | ||
1315 | } | ||
1316 | } | ||
1317 | impl AstToken for FnKw { | ||
1318 | fn can_cast(kind: SyntaxKind) -> bool { kind == FN_KW } | ||
1319 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1320 | if Self::can_cast(syntax.kind()) { | ||
1321 | Some(Self { syntax }) | ||
1322 | } else { | ||
1323 | None | ||
1324 | } | ||
1325 | } | ||
1326 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1327 | } | ||
1328 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1329 | pub struct ForKw { | ||
1330 | pub(crate) syntax: SyntaxToken, | ||
1331 | } | ||
1332 | impl std::fmt::Display for ForKw { | ||
1333 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1334 | std::fmt::Display::fmt(&self.syntax, f) | ||
1335 | } | ||
1336 | } | ||
1337 | impl AstToken for ForKw { | ||
1338 | fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_KW } | ||
1339 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1340 | if Self::can_cast(syntax.kind()) { | ||
1341 | Some(Self { syntax }) | ||
1342 | } else { | ||
1343 | None | ||
1344 | } | ||
1345 | } | ||
1346 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1347 | } | ||
1348 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1349 | pub struct IfKw { | ||
1350 | pub(crate) syntax: SyntaxToken, | ||
1351 | } | ||
1352 | impl std::fmt::Display for IfKw { | ||
1353 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1354 | std::fmt::Display::fmt(&self.syntax, f) | ||
1355 | } | ||
1356 | } | ||
1357 | impl AstToken for IfKw { | ||
1358 | fn can_cast(kind: SyntaxKind) -> bool { kind == IF_KW } | ||
1359 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1360 | if Self::can_cast(syntax.kind()) { | ||
1361 | Some(Self { syntax }) | ||
1362 | } else { | ||
1363 | None | ||
1364 | } | ||
1365 | } | ||
1366 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1367 | } | ||
1368 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1369 | pub struct ImplKw { | ||
1370 | pub(crate) syntax: SyntaxToken, | ||
1371 | } | ||
1372 | impl std::fmt::Display for ImplKw { | ||
1373 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1374 | std::fmt::Display::fmt(&self.syntax, f) | ||
1375 | } | ||
1376 | } | ||
1377 | impl AstToken for ImplKw { | ||
1378 | fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_KW } | ||
1379 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1380 | if Self::can_cast(syntax.kind()) { | ||
1381 | Some(Self { syntax }) | ||
1382 | } else { | ||
1383 | None | ||
1384 | } | ||
1385 | } | ||
1386 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1387 | } | ||
1388 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1389 | pub struct InKw { | ||
1390 | pub(crate) syntax: SyntaxToken, | ||
1391 | } | ||
1392 | impl std::fmt::Display for InKw { | ||
1393 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1394 | std::fmt::Display::fmt(&self.syntax, f) | ||
1395 | } | ||
1396 | } | ||
1397 | impl AstToken for InKw { | ||
1398 | fn can_cast(kind: SyntaxKind) -> bool { kind == IN_KW } | ||
1399 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1400 | if Self::can_cast(syntax.kind()) { | ||
1401 | Some(Self { syntax }) | ||
1402 | } else { | ||
1403 | None | ||
1404 | } | ||
1405 | } | ||
1406 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1407 | } | ||
1408 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1409 | pub struct LetKw { | ||
1410 | pub(crate) syntax: SyntaxToken, | ||
1411 | } | ||
1412 | impl std::fmt::Display for LetKw { | ||
1413 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1414 | std::fmt::Display::fmt(&self.syntax, f) | ||
1415 | } | ||
1416 | } | ||
1417 | impl AstToken for LetKw { | ||
1418 | fn can_cast(kind: SyntaxKind) -> bool { kind == LET_KW } | ||
1419 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1420 | if Self::can_cast(syntax.kind()) { | ||
1421 | Some(Self { syntax }) | ||
1422 | } else { | ||
1423 | None | ||
1424 | } | ||
1425 | } | ||
1426 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1427 | } | ||
1428 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1429 | pub struct LoopKw { | ||
1430 | pub(crate) syntax: SyntaxToken, | ||
1431 | } | ||
1432 | impl std::fmt::Display for LoopKw { | ||
1433 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1434 | std::fmt::Display::fmt(&self.syntax, f) | ||
1435 | } | ||
1436 | } | ||
1437 | impl AstToken for LoopKw { | ||
1438 | fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_KW } | ||
1439 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1440 | if Self::can_cast(syntax.kind()) { | ||
1441 | Some(Self { syntax }) | ||
1442 | } else { | ||
1443 | None | ||
1444 | } | ||
1445 | } | ||
1446 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1447 | } | ||
1448 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1449 | pub struct MacroKw { | ||
1450 | pub(crate) syntax: SyntaxToken, | ||
1451 | } | ||
1452 | impl std::fmt::Display for MacroKw { | ||
1453 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1454 | std::fmt::Display::fmt(&self.syntax, f) | ||
1455 | } | ||
1456 | } | ||
1457 | impl AstToken for MacroKw { | ||
1458 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_KW } | ||
1459 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1460 | if Self::can_cast(syntax.kind()) { | ||
1461 | Some(Self { syntax }) | ||
1462 | } else { | ||
1463 | None | ||
1464 | } | ||
1465 | } | ||
1466 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1467 | } | ||
1468 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1469 | pub struct MatchKw { | ||
1470 | pub(crate) syntax: SyntaxToken, | ||
1471 | } | ||
1472 | impl std::fmt::Display for MatchKw { | ||
1473 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1474 | std::fmt::Display::fmt(&self.syntax, f) | ||
1475 | } | ||
1476 | } | ||
1477 | impl AstToken for MatchKw { | ||
1478 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_KW } | ||
1479 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1480 | if Self::can_cast(syntax.kind()) { | ||
1481 | Some(Self { syntax }) | ||
1482 | } else { | ||
1483 | None | ||
1484 | } | ||
1485 | } | ||
1486 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1487 | } | ||
1488 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1489 | pub struct ModKw { | ||
1490 | pub(crate) syntax: SyntaxToken, | ||
1491 | } | ||
1492 | impl std::fmt::Display for ModKw { | ||
1493 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1494 | std::fmt::Display::fmt(&self.syntax, f) | ||
1495 | } | ||
1496 | } | ||
1497 | impl AstToken for ModKw { | ||
1498 | fn can_cast(kind: SyntaxKind) -> bool { kind == MOD_KW } | ||
1499 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1500 | if Self::can_cast(syntax.kind()) { | ||
1501 | Some(Self { syntax }) | ||
1502 | } else { | ||
1503 | None | ||
1504 | } | ||
1505 | } | ||
1506 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1507 | } | ||
1508 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1509 | pub struct MoveKw { | ||
1510 | pub(crate) syntax: SyntaxToken, | ||
1511 | } | ||
1512 | impl std::fmt::Display for MoveKw { | ||
1513 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1514 | std::fmt::Display::fmt(&self.syntax, f) | ||
1515 | } | ||
1516 | } | ||
1517 | impl AstToken for MoveKw { | ||
1518 | fn can_cast(kind: SyntaxKind) -> bool { kind == MOVE_KW } | ||
1519 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1520 | if Self::can_cast(syntax.kind()) { | ||
1521 | Some(Self { syntax }) | ||
1522 | } else { | ||
1523 | None | ||
1524 | } | ||
1525 | } | ||
1526 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1527 | } | ||
1528 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1529 | pub struct MutKw { | ||
1530 | pub(crate) syntax: SyntaxToken, | ||
1531 | } | ||
1532 | impl std::fmt::Display for MutKw { | ||
1533 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1534 | std::fmt::Display::fmt(&self.syntax, f) | ||
1535 | } | ||
1536 | } | ||
1537 | impl AstToken for MutKw { | ||
1538 | fn can_cast(kind: SyntaxKind) -> bool { kind == MUT_KW } | ||
1539 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1540 | if Self::can_cast(syntax.kind()) { | ||
1541 | Some(Self { syntax }) | ||
1542 | } else { | ||
1543 | None | ||
1544 | } | ||
1545 | } | ||
1546 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1547 | } | ||
1548 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1549 | pub struct PubKw { | ||
1550 | pub(crate) syntax: SyntaxToken, | ||
1551 | } | ||
1552 | impl std::fmt::Display for PubKw { | ||
1553 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1554 | std::fmt::Display::fmt(&self.syntax, f) | ||
1555 | } | ||
1556 | } | ||
1557 | impl AstToken for PubKw { | ||
1558 | fn can_cast(kind: SyntaxKind) -> bool { kind == PUB_KW } | ||
1559 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1560 | if Self::can_cast(syntax.kind()) { | ||
1561 | Some(Self { syntax }) | ||
1562 | } else { | ||
1563 | None | ||
1564 | } | ||
1565 | } | ||
1566 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1567 | } | ||
1568 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1569 | pub struct RefKw { | ||
1570 | pub(crate) syntax: SyntaxToken, | ||
1571 | } | ||
1572 | impl std::fmt::Display for RefKw { | ||
1573 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1574 | std::fmt::Display::fmt(&self.syntax, f) | ||
1575 | } | ||
1576 | } | ||
1577 | impl AstToken for RefKw { | ||
1578 | fn can_cast(kind: SyntaxKind) -> bool { kind == REF_KW } | ||
1579 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1580 | if Self::can_cast(syntax.kind()) { | ||
1581 | Some(Self { syntax }) | ||
1582 | } else { | ||
1583 | None | ||
1584 | } | ||
1585 | } | ||
1586 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1587 | } | ||
1588 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1589 | pub struct ReturnKw { | ||
1590 | pub(crate) syntax: SyntaxToken, | ||
1591 | } | ||
1592 | impl std::fmt::Display for ReturnKw { | ||
1593 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1594 | std::fmt::Display::fmt(&self.syntax, f) | ||
1595 | } | ||
1596 | } | ||
1597 | impl AstToken for ReturnKw { | ||
1598 | fn can_cast(kind: SyntaxKind) -> bool { kind == RETURN_KW } | ||
1599 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1600 | if Self::can_cast(syntax.kind()) { | ||
1601 | Some(Self { syntax }) | ||
1602 | } else { | ||
1603 | None | ||
1604 | } | ||
1605 | } | ||
1606 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1607 | } | ||
1608 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1609 | pub struct SelfKw { | ||
1610 | pub(crate) syntax: SyntaxToken, | ||
1611 | } | ||
1612 | impl std::fmt::Display for SelfKw { | ||
1613 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1614 | std::fmt::Display::fmt(&self.syntax, f) | ||
1615 | } | ||
1616 | } | ||
1617 | impl AstToken for SelfKw { | ||
1618 | fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_KW } | ||
1619 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1620 | if Self::can_cast(syntax.kind()) { | ||
1621 | Some(Self { syntax }) | ||
1622 | } else { | ||
1623 | None | ||
1624 | } | ||
1625 | } | ||
1626 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1627 | } | ||
1628 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1629 | pub struct StaticKw { | ||
1630 | pub(crate) syntax: SyntaxToken, | ||
1631 | } | ||
1632 | impl std::fmt::Display for StaticKw { | ||
1633 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1634 | std::fmt::Display::fmt(&self.syntax, f) | ||
1635 | } | ||
1636 | } | ||
1637 | impl AstToken for StaticKw { | ||
1638 | fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC_KW } | ||
1639 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1640 | if Self::can_cast(syntax.kind()) { | ||
1641 | Some(Self { syntax }) | ||
1642 | } else { | ||
1643 | None | ||
1644 | } | ||
1645 | } | ||
1646 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1647 | } | ||
1648 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1649 | pub struct StructKw { | ||
1650 | pub(crate) syntax: SyntaxToken, | ||
1651 | } | ||
1652 | impl std::fmt::Display for StructKw { | ||
1653 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1654 | std::fmt::Display::fmt(&self.syntax, f) | ||
1655 | } | ||
1656 | } | ||
1657 | impl AstToken for StructKw { | ||
1658 | fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT_KW } | ||
1659 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1660 | if Self::can_cast(syntax.kind()) { | ||
1661 | Some(Self { syntax }) | ||
1662 | } else { | ||
1663 | None | ||
1664 | } | ||
1665 | } | ||
1666 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1667 | } | ||
1668 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1669 | pub struct SuperKw { | ||
1670 | pub(crate) syntax: SyntaxToken, | ||
1671 | } | ||
1672 | impl std::fmt::Display for SuperKw { | ||
1673 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1674 | std::fmt::Display::fmt(&self.syntax, f) | ||
1675 | } | ||
1676 | } | ||
1677 | impl AstToken for SuperKw { | ||
1678 | fn can_cast(kind: SyntaxKind) -> bool { kind == SUPER_KW } | ||
1679 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1680 | if Self::can_cast(syntax.kind()) { | ||
1681 | Some(Self { syntax }) | ||
1682 | } else { | ||
1683 | None | ||
1684 | } | ||
1685 | } | ||
1686 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1687 | } | ||
1688 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1689 | pub struct TraitKw { | ||
1690 | pub(crate) syntax: SyntaxToken, | ||
1691 | } | ||
1692 | impl std::fmt::Display for TraitKw { | ||
1693 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1694 | std::fmt::Display::fmt(&self.syntax, f) | ||
1695 | } | ||
1696 | } | ||
1697 | impl AstToken for TraitKw { | ||
1698 | fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT_KW } | ||
1699 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1700 | if Self::can_cast(syntax.kind()) { | ||
1701 | Some(Self { syntax }) | ||
1702 | } else { | ||
1703 | None | ||
1704 | } | ||
1705 | } | ||
1706 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1707 | } | ||
1708 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1709 | pub struct TrueKw { | ||
1710 | pub(crate) syntax: SyntaxToken, | ||
1711 | } | ||
1712 | impl std::fmt::Display for TrueKw { | ||
1713 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1714 | std::fmt::Display::fmt(&self.syntax, f) | ||
1715 | } | ||
1716 | } | ||
1717 | impl AstToken for TrueKw { | ||
1718 | fn can_cast(kind: SyntaxKind) -> bool { kind == TRUE_KW } | ||
1719 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1720 | if Self::can_cast(syntax.kind()) { | ||
1721 | Some(Self { syntax }) | ||
1722 | } else { | ||
1723 | None | ||
1724 | } | ||
1725 | } | ||
1726 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1727 | } | ||
1728 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1729 | pub struct TryKw { | ||
1730 | pub(crate) syntax: SyntaxToken, | ||
1731 | } | ||
1732 | impl std::fmt::Display for TryKw { | ||
1733 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1734 | std::fmt::Display::fmt(&self.syntax, f) | ||
1735 | } | ||
1736 | } | ||
1737 | impl AstToken for TryKw { | ||
1738 | fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_KW } | ||
1739 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1740 | if Self::can_cast(syntax.kind()) { | ||
1741 | Some(Self { syntax }) | ||
1742 | } else { | ||
1743 | None | ||
1744 | } | ||
1745 | } | ||
1746 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1747 | } | ||
1748 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1749 | pub struct TypeKw { | ||
1750 | pub(crate) syntax: SyntaxToken, | ||
1751 | } | ||
1752 | impl std::fmt::Display for TypeKw { | ||
1753 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1754 | std::fmt::Display::fmt(&self.syntax, f) | ||
1755 | } | ||
1756 | } | ||
1757 | impl AstToken for TypeKw { | ||
1758 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_KW } | ||
1759 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1760 | if Self::can_cast(syntax.kind()) { | ||
1761 | Some(Self { syntax }) | ||
1762 | } else { | ||
1763 | None | ||
1764 | } | ||
1765 | } | ||
1766 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1767 | } | ||
1768 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1769 | pub struct UnsafeKw { | ||
1770 | pub(crate) syntax: SyntaxToken, | ||
1771 | } | ||
1772 | impl std::fmt::Display for UnsafeKw { | ||
1773 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1774 | std::fmt::Display::fmt(&self.syntax, f) | ||
1775 | } | ||
1776 | } | ||
1777 | impl AstToken for UnsafeKw { | ||
1778 | fn can_cast(kind: SyntaxKind) -> bool { kind == UNSAFE_KW } | ||
1779 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1780 | if Self::can_cast(syntax.kind()) { | ||
1781 | Some(Self { syntax }) | ||
1782 | } else { | ||
1783 | None | ||
1784 | } | ||
1785 | } | ||
1786 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1787 | } | ||
1788 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1789 | pub struct UseKw { | ||
1790 | pub(crate) syntax: SyntaxToken, | ||
1791 | } | ||
1792 | impl std::fmt::Display for UseKw { | ||
1793 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1794 | std::fmt::Display::fmt(&self.syntax, f) | ||
1795 | } | ||
1796 | } | ||
1797 | impl AstToken for UseKw { | ||
1798 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE_KW } | ||
1799 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1800 | if Self::can_cast(syntax.kind()) { | ||
1801 | Some(Self { syntax }) | ||
1802 | } else { | ||
1803 | None | ||
1804 | } | ||
1805 | } | ||
1806 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1807 | } | ||
1808 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1809 | pub struct WhereKw { | ||
1810 | pub(crate) syntax: SyntaxToken, | ||
1811 | } | ||
1812 | impl std::fmt::Display for WhereKw { | ||
1813 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1814 | std::fmt::Display::fmt(&self.syntax, f) | ||
1815 | } | ||
1816 | } | ||
1817 | impl AstToken for WhereKw { | ||
1818 | fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_KW } | ||
1819 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1820 | if Self::can_cast(syntax.kind()) { | ||
1821 | Some(Self { syntax }) | ||
1822 | } else { | ||
1823 | None | ||
1824 | } | ||
1825 | } | ||
1826 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1827 | } | ||
1828 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1829 | pub struct WhileKw { | ||
1830 | pub(crate) syntax: SyntaxToken, | ||
1831 | } | ||
1832 | impl std::fmt::Display for WhileKw { | ||
1833 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1834 | std::fmt::Display::fmt(&self.syntax, f) | ||
1835 | } | ||
1836 | } | ||
1837 | impl AstToken for WhileKw { | ||
1838 | fn can_cast(kind: SyntaxKind) -> bool { kind == WHILE_KW } | ||
1839 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1840 | if Self::can_cast(syntax.kind()) { | ||
1841 | Some(Self { syntax }) | ||
1842 | } else { | ||
1843 | None | ||
1844 | } | ||
1845 | } | ||
1846 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1847 | } | ||
1848 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1849 | pub struct AutoKw { | ||
1850 | pub(crate) syntax: SyntaxToken, | ||
1851 | } | ||
1852 | impl std::fmt::Display for AutoKw { | ||
1853 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1854 | std::fmt::Display::fmt(&self.syntax, f) | ||
1855 | } | ||
1856 | } | ||
1857 | impl AstToken for AutoKw { | ||
1858 | fn can_cast(kind: SyntaxKind) -> bool { kind == AUTO_KW } | ||
1859 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1860 | if Self::can_cast(syntax.kind()) { | ||
1861 | Some(Self { syntax }) | ||
1862 | } else { | ||
1863 | None | ||
1864 | } | ||
1865 | } | ||
1866 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1867 | } | ||
1868 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1869 | pub struct DefaultKw { | ||
1870 | pub(crate) syntax: SyntaxToken, | ||
1871 | } | ||
1872 | impl std::fmt::Display for DefaultKw { | ||
1873 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1874 | std::fmt::Display::fmt(&self.syntax, f) | ||
1875 | } | ||
1876 | } | ||
1877 | impl AstToken for DefaultKw { | ||
1878 | fn can_cast(kind: SyntaxKind) -> bool { kind == DEFAULT_KW } | ||
1879 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1880 | if Self::can_cast(syntax.kind()) { | ||
1881 | Some(Self { syntax }) | ||
1882 | } else { | ||
1883 | None | ||
1884 | } | ||
1885 | } | ||
1886 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1887 | } | ||
1888 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1889 | pub struct ExistentialKw { | ||
1890 | pub(crate) syntax: SyntaxToken, | ||
1891 | } | ||
1892 | impl std::fmt::Display for ExistentialKw { | ||
1893 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1894 | std::fmt::Display::fmt(&self.syntax, f) | ||
1895 | } | ||
1896 | } | ||
1897 | impl AstToken for ExistentialKw { | ||
1898 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXISTENTIAL_KW } | ||
1899 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1900 | if Self::can_cast(syntax.kind()) { | ||
1901 | Some(Self { syntax }) | ||
1902 | } else { | ||
1903 | None | ||
1904 | } | ||
1905 | } | ||
1906 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1907 | } | ||
1908 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1909 | pub struct UnionKw { | ||
1910 | pub(crate) syntax: SyntaxToken, | ||
1911 | } | ||
1912 | impl std::fmt::Display for UnionKw { | ||
1913 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1914 | std::fmt::Display::fmt(&self.syntax, f) | ||
1915 | } | ||
1916 | } | ||
1917 | impl AstToken for UnionKw { | ||
1918 | fn can_cast(kind: SyntaxKind) -> bool { kind == UNION_KW } | ||
1919 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1920 | if Self::can_cast(syntax.kind()) { | ||
1921 | Some(Self { syntax }) | ||
1922 | } else { | ||
1923 | None | ||
1924 | } | ||
1925 | } | ||
1926 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1927 | } | ||
1928 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1929 | pub struct RawKw { | ||
1930 | pub(crate) syntax: SyntaxToken, | ||
1931 | } | ||
1932 | impl std::fmt::Display for RawKw { | ||
1933 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1934 | std::fmt::Display::fmt(&self.syntax, f) | ||
1935 | } | ||
1936 | } | ||
1937 | impl AstToken for RawKw { | ||
1938 | fn can_cast(kind: SyntaxKind) -> bool { kind == RAW_KW } | ||
1939 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1940 | if Self::can_cast(syntax.kind()) { | ||
1941 | Some(Self { syntax }) | ||
1942 | } else { | ||
1943 | None | ||
1944 | } | ||
1945 | } | ||
1946 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1947 | } | ||
1948 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1949 | pub struct IntNumber { | ||
1950 | pub(crate) syntax: SyntaxToken, | ||
1951 | } | ||
1952 | impl std::fmt::Display for IntNumber { | ||
1953 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1954 | std::fmt::Display::fmt(&self.syntax, f) | ||
1955 | } | ||
1956 | } | ||
1957 | impl AstToken for IntNumber { | ||
1958 | fn can_cast(kind: SyntaxKind) -> bool { kind == INT_NUMBER } | ||
1959 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1960 | if Self::can_cast(syntax.kind()) { | ||
1961 | Some(Self { syntax }) | ||
1962 | } else { | ||
1963 | None | ||
1964 | } | ||
1965 | } | ||
1966 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1967 | } | ||
1968 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1969 | pub struct FloatNumber { | ||
1970 | pub(crate) syntax: SyntaxToken, | ||
1971 | } | ||
1972 | impl std::fmt::Display for FloatNumber { | ||
1973 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1974 | std::fmt::Display::fmt(&self.syntax, f) | ||
1975 | } | ||
1976 | } | ||
1977 | impl AstToken for FloatNumber { | ||
1978 | fn can_cast(kind: SyntaxKind) -> bool { kind == FLOAT_NUMBER } | ||
1979 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1980 | if Self::can_cast(syntax.kind()) { | ||
1981 | Some(Self { syntax }) | ||
1982 | } else { | ||
1983 | None | ||
1984 | } | ||
1985 | } | ||
1986 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1987 | } | ||
1988 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1989 | pub struct Char { | ||
1990 | pub(crate) syntax: SyntaxToken, | ||
1991 | } | ||
1992 | impl std::fmt::Display for Char { | ||
1993 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1994 | std::fmt::Display::fmt(&self.syntax, f) | ||
1995 | } | ||
1996 | } | ||
1997 | impl AstToken for Char { | ||
1998 | fn can_cast(kind: SyntaxKind) -> bool { kind == CHAR } | ||
1999 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
2000 | if Self::can_cast(syntax.kind()) { | ||
2001 | Some(Self { syntax }) | ||
2002 | } else { | ||
2003 | None | ||
2004 | } | ||
2005 | } | ||
2006 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
2007 | } | ||
2008 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2009 | pub struct Byte { | ||
2010 | pub(crate) syntax: SyntaxToken, | ||
2011 | } | ||
2012 | impl std::fmt::Display for Byte { | ||
2013 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2014 | std::fmt::Display::fmt(&self.syntax, f) | ||
2015 | } | ||
2016 | } | ||
2017 | impl AstToken for Byte { | ||
2018 | fn can_cast(kind: SyntaxKind) -> bool { kind == BYTE } | ||
2019 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
2020 | if Self::can_cast(syntax.kind()) { | ||
2021 | Some(Self { syntax }) | ||
2022 | } else { | ||
2023 | None | ||
2024 | } | ||
2025 | } | ||
2026 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
2027 | } | ||
2028 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2029 | pub struct String { | ||
2030 | pub(crate) syntax: SyntaxToken, | ||
2031 | } | ||
2032 | impl std::fmt::Display for String { | ||
2033 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2034 | std::fmt::Display::fmt(&self.syntax, f) | ||
2035 | } | ||
2036 | } | ||
2037 | impl AstToken for String { | ||
2038 | fn can_cast(kind: SyntaxKind) -> bool { kind == STRING } | ||
2039 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
2040 | if Self::can_cast(syntax.kind()) { | ||
2041 | Some(Self { syntax }) | ||
2042 | } else { | ||
2043 | None | ||
2044 | } | ||
2045 | } | ||
2046 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
2047 | } | ||
2048 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2049 | pub struct RawString { | ||
2050 | pub(crate) syntax: SyntaxToken, | ||
2051 | } | ||
2052 | impl std::fmt::Display for RawString { | ||
2053 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2054 | std::fmt::Display::fmt(&self.syntax, f) | ||
2055 | } | ||
2056 | } | ||
2057 | impl AstToken for RawString { | ||
2058 | fn can_cast(kind: SyntaxKind) -> bool { kind == RAW_STRING } | ||
2059 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
2060 | if Self::can_cast(syntax.kind()) { | ||
2061 | Some(Self { syntax }) | ||
2062 | } else { | ||
2063 | None | ||
2064 | } | ||
2065 | } | ||
2066 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
2067 | } | ||
2068 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2069 | pub struct ByteString { | ||
2070 | pub(crate) syntax: SyntaxToken, | ||
2071 | } | ||
2072 | impl std::fmt::Display for ByteString { | ||
2073 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2074 | std::fmt::Display::fmt(&self.syntax, f) | ||
2075 | } | ||
2076 | } | ||
2077 | impl AstToken for ByteString { | ||
2078 | fn can_cast(kind: SyntaxKind) -> bool { kind == BYTE_STRING } | ||
2079 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
2080 | if Self::can_cast(syntax.kind()) { | ||
2081 | Some(Self { syntax }) | ||
2082 | } else { | ||
2083 | None | ||
2084 | } | ||
2085 | } | ||
2086 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
2087 | } | ||
2088 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2089 | pub struct RawByteString { | ||
2090 | pub(crate) syntax: SyntaxToken, | ||
2091 | } | ||
2092 | impl std::fmt::Display for RawByteString { | ||
2093 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2094 | std::fmt::Display::fmt(&self.syntax, f) | ||
2095 | } | ||
2096 | } | ||
2097 | impl AstToken for RawByteString { | ||
2098 | fn can_cast(kind: SyntaxKind) -> bool { kind == RAW_BYTE_STRING } | ||
2099 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
2100 | if Self::can_cast(syntax.kind()) { | ||
2101 | Some(Self { syntax }) | ||
2102 | } else { | ||
2103 | None | ||
2104 | } | ||
2105 | } | ||
2106 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
2107 | } | ||
2108 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2109 | pub struct Error { | ||
2110 | pub(crate) syntax: SyntaxToken, | ||
2111 | } | ||
2112 | impl std::fmt::Display for Error { | ||
2113 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2114 | std::fmt::Display::fmt(&self.syntax, f) | ||
2115 | } | ||
2116 | } | ||
2117 | impl AstToken for Error { | ||
2118 | fn can_cast(kind: SyntaxKind) -> bool { kind == ERROR } | ||
2119 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
2120 | if Self::can_cast(syntax.kind()) { | ||
2121 | Some(Self { syntax }) | ||
2122 | } else { | ||
2123 | None | ||
2124 | } | ||
2125 | } | ||
2126 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
2127 | } | ||
2128 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2129 | pub struct Ident { | ||
2130 | pub(crate) syntax: SyntaxToken, | ||
2131 | } | ||
2132 | impl std::fmt::Display for Ident { | ||
2133 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2134 | std::fmt::Display::fmt(&self.syntax, f) | ||
2135 | } | ||
2136 | } | ||
2137 | impl AstToken for Ident { | ||
2138 | fn can_cast(kind: SyntaxKind) -> bool { kind == IDENT } | ||
2139 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
2140 | if Self::can_cast(syntax.kind()) { | ||
2141 | Some(Self { syntax }) | ||
2142 | } else { | ||
2143 | None | ||
2144 | } | ||
2145 | } | ||
2146 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
2147 | } | ||
2148 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 9 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2149 | pub struct Whitespace { | 10 | pub struct Whitespace { |
2150 | pub(crate) syntax: SyntaxToken, | 11 | pub(crate) syntax: SyntaxToken, |
@@ -2165,26 +26,7 @@ impl AstToken for Whitespace { | |||
2165 | } | 26 | } |
2166 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | 27 | fn syntax(&self) -> &SyntaxToken { &self.syntax } |
2167 | } | 28 | } |
2168 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 29 | |
2169 | pub struct Lifetime { | ||
2170 | pub(crate) syntax: SyntaxToken, | ||
2171 | } | ||
2172 | impl std::fmt::Display for Lifetime { | ||
2173 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2174 | std::fmt::Display::fmt(&self.syntax, f) | ||
2175 | } | ||
2176 | } | ||
2177 | impl AstToken for Lifetime { | ||
2178 | fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME } | ||
2179 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
2180 | if Self::can_cast(syntax.kind()) { | ||
2181 | Some(Self { syntax }) | ||
2182 | } else { | ||
2183 | None | ||
2184 | } | ||
2185 | } | ||
2186 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
2187 | } | ||
2188 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 30 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2189 | pub struct Comment { | 31 | pub struct Comment { |
2190 | pub(crate) syntax: SyntaxToken, | 32 | pub(crate) syntax: SyntaxToken, |
@@ -2205,37 +47,18 @@ impl AstToken for Comment { | |||
2205 | } | 47 | } |
2206 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | 48 | fn syntax(&self) -> &SyntaxToken { &self.syntax } |
2207 | } | 49 | } |
50 | |||
2208 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 51 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2209 | pub struct Shebang { | 52 | pub struct String { |
2210 | pub(crate) syntax: SyntaxToken, | ||
2211 | } | ||
2212 | impl std::fmt::Display for Shebang { | ||
2213 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2214 | std::fmt::Display::fmt(&self.syntax, f) | ||
2215 | } | ||
2216 | } | ||
2217 | impl AstToken for Shebang { | ||
2218 | fn can_cast(kind: SyntaxKind) -> bool { kind == SHEBANG } | ||
2219 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
2220 | if Self::can_cast(syntax.kind()) { | ||
2221 | Some(Self { syntax }) | ||
2222 | } else { | ||
2223 | None | ||
2224 | } | ||
2225 | } | ||
2226 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
2227 | } | ||
2228 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2229 | pub struct LDollar { | ||
2230 | pub(crate) syntax: SyntaxToken, | 53 | pub(crate) syntax: SyntaxToken, |
2231 | } | 54 | } |
2232 | impl std::fmt::Display for LDollar { | 55 | impl std::fmt::Display for String { |
2233 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 56 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
2234 | std::fmt::Display::fmt(&self.syntax, f) | 57 | std::fmt::Display::fmt(&self.syntax, f) |
2235 | } | 58 | } |
2236 | } | 59 | } |
2237 | impl AstToken for LDollar { | 60 | impl AstToken for String { |
2238 | fn can_cast(kind: SyntaxKind) -> bool { kind == L_DOLLAR } | 61 | fn can_cast(kind: SyntaxKind) -> bool { kind == STRING } |
2239 | fn cast(syntax: SyntaxToken) -> Option<Self> { | 62 | fn cast(syntax: SyntaxToken) -> Option<Self> { |
2240 | if Self::can_cast(syntax.kind()) { | 63 | if Self::can_cast(syntax.kind()) { |
2241 | Some(Self { syntax }) | 64 | Some(Self { syntax }) |
@@ -2245,17 +68,18 @@ impl AstToken for LDollar { | |||
2245 | } | 68 | } |
2246 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | 69 | fn syntax(&self) -> &SyntaxToken { &self.syntax } |
2247 | } | 70 | } |
71 | |||
2248 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 72 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2249 | pub struct RDollar { | 73 | pub struct RawString { |
2250 | pub(crate) syntax: SyntaxToken, | 74 | pub(crate) syntax: SyntaxToken, |
2251 | } | 75 | } |
2252 | impl std::fmt::Display for RDollar { | 76 | impl std::fmt::Display for RawString { |
2253 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 77 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
2254 | std::fmt::Display::fmt(&self.syntax, f) | 78 | std::fmt::Display::fmt(&self.syntax, f) |
2255 | } | 79 | } |
2256 | } | 80 | } |
2257 | impl AstToken for RDollar { | 81 | impl AstToken for RawString { |
2258 | fn can_cast(kind: SyntaxKind) -> bool { kind == R_DOLLAR } | 82 | fn can_cast(kind: SyntaxKind) -> bool { kind == RAW_STRING } |
2259 | fn cast(syntax: SyntaxToken) -> Option<Self> { | 83 | fn cast(syntax: SyntaxToken) -> Option<Self> { |
2260 | if Self::can_cast(syntax.kind()) { | 84 | if Self::can_cast(syntax.kind()) { |
2261 | Some(Self { syntax }) | 85 | Some(Self { syntax }) |
@@ -2265,544 +89,3 @@ impl AstToken for RDollar { | |||
2265 | } | 89 | } |
2266 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | 90 | fn syntax(&self) -> &SyntaxToken { &self.syntax } |
2267 | } | 91 | } |
2268 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2269 | pub enum LeftDelimiter { | ||
2270 | LParen(LParen), | ||
2271 | LBrack(LBrack), | ||
2272 | LCurly(LCurly), | ||
2273 | } | ||
2274 | impl From<LParen> for LeftDelimiter { | ||
2275 | fn from(node: LParen) -> LeftDelimiter { LeftDelimiter::LParen(node) } | ||
2276 | } | ||
2277 | impl From<LBrack> for LeftDelimiter { | ||
2278 | fn from(node: LBrack) -> LeftDelimiter { LeftDelimiter::LBrack(node) } | ||
2279 | } | ||
2280 | impl From<LCurly> for LeftDelimiter { | ||
2281 | fn from(node: LCurly) -> LeftDelimiter { LeftDelimiter::LCurly(node) } | ||
2282 | } | ||
2283 | impl std::fmt::Display for LeftDelimiter { | ||
2284 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2285 | std::fmt::Display::fmt(self.syntax(), f) | ||
2286 | } | ||
2287 | } | ||
2288 | impl AstToken for LeftDelimiter { | ||
2289 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2290 | match kind { | ||
2291 | L_PAREN | L_BRACK | L_CURLY => true, | ||
2292 | _ => false, | ||
2293 | } | ||
2294 | } | ||
2295 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
2296 | let res = match syntax.kind() { | ||
2297 | L_PAREN => LeftDelimiter::LParen(LParen { syntax }), | ||
2298 | L_BRACK => LeftDelimiter::LBrack(LBrack { syntax }), | ||
2299 | L_CURLY => LeftDelimiter::LCurly(LCurly { syntax }), | ||
2300 | _ => return None, | ||
2301 | }; | ||
2302 | Some(res) | ||
2303 | } | ||
2304 | fn syntax(&self) -> &SyntaxToken { | ||
2305 | match self { | ||
2306 | LeftDelimiter::LParen(it) => &it.syntax, | ||
2307 | LeftDelimiter::LBrack(it) => &it.syntax, | ||
2308 | LeftDelimiter::LCurly(it) => &it.syntax, | ||
2309 | } | ||
2310 | } | ||
2311 | } | ||
2312 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2313 | pub enum RightDelimiter { | ||
2314 | RParen(RParen), | ||
2315 | RBrack(RBrack), | ||
2316 | RCurly(RCurly), | ||
2317 | } | ||
2318 | impl From<RParen> for RightDelimiter { | ||
2319 | fn from(node: RParen) -> RightDelimiter { RightDelimiter::RParen(node) } | ||
2320 | } | ||
2321 | impl From<RBrack> for RightDelimiter { | ||
2322 | fn from(node: RBrack) -> RightDelimiter { RightDelimiter::RBrack(node) } | ||
2323 | } | ||
2324 | impl From<RCurly> for RightDelimiter { | ||
2325 | fn from(node: RCurly) -> RightDelimiter { RightDelimiter::RCurly(node) } | ||
2326 | } | ||
2327 | impl std::fmt::Display for RightDelimiter { | ||
2328 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2329 | std::fmt::Display::fmt(self.syntax(), f) | ||
2330 | } | ||
2331 | } | ||
2332 | impl AstToken for RightDelimiter { | ||
2333 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2334 | match kind { | ||
2335 | R_PAREN | R_BRACK | R_CURLY => true, | ||
2336 | _ => false, | ||
2337 | } | ||
2338 | } | ||
2339 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
2340 | let res = match syntax.kind() { | ||
2341 | R_PAREN => RightDelimiter::RParen(RParen { syntax }), | ||
2342 | R_BRACK => RightDelimiter::RBrack(RBrack { syntax }), | ||
2343 | R_CURLY => RightDelimiter::RCurly(RCurly { syntax }), | ||
2344 | _ => return None, | ||
2345 | }; | ||
2346 | Some(res) | ||
2347 | } | ||
2348 | fn syntax(&self) -> &SyntaxToken { | ||
2349 | match self { | ||
2350 | RightDelimiter::RParen(it) => &it.syntax, | ||
2351 | RightDelimiter::RBrack(it) => &it.syntax, | ||
2352 | RightDelimiter::RCurly(it) => &it.syntax, | ||
2353 | } | ||
2354 | } | ||
2355 | } | ||
2356 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2357 | pub enum RangeSeparator { | ||
2358 | Dotdot(Dotdot), | ||
2359 | Dotdotdot(Dotdotdot), | ||
2360 | Dotdoteq(Dotdoteq), | ||
2361 | } | ||
2362 | impl From<Dotdot> for RangeSeparator { | ||
2363 | fn from(node: Dotdot) -> RangeSeparator { RangeSeparator::Dotdot(node) } | ||
2364 | } | ||
2365 | impl From<Dotdotdot> for RangeSeparator { | ||
2366 | fn from(node: Dotdotdot) -> RangeSeparator { RangeSeparator::Dotdotdot(node) } | ||
2367 | } | ||
2368 | impl From<Dotdoteq> for RangeSeparator { | ||
2369 | fn from(node: Dotdoteq) -> RangeSeparator { RangeSeparator::Dotdoteq(node) } | ||
2370 | } | ||
2371 | impl std::fmt::Display for RangeSeparator { | ||
2372 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2373 | std::fmt::Display::fmt(self.syntax(), f) | ||
2374 | } | ||
2375 | } | ||
2376 | impl AstToken for RangeSeparator { | ||
2377 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2378 | match kind { | ||
2379 | DOTDOT | DOTDOTDOT | DOTDOTEQ => true, | ||
2380 | _ => false, | ||
2381 | } | ||
2382 | } | ||
2383 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
2384 | let res = match syntax.kind() { | ||
2385 | DOTDOT => RangeSeparator::Dotdot(Dotdot { syntax }), | ||
2386 | DOTDOTDOT => RangeSeparator::Dotdotdot(Dotdotdot { syntax }), | ||
2387 | DOTDOTEQ => RangeSeparator::Dotdoteq(Dotdoteq { syntax }), | ||
2388 | _ => return None, | ||
2389 | }; | ||
2390 | Some(res) | ||
2391 | } | ||
2392 | fn syntax(&self) -> &SyntaxToken { | ||
2393 | match self { | ||
2394 | RangeSeparator::Dotdot(it) => &it.syntax, | ||
2395 | RangeSeparator::Dotdotdot(it) => &it.syntax, | ||
2396 | RangeSeparator::Dotdoteq(it) => &it.syntax, | ||
2397 | } | ||
2398 | } | ||
2399 | } | ||
2400 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2401 | pub enum BinOp { | ||
2402 | Pipepipe(Pipepipe), | ||
2403 | Ampamp(Ampamp), | ||
2404 | Eqeq(Eqeq), | ||
2405 | Neq(Neq), | ||
2406 | Lteq(Lteq), | ||
2407 | Gteq(Gteq), | ||
2408 | LAngle(LAngle), | ||
2409 | RAngle(RAngle), | ||
2410 | Plus(Plus), | ||
2411 | Star(Star), | ||
2412 | Minus(Minus), | ||
2413 | Slash(Slash), | ||
2414 | Percent(Percent), | ||
2415 | Shl(Shl), | ||
2416 | Shr(Shr), | ||
2417 | Caret(Caret), | ||
2418 | Pipe(Pipe), | ||
2419 | Amp(Amp), | ||
2420 | Eq(Eq), | ||
2421 | Pluseq(Pluseq), | ||
2422 | Slasheq(Slasheq), | ||
2423 | Stareq(Stareq), | ||
2424 | Percenteq(Percenteq), | ||
2425 | Shreq(Shreq), | ||
2426 | Shleq(Shleq), | ||
2427 | Minuseq(Minuseq), | ||
2428 | Pipeeq(Pipeeq), | ||
2429 | Ampeq(Ampeq), | ||
2430 | Careteq(Careteq), | ||
2431 | } | ||
2432 | impl From<Pipepipe> for BinOp { | ||
2433 | fn from(node: Pipepipe) -> BinOp { BinOp::Pipepipe(node) } | ||
2434 | } | ||
2435 | impl From<Ampamp> for BinOp { | ||
2436 | fn from(node: Ampamp) -> BinOp { BinOp::Ampamp(node) } | ||
2437 | } | ||
2438 | impl From<Eqeq> for BinOp { | ||
2439 | fn from(node: Eqeq) -> BinOp { BinOp::Eqeq(node) } | ||
2440 | } | ||
2441 | impl From<Neq> for BinOp { | ||
2442 | fn from(node: Neq) -> BinOp { BinOp::Neq(node) } | ||
2443 | } | ||
2444 | impl From<Lteq> for BinOp { | ||
2445 | fn from(node: Lteq) -> BinOp { BinOp::Lteq(node) } | ||
2446 | } | ||
2447 | impl From<Gteq> for BinOp { | ||
2448 | fn from(node: Gteq) -> BinOp { BinOp::Gteq(node) } | ||
2449 | } | ||
2450 | impl From<LAngle> for BinOp { | ||
2451 | fn from(node: LAngle) -> BinOp { BinOp::LAngle(node) } | ||
2452 | } | ||
2453 | impl From<RAngle> for BinOp { | ||
2454 | fn from(node: RAngle) -> BinOp { BinOp::RAngle(node) } | ||
2455 | } | ||
2456 | impl From<Plus> for BinOp { | ||
2457 | fn from(node: Plus) -> BinOp { BinOp::Plus(node) } | ||
2458 | } | ||
2459 | impl From<Star> for BinOp { | ||
2460 | fn from(node: Star) -> BinOp { BinOp::Star(node) } | ||
2461 | } | ||
2462 | impl From<Minus> for BinOp { | ||
2463 | fn from(node: Minus) -> BinOp { BinOp::Minus(node) } | ||
2464 | } | ||
2465 | impl From<Slash> for BinOp { | ||
2466 | fn from(node: Slash) -> BinOp { BinOp::Slash(node) } | ||
2467 | } | ||
2468 | impl From<Percent> for BinOp { | ||
2469 | fn from(node: Percent) -> BinOp { BinOp::Percent(node) } | ||
2470 | } | ||
2471 | impl From<Shl> for BinOp { | ||
2472 | fn from(node: Shl) -> BinOp { BinOp::Shl(node) } | ||
2473 | } | ||
2474 | impl From<Shr> for BinOp { | ||
2475 | fn from(node: Shr) -> BinOp { BinOp::Shr(node) } | ||
2476 | } | ||
2477 | impl From<Caret> for BinOp { | ||
2478 | fn from(node: Caret) -> BinOp { BinOp::Caret(node) } | ||
2479 | } | ||
2480 | impl From<Pipe> for BinOp { | ||
2481 | fn from(node: Pipe) -> BinOp { BinOp::Pipe(node) } | ||
2482 | } | ||
2483 | impl From<Amp> for BinOp { | ||
2484 | fn from(node: Amp) -> BinOp { BinOp::Amp(node) } | ||
2485 | } | ||
2486 | impl From<Eq> for BinOp { | ||
2487 | fn from(node: Eq) -> BinOp { BinOp::Eq(node) } | ||
2488 | } | ||
2489 | impl From<Pluseq> for BinOp { | ||
2490 | fn from(node: Pluseq) -> BinOp { BinOp::Pluseq(node) } | ||
2491 | } | ||
2492 | impl From<Slasheq> for BinOp { | ||
2493 | fn from(node: Slasheq) -> BinOp { BinOp::Slasheq(node) } | ||
2494 | } | ||
2495 | impl From<Stareq> for BinOp { | ||
2496 | fn from(node: Stareq) -> BinOp { BinOp::Stareq(node) } | ||
2497 | } | ||
2498 | impl From<Percenteq> for BinOp { | ||
2499 | fn from(node: Percenteq) -> BinOp { BinOp::Percenteq(node) } | ||
2500 | } | ||
2501 | impl From<Shreq> for BinOp { | ||
2502 | fn from(node: Shreq) -> BinOp { BinOp::Shreq(node) } | ||
2503 | } | ||
2504 | impl From<Shleq> for BinOp { | ||
2505 | fn from(node: Shleq) -> BinOp { BinOp::Shleq(node) } | ||
2506 | } | ||
2507 | impl From<Minuseq> for BinOp { | ||
2508 | fn from(node: Minuseq) -> BinOp { BinOp::Minuseq(node) } | ||
2509 | } | ||
2510 | impl From<Pipeeq> for BinOp { | ||
2511 | fn from(node: Pipeeq) -> BinOp { BinOp::Pipeeq(node) } | ||
2512 | } | ||
2513 | impl From<Ampeq> for BinOp { | ||
2514 | fn from(node: Ampeq) -> BinOp { BinOp::Ampeq(node) } | ||
2515 | } | ||
2516 | impl From<Careteq> for BinOp { | ||
2517 | fn from(node: Careteq) -> BinOp { BinOp::Careteq(node) } | ||
2518 | } | ||
2519 | impl std::fmt::Display for BinOp { | ||
2520 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2521 | std::fmt::Display::fmt(self.syntax(), f) | ||
2522 | } | ||
2523 | } | ||
2524 | impl AstToken for BinOp { | ||
2525 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2526 | match kind { | ||
2527 | PIPEPIPE | AMPAMP | EQEQ | NEQ | LTEQ | GTEQ | L_ANGLE | R_ANGLE | PLUS | STAR | ||
2528 | | MINUS | SLASH | PERCENT | SHL | SHR | CARET | PIPE | AMP | EQ | PLUSEQ | SLASHEQ | ||
2529 | | STAREQ | PERCENTEQ | SHREQ | SHLEQ | MINUSEQ | PIPEEQ | AMPEQ | CARETEQ => true, | ||
2530 | _ => false, | ||
2531 | } | ||
2532 | } | ||
2533 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
2534 | let res = match syntax.kind() { | ||
2535 | PIPEPIPE => BinOp::Pipepipe(Pipepipe { syntax }), | ||
2536 | AMPAMP => BinOp::Ampamp(Ampamp { syntax }), | ||
2537 | EQEQ => BinOp::Eqeq(Eqeq { syntax }), | ||
2538 | NEQ => BinOp::Neq(Neq { syntax }), | ||
2539 | LTEQ => BinOp::Lteq(Lteq { syntax }), | ||
2540 | GTEQ => BinOp::Gteq(Gteq { syntax }), | ||
2541 | L_ANGLE => BinOp::LAngle(LAngle { syntax }), | ||
2542 | R_ANGLE => BinOp::RAngle(RAngle { syntax }), | ||
2543 | PLUS => BinOp::Plus(Plus { syntax }), | ||
2544 | STAR => BinOp::Star(Star { syntax }), | ||
2545 | MINUS => BinOp::Minus(Minus { syntax }), | ||
2546 | SLASH => BinOp::Slash(Slash { syntax }), | ||
2547 | PERCENT => BinOp::Percent(Percent { syntax }), | ||
2548 | SHL => BinOp::Shl(Shl { syntax }), | ||
2549 | SHR => BinOp::Shr(Shr { syntax }), | ||
2550 | CARET => BinOp::Caret(Caret { syntax }), | ||
2551 | PIPE => BinOp::Pipe(Pipe { syntax }), | ||
2552 | AMP => BinOp::Amp(Amp { syntax }), | ||
2553 | EQ => BinOp::Eq(Eq { syntax }), | ||
2554 | PLUSEQ => BinOp::Pluseq(Pluseq { syntax }), | ||
2555 | SLASHEQ => BinOp::Slasheq(Slasheq { syntax }), | ||
2556 | STAREQ => BinOp::Stareq(Stareq { syntax }), | ||
2557 | PERCENTEQ => BinOp::Percenteq(Percenteq { syntax }), | ||
2558 | SHREQ => BinOp::Shreq(Shreq { syntax }), | ||
2559 | SHLEQ => BinOp::Shleq(Shleq { syntax }), | ||
2560 | MINUSEQ => BinOp::Minuseq(Minuseq { syntax }), | ||
2561 | PIPEEQ => BinOp::Pipeeq(Pipeeq { syntax }), | ||
2562 | AMPEQ => BinOp::Ampeq(Ampeq { syntax }), | ||
2563 | CARETEQ => BinOp::Careteq(Careteq { syntax }), | ||
2564 | _ => return None, | ||
2565 | }; | ||
2566 | Some(res) | ||
2567 | } | ||
2568 | fn syntax(&self) -> &SyntaxToken { | ||
2569 | match self { | ||
2570 | BinOp::Pipepipe(it) => &it.syntax, | ||
2571 | BinOp::Ampamp(it) => &it.syntax, | ||
2572 | BinOp::Eqeq(it) => &it.syntax, | ||
2573 | BinOp::Neq(it) => &it.syntax, | ||
2574 | BinOp::Lteq(it) => &it.syntax, | ||
2575 | BinOp::Gteq(it) => &it.syntax, | ||
2576 | BinOp::LAngle(it) => &it.syntax, | ||
2577 | BinOp::RAngle(it) => &it.syntax, | ||
2578 | BinOp::Plus(it) => &it.syntax, | ||
2579 | BinOp::Star(it) => &it.syntax, | ||
2580 | BinOp::Minus(it) => &it.syntax, | ||
2581 | BinOp::Slash(it) => &it.syntax, | ||
2582 | BinOp::Percent(it) => &it.syntax, | ||
2583 | BinOp::Shl(it) => &it.syntax, | ||
2584 | BinOp::Shr(it) => &it.syntax, | ||
2585 | BinOp::Caret(it) => &it.syntax, | ||
2586 | BinOp::Pipe(it) => &it.syntax, | ||
2587 | BinOp::Amp(it) => &it.syntax, | ||
2588 | BinOp::Eq(it) => &it.syntax, | ||
2589 | BinOp::Pluseq(it) => &it.syntax, | ||
2590 | BinOp::Slasheq(it) => &it.syntax, | ||
2591 | BinOp::Stareq(it) => &it.syntax, | ||
2592 | BinOp::Percenteq(it) => &it.syntax, | ||
2593 | BinOp::Shreq(it) => &it.syntax, | ||
2594 | BinOp::Shleq(it) => &it.syntax, | ||
2595 | BinOp::Minuseq(it) => &it.syntax, | ||
2596 | BinOp::Pipeeq(it) => &it.syntax, | ||
2597 | BinOp::Ampeq(it) => &it.syntax, | ||
2598 | BinOp::Careteq(it) => &it.syntax, | ||
2599 | } | ||
2600 | } | ||
2601 | } | ||
2602 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2603 | pub enum PrefixOp { | ||
2604 | Minus(Minus), | ||
2605 | Excl(Excl), | ||
2606 | Star(Star), | ||
2607 | } | ||
2608 | impl From<Minus> for PrefixOp { | ||
2609 | fn from(node: Minus) -> PrefixOp { PrefixOp::Minus(node) } | ||
2610 | } | ||
2611 | impl From<Excl> for PrefixOp { | ||
2612 | fn from(node: Excl) -> PrefixOp { PrefixOp::Excl(node) } | ||
2613 | } | ||
2614 | impl From<Star> for PrefixOp { | ||
2615 | fn from(node: Star) -> PrefixOp { PrefixOp::Star(node) } | ||
2616 | } | ||
2617 | impl std::fmt::Display for PrefixOp { | ||
2618 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2619 | std::fmt::Display::fmt(self.syntax(), f) | ||
2620 | } | ||
2621 | } | ||
2622 | impl AstToken for PrefixOp { | ||
2623 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2624 | match kind { | ||
2625 | MINUS | EXCL | STAR => true, | ||
2626 | _ => false, | ||
2627 | } | ||
2628 | } | ||
2629 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
2630 | let res = match syntax.kind() { | ||
2631 | MINUS => PrefixOp::Minus(Minus { syntax }), | ||
2632 | EXCL => PrefixOp::Excl(Excl { syntax }), | ||
2633 | STAR => PrefixOp::Star(Star { syntax }), | ||
2634 | _ => return None, | ||
2635 | }; | ||
2636 | Some(res) | ||
2637 | } | ||
2638 | fn syntax(&self) -> &SyntaxToken { | ||
2639 | match self { | ||
2640 | PrefixOp::Minus(it) => &it.syntax, | ||
2641 | PrefixOp::Excl(it) => &it.syntax, | ||
2642 | PrefixOp::Star(it) => &it.syntax, | ||
2643 | } | ||
2644 | } | ||
2645 | } | ||
2646 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2647 | pub enum RangeOp { | ||
2648 | Dotdot(Dotdot), | ||
2649 | Dotdoteq(Dotdoteq), | ||
2650 | } | ||
2651 | impl From<Dotdot> for RangeOp { | ||
2652 | fn from(node: Dotdot) -> RangeOp { RangeOp::Dotdot(node) } | ||
2653 | } | ||
2654 | impl From<Dotdoteq> for RangeOp { | ||
2655 | fn from(node: Dotdoteq) -> RangeOp { RangeOp::Dotdoteq(node) } | ||
2656 | } | ||
2657 | impl std::fmt::Display for RangeOp { | ||
2658 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2659 | std::fmt::Display::fmt(self.syntax(), f) | ||
2660 | } | ||
2661 | } | ||
2662 | impl AstToken for RangeOp { | ||
2663 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2664 | match kind { | ||
2665 | DOTDOT | DOTDOTEQ => true, | ||
2666 | _ => false, | ||
2667 | } | ||
2668 | } | ||
2669 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
2670 | let res = match syntax.kind() { | ||
2671 | DOTDOT => RangeOp::Dotdot(Dotdot { syntax }), | ||
2672 | DOTDOTEQ => RangeOp::Dotdoteq(Dotdoteq { syntax }), | ||
2673 | _ => return None, | ||
2674 | }; | ||
2675 | Some(res) | ||
2676 | } | ||
2677 | fn syntax(&self) -> &SyntaxToken { | ||
2678 | match self { | ||
2679 | RangeOp::Dotdot(it) => &it.syntax, | ||
2680 | RangeOp::Dotdoteq(it) => &it.syntax, | ||
2681 | } | ||
2682 | } | ||
2683 | } | ||
2684 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2685 | pub enum LiteralToken { | ||
2686 | IntNumber(IntNumber), | ||
2687 | FloatNumber(FloatNumber), | ||
2688 | String(String), | ||
2689 | RawString(RawString), | ||
2690 | TrueKw(TrueKw), | ||
2691 | FalseKw(FalseKw), | ||
2692 | ByteString(ByteString), | ||
2693 | RawByteString(RawByteString), | ||
2694 | Char(Char), | ||
2695 | Byte(Byte), | ||
2696 | } | ||
2697 | impl From<IntNumber> for LiteralToken { | ||
2698 | fn from(node: IntNumber) -> LiteralToken { LiteralToken::IntNumber(node) } | ||
2699 | } | ||
2700 | impl From<FloatNumber> for LiteralToken { | ||
2701 | fn from(node: FloatNumber) -> LiteralToken { LiteralToken::FloatNumber(node) } | ||
2702 | } | ||
2703 | impl From<String> for LiteralToken { | ||
2704 | fn from(node: String) -> LiteralToken { LiteralToken::String(node) } | ||
2705 | } | ||
2706 | impl From<RawString> for LiteralToken { | ||
2707 | fn from(node: RawString) -> LiteralToken { LiteralToken::RawString(node) } | ||
2708 | } | ||
2709 | impl From<TrueKw> for LiteralToken { | ||
2710 | fn from(node: TrueKw) -> LiteralToken { LiteralToken::TrueKw(node) } | ||
2711 | } | ||
2712 | impl From<FalseKw> for LiteralToken { | ||
2713 | fn from(node: FalseKw) -> LiteralToken { LiteralToken::FalseKw(node) } | ||
2714 | } | ||
2715 | impl From<ByteString> for LiteralToken { | ||
2716 | fn from(node: ByteString) -> LiteralToken { LiteralToken::ByteString(node) } | ||
2717 | } | ||
2718 | impl From<RawByteString> for LiteralToken { | ||
2719 | fn from(node: RawByteString) -> LiteralToken { LiteralToken::RawByteString(node) } | ||
2720 | } | ||
2721 | impl From<Char> for LiteralToken { | ||
2722 | fn from(node: Char) -> LiteralToken { LiteralToken::Char(node) } | ||
2723 | } | ||
2724 | impl From<Byte> for LiteralToken { | ||
2725 | fn from(node: Byte) -> LiteralToken { LiteralToken::Byte(node) } | ||
2726 | } | ||
2727 | impl std::fmt::Display for LiteralToken { | ||
2728 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2729 | std::fmt::Display::fmt(self.syntax(), f) | ||
2730 | } | ||
2731 | } | ||
2732 | impl AstToken for LiteralToken { | ||
2733 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2734 | match kind { | ||
2735 | INT_NUMBER | FLOAT_NUMBER | STRING | RAW_STRING | TRUE_KW | FALSE_KW | BYTE_STRING | ||
2736 | | RAW_BYTE_STRING | CHAR | BYTE => true, | ||
2737 | _ => false, | ||
2738 | } | ||
2739 | } | ||
2740 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
2741 | let res = match syntax.kind() { | ||
2742 | INT_NUMBER => LiteralToken::IntNumber(IntNumber { syntax }), | ||
2743 | FLOAT_NUMBER => LiteralToken::FloatNumber(FloatNumber { syntax }), | ||
2744 | STRING => LiteralToken::String(String { syntax }), | ||
2745 | RAW_STRING => LiteralToken::RawString(RawString { syntax }), | ||
2746 | TRUE_KW => LiteralToken::TrueKw(TrueKw { syntax }), | ||
2747 | FALSE_KW => LiteralToken::FalseKw(FalseKw { syntax }), | ||
2748 | BYTE_STRING => LiteralToken::ByteString(ByteString { syntax }), | ||
2749 | RAW_BYTE_STRING => LiteralToken::RawByteString(RawByteString { syntax }), | ||
2750 | CHAR => LiteralToken::Char(Char { syntax }), | ||
2751 | BYTE => LiteralToken::Byte(Byte { syntax }), | ||
2752 | _ => return None, | ||
2753 | }; | ||
2754 | Some(res) | ||
2755 | } | ||
2756 | fn syntax(&self) -> &SyntaxToken { | ||
2757 | match self { | ||
2758 | LiteralToken::IntNumber(it) => &it.syntax, | ||
2759 | LiteralToken::FloatNumber(it) => &it.syntax, | ||
2760 | LiteralToken::String(it) => &it.syntax, | ||
2761 | LiteralToken::RawString(it) => &it.syntax, | ||
2762 | LiteralToken::TrueKw(it) => &it.syntax, | ||
2763 | LiteralToken::FalseKw(it) => &it.syntax, | ||
2764 | LiteralToken::ByteString(it) => &it.syntax, | ||
2765 | LiteralToken::RawByteString(it) => &it.syntax, | ||
2766 | LiteralToken::Char(it) => &it.syntax, | ||
2767 | LiteralToken::Byte(it) => &it.syntax, | ||
2768 | } | ||
2769 | } | ||
2770 | } | ||
2771 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2772 | pub enum NameRefToken { | ||
2773 | Ident(Ident), | ||
2774 | IntNumber(IntNumber), | ||
2775 | } | ||
2776 | impl From<Ident> for NameRefToken { | ||
2777 | fn from(node: Ident) -> NameRefToken { NameRefToken::Ident(node) } | ||
2778 | } | ||
2779 | impl From<IntNumber> for NameRefToken { | ||
2780 | fn from(node: IntNumber) -> NameRefToken { NameRefToken::IntNumber(node) } | ||
2781 | } | ||
2782 | impl std::fmt::Display for NameRefToken { | ||
2783 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2784 | std::fmt::Display::fmt(self.syntax(), f) | ||
2785 | } | ||
2786 | } | ||
2787 | impl AstToken for NameRefToken { | ||
2788 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2789 | match kind { | ||
2790 | IDENT | INT_NUMBER => true, | ||
2791 | _ => false, | ||
2792 | } | ||
2793 | } | ||
2794 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
2795 | let res = match syntax.kind() { | ||
2796 | IDENT => NameRefToken::Ident(Ident { syntax }), | ||
2797 | INT_NUMBER => NameRefToken::IntNumber(IntNumber { syntax }), | ||
2798 | _ => return None, | ||
2799 | }; | ||
2800 | Some(res) | ||
2801 | } | ||
2802 | fn syntax(&self) -> &SyntaxToken { | ||
2803 | match self { | ||
2804 | NameRefToken::Ident(it) => &it.syntax, | ||
2805 | NameRefToken::IntNumber(it) => &it.syntax, | ||
2806 | } | ||
2807 | } | ||
2808 | } | ||
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index f39559e9e..0f4a50be4 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs | |||
@@ -100,6 +100,9 @@ pub fn expr_empty_block() -> ast::Expr { | |||
100 | pub fn expr_unimplemented() -> ast::Expr { | 100 | pub fn expr_unimplemented() -> ast::Expr { |
101 | expr_from_text("unimplemented!()") | 101 | expr_from_text("unimplemented!()") |
102 | } | 102 | } |
103 | pub fn expr_todo() -> ast::Expr { | ||
104 | expr_from_text("todo!()") | ||
105 | } | ||
103 | pub fn expr_path(path: ast::Path) -> ast::Expr { | 106 | pub fn expr_path(path: ast::Path) -> ast::Expr { |
104 | expr_from_text(&path.to_string()) | 107 | expr_from_text(&path.to_string()) |
105 | } | 108 | } |
diff --git a/crates/ra_syntax/src/ast/traits.rs b/crates/ra_syntax/src/ast/traits.rs index 870e83804..bfc05e08b 100644 --- a/crates/ra_syntax/src/ast/traits.rs +++ b/crates/ra_syntax/src/ast/traits.rs | |||
@@ -1,83 +1,77 @@ | |||
1 | //! Various traits that are implemented by ast nodes. | 1 | //! Various traits that are implemented by ast nodes. |
2 | //! | 2 | //! |
3 | //! The implementations are usually trivial, and live in generated.rs | 3 | //! The implementations are usually trivial, and live in generated.rs |
4 | 4 | use stdx::SepBy; | |
5 | use itertools::Itertools; | ||
6 | 5 | ||
7 | use crate::{ | 6 | use crate::{ |
8 | ast::{self, child_opt, children, support, AstChildren, AstNode, AstToken}, | 7 | ast::{self, support, AstChildren, AstNode, AstToken}, |
9 | syntax_node::SyntaxElementChildren, | 8 | syntax_node::SyntaxElementChildren, |
9 | SyntaxToken, T, | ||
10 | }; | 10 | }; |
11 | 11 | ||
12 | pub trait TypeAscriptionOwner: AstNode { | 12 | pub trait TypeAscriptionOwner: AstNode { |
13 | fn ascribed_type(&self) -> Option<ast::TypeRef> { | 13 | fn ascribed_type(&self) -> Option<ast::TypeRef> { |
14 | child_opt(self) | 14 | support::child(self.syntax()) |
15 | } | 15 | } |
16 | } | 16 | } |
17 | 17 | ||
18 | pub trait NameOwner: AstNode { | 18 | pub trait NameOwner: AstNode { |
19 | fn name(&self) -> Option<ast::Name> { | 19 | fn name(&self) -> Option<ast::Name> { |
20 | child_opt(self) | 20 | support::child(self.syntax()) |
21 | } | 21 | } |
22 | } | 22 | } |
23 | 23 | ||
24 | pub trait VisibilityOwner: AstNode { | 24 | pub trait VisibilityOwner: AstNode { |
25 | fn visibility(&self) -> Option<ast::Visibility> { | 25 | fn visibility(&self) -> Option<ast::Visibility> { |
26 | child_opt(self) | 26 | support::child(self.syntax()) |
27 | } | 27 | } |
28 | } | 28 | } |
29 | 29 | ||
30 | pub trait LoopBodyOwner: AstNode { | 30 | pub trait LoopBodyOwner: AstNode { |
31 | fn loop_body(&self) -> Option<ast::BlockExpr> { | 31 | fn loop_body(&self) -> Option<ast::BlockExpr> { |
32 | child_opt(self) | 32 | support::child(self.syntax()) |
33 | } | 33 | } |
34 | 34 | ||
35 | fn label(&self) -> Option<ast::Label> { | 35 | fn label(&self) -> Option<ast::Label> { |
36 | child_opt(self) | 36 | support::child(self.syntax()) |
37 | } | 37 | } |
38 | } | 38 | } |
39 | 39 | ||
40 | pub trait ArgListOwner: AstNode { | 40 | pub trait ArgListOwner: AstNode { |
41 | fn arg_list(&self) -> Option<ast::ArgList> { | 41 | fn arg_list(&self) -> Option<ast::ArgList> { |
42 | child_opt(self) | 42 | support::child(self.syntax()) |
43 | } | ||
44 | } | ||
45 | |||
46 | pub trait FnDefOwner: AstNode { | ||
47 | fn functions(&self) -> AstChildren<ast::FnDef> { | ||
48 | children(self) | ||
49 | } | 43 | } |
50 | } | 44 | } |
51 | 45 | ||
52 | pub trait ModuleItemOwner: AstNode { | 46 | pub trait ModuleItemOwner: AstNode { |
53 | fn items(&self) -> AstChildren<ast::ModuleItem> { | 47 | fn items(&self) -> AstChildren<ast::ModuleItem> { |
54 | children(self) | 48 | support::children(self.syntax()) |
55 | } | 49 | } |
56 | } | 50 | } |
57 | 51 | ||
58 | pub trait TypeParamsOwner: AstNode { | 52 | pub trait TypeParamsOwner: AstNode { |
59 | fn type_param_list(&self) -> Option<ast::TypeParamList> { | 53 | fn type_param_list(&self) -> Option<ast::TypeParamList> { |
60 | child_opt(self) | 54 | support::child(self.syntax()) |
61 | } | 55 | } |
62 | 56 | ||
63 | fn where_clause(&self) -> Option<ast::WhereClause> { | 57 | fn where_clause(&self) -> Option<ast::WhereClause> { |
64 | child_opt(self) | 58 | support::child(self.syntax()) |
65 | } | 59 | } |
66 | } | 60 | } |
67 | 61 | ||
68 | pub trait TypeBoundsOwner: AstNode { | 62 | pub trait TypeBoundsOwner: AstNode { |
69 | fn type_bound_list(&self) -> Option<ast::TypeBoundList> { | 63 | fn type_bound_list(&self) -> Option<ast::TypeBoundList> { |
70 | child_opt(self) | 64 | support::child(self.syntax()) |
71 | } | 65 | } |
72 | 66 | ||
73 | fn colon(&self) -> Option<ast::Colon> { | 67 | fn colon_token(&self) -> Option<SyntaxToken> { |
74 | support::token(self.syntax()) | 68 | support::token(self.syntax(), T![:]) |
75 | } | 69 | } |
76 | } | 70 | } |
77 | 71 | ||
78 | pub trait AttrsOwner: AstNode { | 72 | pub trait AttrsOwner: AstNode { |
79 | fn attrs(&self) -> AstChildren<ast::Attr> { | 73 | fn attrs(&self) -> AstChildren<ast::Attr> { |
80 | children(self) | 74 | support::children(self.syntax()) |
81 | } | 75 | } |
82 | fn has_atom_attr(&self, atom: &str) -> bool { | 76 | fn has_atom_attr(&self, atom: &str) -> bool { |
83 | self.attrs().filter_map(|x| x.as_simple_atom()).any(|x| x == atom) | 77 | self.attrs().filter_map(|x| x.as_simple_atom()).any(|x| x == atom) |
@@ -122,7 +116,8 @@ pub trait DocCommentsOwner: AstNode { | |||
122 | // of a line in markdown. | 116 | // of a line in markdown. |
123 | line[pos..end].to_owned() | 117 | line[pos..end].to_owned() |
124 | }) | 118 | }) |
125 | .join("\n"); | 119 | .sep_by("\n") |
120 | .to_string(); | ||
126 | 121 | ||
127 | if has_comments { | 122 | if has_comments { |
128 | Some(docs) | 123 | Some(docs) |
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs index f0e16dc2b..a796e78b1 100644 --- a/crates/ra_syntax/src/lib.rs +++ b/crates/ra_syntax/src/lib.rs | |||
@@ -19,6 +19,11 @@ | |||
19 | //! [RFC]: <https://github.com/rust-lang/rfcs/pull/2256> | 19 | //! [RFC]: <https://github.com/rust-lang/rfcs/pull/2256> |
20 | //! [Swift]: <https://github.com/apple/swift/blob/13d593df6f359d0cb2fc81cfaac273297c539455/lib/Syntax/README.md> | 20 | //! [Swift]: <https://github.com/apple/swift/blob/13d593df6f359d0cb2fc81cfaac273297c539455/lib/Syntax/README.md> |
21 | 21 | ||
22 | #[allow(unused)] | ||
23 | macro_rules! eprintln { | ||
24 | ($($tt:tt)*) => { stdx::eprintln!($($tt)*) }; | ||
25 | } | ||
26 | |||
22 | mod syntax_node; | 27 | mod syntax_node; |
23 | mod syntax_error; | 28 | mod syntax_error; |
24 | mod parsing; | 29 | mod parsing; |
diff --git a/crates/ra_syntax/src/parsing/lexer.rs b/crates/ra_syntax/src/parsing/lexer.rs index d1baaa607..67c1f1b48 100644 --- a/crates/ra_syntax/src/parsing/lexer.rs +++ b/crates/ra_syntax/src/parsing/lexer.rs | |||
@@ -4,7 +4,7 @@ | |||
4 | use crate::{ | 4 | use crate::{ |
5 | SyntaxError, | 5 | SyntaxError, |
6 | SyntaxKind::{self, *}, | 6 | SyntaxKind::{self, *}, |
7 | TextRange, TextUnit, | 7 | TextRange, TextUnit, T, |
8 | }; | 8 | }; |
9 | 9 | ||
10 | /// A token of Rust source. | 10 | /// A token of Rust source. |
@@ -115,21 +115,20 @@ fn rustc_token_kind_to_syntax_kind( | |||
115 | // being `u16` that come from `rowan::SyntaxKind`. | 115 | // being `u16` that come from `rowan::SyntaxKind`. |
116 | 116 | ||
117 | let syntax_kind = { | 117 | let syntax_kind = { |
118 | use rustc_lexer::TokenKind as TK; | ||
119 | match rustc_token_kind { | 118 | match rustc_token_kind { |
120 | TK::LineComment => COMMENT, | 119 | rustc_lexer::TokenKind::LineComment => COMMENT, |
121 | 120 | ||
122 | TK::BlockComment { terminated: true } => COMMENT, | 121 | rustc_lexer::TokenKind::BlockComment { terminated: true } => COMMENT, |
123 | TK::BlockComment { terminated: false } => { | 122 | rustc_lexer::TokenKind::BlockComment { terminated: false } => { |
124 | return ( | 123 | return ( |
125 | COMMENT, | 124 | COMMENT, |
126 | Some("Missing trailing `*/` symbols to terminate the block comment"), | 125 | Some("Missing trailing `*/` symbols to terminate the block comment"), |
127 | ); | 126 | ); |
128 | } | 127 | } |
129 | 128 | ||
130 | TK::Whitespace => WHITESPACE, | 129 | rustc_lexer::TokenKind::Whitespace => WHITESPACE, |
131 | 130 | ||
132 | TK::Ident => { | 131 | rustc_lexer::TokenKind::Ident => { |
133 | if token_text == "_" { | 132 | if token_text == "_" { |
134 | UNDERSCORE | 133 | UNDERSCORE |
135 | } else { | 134 | } else { |
@@ -137,42 +136,42 @@ fn rustc_token_kind_to_syntax_kind( | |||
137 | } | 136 | } |
138 | } | 137 | } |
139 | 138 | ||
140 | TK::RawIdent => IDENT, | 139 | rustc_lexer::TokenKind::RawIdent => IDENT, |
141 | TK::Literal { kind, .. } => return match_literal_kind(&kind), | 140 | rustc_lexer::TokenKind::Literal { kind, .. } => return match_literal_kind(&kind), |
142 | 141 | ||
143 | TK::Lifetime { starts_with_number: false } => LIFETIME, | 142 | rustc_lexer::TokenKind::Lifetime { starts_with_number: false } => LIFETIME, |
144 | TK::Lifetime { starts_with_number: true } => { | 143 | rustc_lexer::TokenKind::Lifetime { starts_with_number: true } => { |
145 | return (LIFETIME, Some("Lifetime name cannot start with a number")) | 144 | return (LIFETIME, Some("Lifetime name cannot start with a number")) |
146 | } | 145 | } |
147 | 146 | ||
148 | TK::Semi => SEMI, | 147 | rustc_lexer::TokenKind::Semi => T![;], |
149 | TK::Comma => COMMA, | 148 | rustc_lexer::TokenKind::Comma => T![,], |
150 | TK::Dot => DOT, | 149 | rustc_lexer::TokenKind::Dot => T![.], |
151 | TK::OpenParen => L_PAREN, | 150 | rustc_lexer::TokenKind::OpenParen => T!['('], |
152 | TK::CloseParen => R_PAREN, | 151 | rustc_lexer::TokenKind::CloseParen => T![')'], |
153 | TK::OpenBrace => L_CURLY, | 152 | rustc_lexer::TokenKind::OpenBrace => T!['{'], |
154 | TK::CloseBrace => R_CURLY, | 153 | rustc_lexer::TokenKind::CloseBrace => T!['}'], |
155 | TK::OpenBracket => L_BRACK, | 154 | rustc_lexer::TokenKind::OpenBracket => T!['['], |
156 | TK::CloseBracket => R_BRACK, | 155 | rustc_lexer::TokenKind::CloseBracket => T![']'], |
157 | TK::At => AT, | 156 | rustc_lexer::TokenKind::At => T![@], |
158 | TK::Pound => POUND, | 157 | rustc_lexer::TokenKind::Pound => T![#], |
159 | TK::Tilde => TILDE, | 158 | rustc_lexer::TokenKind::Tilde => T![~], |
160 | TK::Question => QUESTION, | 159 | rustc_lexer::TokenKind::Question => T![?], |
161 | TK::Colon => COLON, | 160 | rustc_lexer::TokenKind::Colon => T![:], |
162 | TK::Dollar => DOLLAR, | 161 | rustc_lexer::TokenKind::Dollar => T![$], |
163 | TK::Eq => EQ, | 162 | rustc_lexer::TokenKind::Eq => T![=], |
164 | TK::Not => EXCL, | 163 | rustc_lexer::TokenKind::Not => T![!], |
165 | TK::Lt => L_ANGLE, | 164 | rustc_lexer::TokenKind::Lt => T![<], |
166 | TK::Gt => R_ANGLE, | 165 | rustc_lexer::TokenKind::Gt => T![>], |
167 | TK::Minus => MINUS, | 166 | rustc_lexer::TokenKind::Minus => T![-], |
168 | TK::And => AMP, | 167 | rustc_lexer::TokenKind::And => T![&], |
169 | TK::Or => PIPE, | 168 | rustc_lexer::TokenKind::Or => T![|], |
170 | TK::Plus => PLUS, | 169 | rustc_lexer::TokenKind::Plus => T![+], |
171 | TK::Star => STAR, | 170 | rustc_lexer::TokenKind::Star => T![*], |
172 | TK::Slash => SLASH, | 171 | rustc_lexer::TokenKind::Slash => T![/], |
173 | TK::Caret => CARET, | 172 | rustc_lexer::TokenKind::Caret => T![^], |
174 | TK::Percent => PERCENT, | 173 | rustc_lexer::TokenKind::Percent => T![%], |
175 | TK::Unknown => ERROR, | 174 | rustc_lexer::TokenKind::Unknown => ERROR, |
176 | } | 175 | } |
177 | }; | 176 | }; |
178 | 177 | ||
diff --git a/crates/ra_syntax/src/ptr.rs b/crates/ra_syntax/src/ptr.rs index db6230aab..bc48a2e71 100644 --- a/crates/ra_syntax/src/ptr.rs +++ b/crates/ra_syntax/src/ptr.rs | |||
@@ -10,7 +10,7 @@ use crate::{AstNode, SyntaxKind, SyntaxNode, TextRange}; | |||
10 | 10 | ||
11 | /// A pointer to a syntax node inside a file. It can be used to remember a | 11 | /// A pointer to a syntax node inside a file. It can be used to remember a |
12 | /// specific node across reparses of the same file. | 12 | /// specific node across reparses of the same file. |
13 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 13 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
14 | pub struct SyntaxNodePtr { | 14 | pub struct SyntaxNodePtr { |
15 | pub(crate) range: TextRange, | 15 | pub(crate) range: TextRange, |
16 | kind: SyntaxKind, | 16 | kind: SyntaxKind, |
@@ -21,7 +21,7 @@ impl SyntaxNodePtr { | |||
21 | SyntaxNodePtr { range: node.text_range(), kind: node.kind() } | 21 | SyntaxNodePtr { range: node.text_range(), kind: node.kind() } |
22 | } | 22 | } |
23 | 23 | ||
24 | pub fn to_node(self, root: &SyntaxNode) -> SyntaxNode { | 24 | pub fn to_node(&self, root: &SyntaxNode) -> SyntaxNode { |
25 | assert!(root.parent().is_none()); | 25 | assert!(root.parent().is_none()); |
26 | successors(Some(root.clone()), |node| { | 26 | successors(Some(root.clone()), |node| { |
27 | node.children().find(|it| self.range.is_subrange(&it.text_range())) | 27 | node.children().find(|it| self.range.is_subrange(&it.text_range())) |
@@ -30,11 +30,11 @@ impl SyntaxNodePtr { | |||
30 | .unwrap_or_else(|| panic!("can't resolve local ptr to SyntaxNode: {:?}", self)) | 30 | .unwrap_or_else(|| panic!("can't resolve local ptr to SyntaxNode: {:?}", self)) |
31 | } | 31 | } |
32 | 32 | ||
33 | pub fn range(self) -> TextRange { | 33 | pub fn range(&self) -> TextRange { |
34 | self.range | 34 | self.range |
35 | } | 35 | } |
36 | 36 | ||
37 | pub fn kind(self) -> SyntaxKind { | 37 | pub fn kind(&self) -> SyntaxKind { |
38 | self.kind | 38 | self.kind |
39 | } | 39 | } |
40 | 40 | ||
@@ -53,10 +53,9 @@ pub struct AstPtr<N: AstNode> { | |||
53 | _ty: PhantomData<fn() -> N>, | 53 | _ty: PhantomData<fn() -> N>, |
54 | } | 54 | } |
55 | 55 | ||
56 | impl<N: AstNode> Copy for AstPtr<N> {} | ||
57 | impl<N: AstNode> Clone for AstPtr<N> { | 56 | impl<N: AstNode> Clone for AstPtr<N> { |
58 | fn clone(&self) -> AstPtr<N> { | 57 | fn clone(&self) -> AstPtr<N> { |
59 | *self | 58 | AstPtr { raw: self.raw.clone(), _ty: PhantomData } |
60 | } | 59 | } |
61 | } | 60 | } |
62 | 61 | ||
@@ -79,13 +78,13 @@ impl<N: AstNode> AstPtr<N> { | |||
79 | AstPtr { raw: SyntaxNodePtr::new(node.syntax()), _ty: PhantomData } | 78 | AstPtr { raw: SyntaxNodePtr::new(node.syntax()), _ty: PhantomData } |
80 | } | 79 | } |
81 | 80 | ||
82 | pub fn to_node(self, root: &SyntaxNode) -> N { | 81 | pub fn to_node(&self, root: &SyntaxNode) -> N { |
83 | let syntax_node = self.raw.to_node(root); | 82 | let syntax_node = self.raw.to_node(root); |
84 | N::cast(syntax_node).unwrap() | 83 | N::cast(syntax_node).unwrap() |
85 | } | 84 | } |
86 | 85 | ||
87 | pub fn syntax_node_ptr(self) -> SyntaxNodePtr { | 86 | pub fn syntax_node_ptr(&self) -> SyntaxNodePtr { |
88 | self.raw | 87 | self.raw.clone() |
89 | } | 88 | } |
90 | 89 | ||
91 | pub fn cast<U: AstNode>(self) -> Option<AstPtr<U>> { | 90 | pub fn cast<U: AstNode>(self) -> Option<AstPtr<U>> { |
diff --git a/crates/ra_syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.txt b/crates/ra_syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.txt index 782dfd974..290e0bd7c 100644 --- a/crates/ra_syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.txt +++ b/crates/ra_syntax/test_data/lexer/err/0049_unstarted_raw_string_with_ascii.txt | |||
@@ -6,5 +6,5 @@ WHITESPACE 1 " " | |||
6 | IDENT 1 "a" | 6 | IDENT 1 "a" |
7 | WHITESPACE 1 " " | 7 | WHITESPACE 1 " " |
8 | IDENT 5 "quote" | 8 | IDENT 5 "quote" |
9 | EXCL 1 "!" | 9 | BANG 1 "!" |
10 | > error[0; 4) token("r## ") msg(Missing `"` symbol after `#` symbols to begin the raw string literal) | 10 | > error[0; 4) token("r## ") msg(Missing `"` symbol after `#` symbols to begin the raw string literal) |
diff --git a/crates/ra_syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.txt b/crates/ra_syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.txt index 59c40cd65..5c492906d 100644 --- a/crates/ra_syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.txt +++ b/crates/ra_syntax/test_data/lexer/err/0050_unstarted_raw_byte_string_with_ascii.txt | |||
@@ -6,5 +6,5 @@ WHITESPACE 1 " " | |||
6 | IDENT 1 "a" | 6 | IDENT 1 "a" |
7 | WHITESPACE 1 " " | 7 | WHITESPACE 1 " " |
8 | IDENT 5 "quote" | 8 | IDENT 5 "quote" |
9 | EXCL 1 "!" | 9 | BANG 1 "!" |
10 | > error[0; 5) token("br## ") msg(Missing `"` symbol after `#` symbols to begin the raw byte string literal) | 10 | > error[0; 5) token("br## ") msg(Missing `"` symbol after `#` symbols to begin the raw byte string literal) |
diff --git a/crates/ra_syntax/test_data/lexer/ok/0005_symbols.txt b/crates/ra_syntax/test_data/lexer/ok/0005_symbols.txt index 469a90e42..2049c2f1d 100644 --- a/crates/ra_syntax/test_data/lexer/ok/0005_symbols.txt +++ b/crates/ra_syntax/test_data/lexer/ok/0005_symbols.txt | |||
@@ -1,4 +1,4 @@ | |||
1 | SEMI 1 ";" | 1 | SEMICOLON 1 ";" |
2 | WHITESPACE 1 " " | 2 | WHITESPACE 1 " " |
3 | COMMA 1 "," | 3 | COMMA 1 "," |
4 | WHITESPACE 1 " " | 4 | WHITESPACE 1 " " |
@@ -65,9 +65,9 @@ WHITESPACE 1 " " | |||
65 | EQ 1 "=" | 65 | EQ 1 "=" |
66 | R_ANGLE 1 ">" | 66 | R_ANGLE 1 ">" |
67 | WHITESPACE 1 "\n" | 67 | WHITESPACE 1 "\n" |
68 | EXCL 1 "!" | 68 | BANG 1 "!" |
69 | WHITESPACE 1 " " | 69 | WHITESPACE 1 " " |
70 | EXCL 1 "!" | 70 | BANG 1 "!" |
71 | EQ 1 "=" | 71 | EQ 1 "=" |
72 | WHITESPACE 1 "\n" | 72 | WHITESPACE 1 "\n" |
73 | MINUS 1 "-" | 73 | MINUS 1 "-" |
diff --git a/crates/ra_syntax/test_data/parser/err/0002_duplicate_shebang.rast b/crates/ra_syntax/test_data/parser/err/0002_duplicate_shebang.rast index 002680583..831bbf83f 100644 --- a/crates/ra_syntax/test_data/parser/err/0002_duplicate_shebang.rast +++ b/crates/ra_syntax/test_data/parser/err/0002_duplicate_shebang.rast | |||
@@ -3,7 +3,7 @@ SOURCE_FILE@[0; 42) | |||
3 | WHITESPACE@[20; 21) "\n" | 3 | WHITESPACE@[20; 21) "\n" |
4 | ATTR@[21; 23) | 4 | ATTR@[21; 23) |
5 | POUND@[21; 22) "#" | 5 | POUND@[21; 22) "#" |
6 | EXCL@[22; 23) "!" | 6 | BANG@[22; 23) "!" |
7 | ERROR@[23; 24) | 7 | ERROR@[23; 24) |
8 | SLASH@[23; 24) "/" | 8 | SLASH@[23; 24) "/" |
9 | USE_ITEM@[24; 28) | 9 | USE_ITEM@[24; 28) |
@@ -29,11 +29,11 @@ SOURCE_FILE@[0; 42) | |||
29 | error [23; 23): expected `[` | 29 | error [23; 23): expected `[` |
30 | error [23; 23): expected an item | 30 | error [23; 23): expected an item |
31 | error [27; 27): expected one of `*`, `::`, `{`, `self`, `super` or an identifier | 31 | error [27; 27): expected one of `*`, `::`, `{`, `self`, `super` or an identifier |
32 | error [28; 28): expected SEMI | 32 | error [28; 28): expected SEMICOLON |
33 | error [31; 31): expected EXCL | 33 | error [31; 31): expected BANG |
34 | error [31; 31): expected `{`, `[`, `(` | 34 | error [31; 31): expected `{`, `[`, `(` |
35 | error [31; 31): expected SEMI | 35 | error [31; 31): expected SEMICOLON |
36 | error [31; 31): expected an item | 36 | error [31; 31): expected an item |
37 | error [35; 35): expected EXCL | 37 | error [35; 35): expected BANG |
38 | error [41; 41): expected `{`, `[`, `(` | 38 | error [41; 41): expected `{`, `[`, `(` |
39 | error [41; 41): expected SEMI | 39 | error [41; 41): expected SEMICOLON |
diff --git a/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rast b/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rast index 8039a8913..6b89e7572 100644 --- a/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rast +++ b/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rast | |||
@@ -34,6 +34,6 @@ SOURCE_FILE@[0; 40) | |||
34 | WHITESPACE@[37; 38) "\n" | 34 | WHITESPACE@[37; 38) "\n" |
35 | R_CURLY@[38; 39) "}" | 35 | R_CURLY@[38; 39) "}" |
36 | ERROR@[39; 40) | 36 | ERROR@[39; 40) |
37 | SEMI@[39; 40) ";" | 37 | SEMICOLON@[39; 40) ";" |
38 | error [39; 39): expected item, found `;` | 38 | error [39; 39): expected item, found `;` |
39 | consider removing this semicolon | 39 | consider removing this semicolon |
diff --git a/crates/ra_syntax/test_data/parser/err/0004_use_path_bad_segment.rast b/crates/ra_syntax/test_data/parser/err/0004_use_path_bad_segment.rast index 5f6e10986..1d27d4cd6 100644 --- a/crates/ra_syntax/test_data/parser/err/0004_use_path_bad_segment.rast +++ b/crates/ra_syntax/test_data/parser/err/0004_use_path_bad_segment.rast | |||
@@ -8,9 +8,9 @@ SOURCE_FILE@[0; 12) | |||
8 | PATH_SEGMENT@[4; 7) | 8 | PATH_SEGMENT@[4; 7) |
9 | NAME_REF@[4; 7) | 9 | NAME_REF@[4; 7) |
10 | IDENT@[4; 7) "foo" | 10 | IDENT@[4; 7) "foo" |
11 | COLONCOLON@[7; 9) "::" | 11 | COLON2@[7; 9) "::" |
12 | PATH_SEGMENT@[9; 11) | 12 | PATH_SEGMENT@[9; 11) |
13 | ERROR@[9; 11) | 13 | ERROR@[9; 11) |
14 | INT_NUMBER@[9; 11) "92" | 14 | INT_NUMBER@[9; 11) "92" |
15 | SEMI@[11; 12) ";" | 15 | SEMICOLON@[11; 12) ";" |
16 | error [9; 9): expected identifier | 16 | error [9; 9): expected identifier |
diff --git a/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast b/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast index 1978f30fa..c24e478f3 100644 --- a/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast +++ b/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast | |||
@@ -7,7 +7,7 @@ SOURCE_FILE@[0; 31) | |||
7 | WHITESPACE@[9; 10) " " | 7 | WHITESPACE@[9; 10) " " |
8 | NAME@[10; 11) | 8 | NAME@[10; 11) |
9 | IDENT@[10; 11) "S" | 9 | IDENT@[10; 11) "S" |
10 | SEMI@[11; 12) ";" | 10 | SEMICOLON@[11; 12) ";" |
11 | WHITESPACE@[12; 14) "\n\n" | 11 | WHITESPACE@[12; 14) "\n\n" |
12 | ERROR@[14; 15) | 12 | ERROR@[14; 15) |
13 | R_CURLY@[14; 15) "}" | 13 | R_CURLY@[14; 15) "}" |
diff --git a/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rast b/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rast index 98248227d..9f5041ae4 100644 --- a/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rast +++ b/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rast | |||
@@ -76,6 +76,6 @@ SOURCE_FILE@[0; 95) | |||
76 | WHITESPACE@[92; 93) "\n" | 76 | WHITESPACE@[92; 93) "\n" |
77 | R_CURLY@[93; 94) "}" | 77 | R_CURLY@[93; 94) "}" |
78 | WHITESPACE@[94; 95) "\n" | 78 | WHITESPACE@[94; 95) "\n" |
79 | error [17; 17): expected EXCL | 79 | error [17; 17): expected BANG |
80 | error [19; 19): expected SEMI | 80 | error [19; 19): expected SEMICOLON |
81 | error [20; 20): expected an item | 81 | error [20; 20): expected an item |
diff --git a/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast b/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast index ca508ac7c..7ed80477d 100644 --- a/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast +++ b/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast | |||
@@ -43,7 +43,7 @@ SOURCE_FILE@[0; 43) | |||
43 | WHITESPACE@[39; 40) " " | 43 | WHITESPACE@[39; 40) " " |
44 | NAME@[40; 41) | 44 | NAME@[40; 41) |
45 | IDENT@[40; 41) "T" | 45 | IDENT@[40; 41) "T" |
46 | SEMI@[41; 42) ";" | 46 | SEMICOLON@[41; 42) ";" |
47 | WHITESPACE@[42; 43) "\n" | 47 | WHITESPACE@[42; 43) "\n" |
48 | error [9; 9): expected type parameter | 48 | error [9; 9): expected type parameter |
49 | error [11; 11): expected COMMA | 49 | error [11; 11): expected COMMA |
@@ -53,6 +53,6 @@ error [12; 12): expected an item | |||
53 | error [14; 14): expected an item | 53 | error [14; 14): expected an item |
54 | error [15; 15): expected an item | 54 | error [15; 15): expected an item |
55 | error [17; 17): expected an item | 55 | error [17; 17): expected an item |
56 | error [24; 24): expected SEMI | 56 | error [24; 24): expected SEMICOLON |
57 | error [24; 24): expected expression | 57 | error [24; 24): expected expression |
58 | error [25; 25): expected SEMI | 58 | error [25; 25): expected SEMICOLON |
diff --git a/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast b/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast index 0ffbd25aa..5559c3297 100644 --- a/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast +++ b/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast | |||
@@ -37,9 +37,9 @@ SOURCE_FILE@[0; 42) | |||
37 | R_PAREN@[35; 36) ")" | 37 | R_PAREN@[35; 36) ")" |
38 | WHITESPACE@[36; 37) " " | 38 | WHITESPACE@[36; 37) " " |
39 | R_CURLY@[37; 38) "}" | 39 | R_CURLY@[37; 38) "}" |
40 | SEMI@[38; 39) ";" | 40 | SEMICOLON@[38; 39) ";" |
41 | WHITESPACE@[39; 40) "\n" | 41 | WHITESPACE@[39; 40) "\n" |
42 | R_CURLY@[40; 41) "}" | 42 | R_CURLY@[40; 41) "}" |
43 | WHITESPACE@[41; 42) "\n" | 43 | WHITESPACE@[41; 42) "\n" |
44 | error [24; 24): expected `{` | 44 | error [24; 24): expected `{` |
45 | error [24; 24): expected SEMI | 45 | error [24; 24): expected SEMICOLON |
diff --git a/crates/ra_syntax/test_data/parser/err/0011_extern_struct.rast b/crates/ra_syntax/test_data/parser/err/0011_extern_struct.rast index 900894dcf..99c212fd6 100644 --- a/crates/ra_syntax/test_data/parser/err/0011_extern_struct.rast +++ b/crates/ra_syntax/test_data/parser/err/0011_extern_struct.rast | |||
@@ -8,6 +8,6 @@ SOURCE_FILE@[0; 19) | |||
8 | WHITESPACE@[13; 14) " " | 8 | WHITESPACE@[13; 14) " " |
9 | NAME@[14; 17) | 9 | NAME@[14; 17) |
10 | IDENT@[14; 17) "Foo" | 10 | IDENT@[14; 17) "Foo" |
11 | SEMI@[17; 18) ";" | 11 | SEMICOLON@[17; 18) ";" |
12 | WHITESPACE@[18; 19) "\n" | 12 | WHITESPACE@[18; 19) "\n" |
13 | error [6; 6): expected existential, fn, trait or impl | 13 | error [6; 6): expected existential, fn, trait or impl |
diff --git a/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast b/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast index 12ebc2a3a..0a3c0313d 100644 --- a/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast +++ b/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast | |||
@@ -106,7 +106,7 @@ SOURCE_FILE@[0; 389) | |||
106 | WHITESPACE@[122; 123) | 106 | WHITESPACE@[122; 123) |
107 | LITERAL@[123; 124) | 107 | LITERAL@[123; 124) |
108 | INT_NUMBER@[123; 124) "0" | 108 | INT_NUMBER@[123; 124) "0" |
109 | SEMI@[124; 125) | 109 | SEMICOLON@[124; 125) |
110 | WHITESPACE@[125; 130) | 110 | WHITESPACE@[125; 130) |
111 | LET_STMT@[130; 389) | 111 | LET_STMT@[130; 389) |
112 | LET_KW@[130; 133) | 112 | LET_KW@[130; 133) |
@@ -226,7 +226,7 @@ SOURCE_FILE@[0; 389) | |||
226 | err: `expected pattern` | 226 | err: `expected pattern` |
227 | PARAM@[236; 237) | 227 | PARAM@[236; 237) |
228 | ERROR@[236; 237) | 228 | ERROR@[236; 237) |
229 | EXCL@[236; 237) | 229 | BANG@[236; 237) |
230 | err: `expected COMMA` | 230 | err: `expected COMMA` |
231 | PARAM@[237; 242) | 231 | PARAM@[237; 242) |
232 | BIND_PAT@[237; 242) | 232 | BIND_PAT@[237; 242) |
@@ -272,7 +272,7 @@ SOURCE_FILE@[0; 389) | |||
272 | err: `expected pattern` | 272 | err: `expected pattern` |
273 | PARAM@[283; 284) | 273 | PARAM@[283; 284) |
274 | ERROR@[283; 284) | 274 | ERROR@[283; 284) |
275 | SEMI@[283; 284) | 275 | SEMICOLON@[283; 284) |
276 | err: `expected COMMA` | 276 | err: `expected COMMA` |
277 | WHITESPACE@[284; 297) | 277 | WHITESPACE@[284; 297) |
278 | err: `expected pattern` | 278 | err: `expected pattern` |
@@ -327,7 +327,7 @@ SOURCE_FILE@[0; 389) | |||
327 | err: `expected pattern` | 327 | err: `expected pattern` |
328 | PARAM@[346; 347) | 328 | PARAM@[346; 347) |
329 | ERROR@[346; 347) | 329 | ERROR@[346; 347) |
330 | SEMI@[346; 347) | 330 | SEMICOLON@[346; 347) |
331 | err: `expected COMMA` | 331 | err: `expected COMMA` |
332 | WHITESPACE@[347; 360) | 332 | WHITESPACE@[347; 360) |
333 | err: `expected pattern` | 333 | err: `expected pattern` |
@@ -371,7 +371,7 @@ SOURCE_FILE@[0; 389) | |||
371 | err: `expected pattern` | 371 | err: `expected pattern` |
372 | PARAM@[385; 386) | 372 | PARAM@[385; 386) |
373 | ERROR@[385; 386) | 373 | ERROR@[385; 386) |
374 | SEMI@[385; 386) | 374 | SEMICOLON@[385; 386) |
375 | err: `expected COMMA` | 375 | err: `expected COMMA` |
376 | WHITESPACE@[386; 387) | 376 | WHITESPACE@[386; 387) |
377 | err: `expected pattern` | 377 | err: `expected pattern` |
diff --git a/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast b/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast index 7a934cf66..cb570dc1c 100644 --- a/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast +++ b/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast | |||
@@ -67,7 +67,7 @@ SOURCE_FILE@[0; 86) | |||
67 | ERROR@[82; 83) | 67 | ERROR@[82; 83) |
68 | R_PAREN@[82; 83) ")" | 68 | R_PAREN@[82; 83) ")" |
69 | ERROR@[83; 84) | 69 | ERROR@[83; 84) |
70 | SEMI@[83; 84) ";" | 70 | SEMICOLON@[83; 84) ";" |
71 | WHITESPACE@[84; 86) "\n\n" | 71 | WHITESPACE@[84; 86) "\n\n" |
72 | error [67; 67): expected type | 72 | error [67; 67): expected type |
73 | error [68; 68): expected COMMA | 73 | error [68; 68): expected COMMA |
@@ -80,7 +80,7 @@ error [68; 68): expected COMMA | |||
80 | error [72; 72): expected COMMA | 80 | error [72; 72): expected COMMA |
81 | error [72; 72): expected a type | 81 | error [72; 72): expected a type |
82 | error [72; 72): expected R_PAREN | 82 | error [72; 72): expected R_PAREN |
83 | error [72; 72): expected SEMI | 83 | error [72; 72): expected SEMICOLON |
84 | error [72; 72): expected an item | 84 | error [72; 72): expected an item |
85 | error [73; 73): expected an item | 85 | error [73; 73): expected an item |
86 | error [79; 79): expected an item | 86 | error [79; 79): expected an item |
diff --git a/crates/ra_syntax/test_data/parser/err/0016_missing_semi.rast b/crates/ra_syntax/test_data/parser/err/0016_missing_semi.rast index 6343580e0..aca5a3ada 100644 --- a/crates/ra_syntax/test_data/parser/err/0016_missing_semi.rast +++ b/crates/ra_syntax/test_data/parser/err/0016_missing_semi.rast | |||
@@ -37,8 +37,8 @@ SOURCE_FILE@[0; 56) | |||
37 | WHITESPACE@[49; 50) " " | 37 | WHITESPACE@[49; 50) " " |
38 | LITERAL@[50; 52) | 38 | LITERAL@[50; 52) |
39 | INT_NUMBER@[50; 52) "92" | 39 | INT_NUMBER@[50; 52) "92" |
40 | SEMI@[52; 53) ";" | 40 | SEMICOLON@[52; 53) ";" |
41 | WHITESPACE@[53; 54) "\n" | 41 | WHITESPACE@[53; 54) "\n" |
42 | R_CURLY@[54; 55) "}" | 42 | R_CURLY@[54; 55) "}" |
43 | WHITESPACE@[55; 56) "\n" | 43 | WHITESPACE@[55; 56) "\n" |
44 | error [38; 38): expected SEMI | 44 | error [38; 38): expected SEMICOLON |
diff --git a/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rast b/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rast index 59480e999..f9f4b9bc2 100644 --- a/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rast +++ b/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rast | |||
@@ -34,7 +34,7 @@ SOURCE_FILE@[0; 47) | |||
34 | WHITESPACE@[32; 33) " " | 34 | WHITESPACE@[32; 33) " " |
35 | LITERAL@[33; 35) | 35 | LITERAL@[33; 35) |
36 | INT_NUMBER@[33; 35) "92" | 36 | INT_NUMBER@[33; 35) "92" |
37 | SEMI@[35; 36) ";" | 37 | SEMICOLON@[35; 36) ";" |
38 | WHITESPACE@[36; 41) "\n " | 38 | WHITESPACE@[36; 41) "\n " |
39 | BIN_EXPR@[41; 44) | 39 | BIN_EXPR@[41; 44) |
40 | LITERAL@[41; 42) | 40 | LITERAL@[41; 42) |
diff --git a/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast b/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast index 4b13a7236..9a8f76673 100644 --- a/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast +++ b/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast | |||
@@ -60,7 +60,7 @@ SOURCE_FILE@[0; 183) | |||
60 | ARG_LIST@[82; 84) | 60 | ARG_LIST@[82; 84) |
61 | L_PAREN@[82; 83) "(" | 61 | L_PAREN@[82; 83) "(" |
62 | R_PAREN@[83; 84) ")" | 62 | R_PAREN@[83; 84) ")" |
63 | SEMI@[84; 85) ";" | 63 | SEMICOLON@[84; 85) ";" |
64 | WHITESPACE@[85; 94) "\n " | 64 | WHITESPACE@[85; 94) "\n " |
65 | METHOD_CALL_EXPR@[94; 155) | 65 | METHOD_CALL_EXPR@[94; 155) |
66 | FIELD_EXPR@[94; 105) | 66 | FIELD_EXPR@[94; 105) |
@@ -107,7 +107,7 @@ SOURCE_FILE@[0; 183) | |||
107 | PATH_SEGMENT@[146; 149) | 107 | PATH_SEGMENT@[146; 149) |
108 | NAME_REF@[146; 149) | 108 | NAME_REF@[146; 149) |
109 | IDENT@[146; 149) "vec" | 109 | IDENT@[146; 149) "vec" |
110 | EXCL@[149; 150) "!" | 110 | BANG@[149; 150) "!" |
111 | TOKEN_TREE@[150; 152) | 111 | TOKEN_TREE@[150; 152) |
112 | L_BRACK@[150; 151) "[" | 112 | L_BRACK@[150; 151) "[" |
113 | R_BRACK@[151; 152) "]" | 113 | R_BRACK@[151; 152) "]" |
diff --git a/crates/ra_syntax/test_data/parser/err/0019_let_recover.rast b/crates/ra_syntax/test_data/parser/err/0019_let_recover.rast index 97e91a94f..e283091e1 100644 --- a/crates/ra_syntax/test_data/parser/err/0019_let_recover.rast +++ b/crates/ra_syntax/test_data/parser/err/0019_let_recover.rast | |||
@@ -32,7 +32,7 @@ SOURCE_FILE@[0; 139) | |||
32 | WHITESPACE@[38; 39) " " | 32 | WHITESPACE@[38; 39) " " |
33 | LITERAL@[39; 40) | 33 | LITERAL@[39; 40) |
34 | INT_NUMBER@[39; 40) "1" | 34 | INT_NUMBER@[39; 40) "1" |
35 | SEMI@[40; 41) ";" | 35 | SEMICOLON@[40; 41) ";" |
36 | WHITESPACE@[41; 46) "\n " | 36 | WHITESPACE@[41; 46) "\n " |
37 | LET_STMT@[46; 49) | 37 | LET_STMT@[46; 49) |
38 | LET_KW@[46; 49) "let" | 38 | LET_KW@[46; 49) "let" |
@@ -48,7 +48,7 @@ SOURCE_FILE@[0; 139) | |||
48 | WHITESPACE@[63; 64) " " | 48 | WHITESPACE@[63; 64) " " |
49 | LITERAL@[64; 66) | 49 | LITERAL@[64; 66) |
50 | INT_NUMBER@[64; 66) "92" | 50 | INT_NUMBER@[64; 66) "92" |
51 | SEMI@[66; 67) ";" | 51 | SEMICOLON@[66; 67) ";" |
52 | WHITESPACE@[67; 72) "\n " | 52 | WHITESPACE@[67; 72) "\n " |
53 | LET_STMT@[72; 75) | 53 | LET_STMT@[72; 75) |
54 | LET_KW@[72; 75) "let" | 54 | LET_KW@[72; 75) "let" |
@@ -96,12 +96,12 @@ SOURCE_FILE@[0; 139) | |||
96 | R_CURLY@[137; 138) "}" | 96 | R_CURLY@[137; 138) "}" |
97 | WHITESPACE@[138; 139) "\n" | 97 | WHITESPACE@[138; 139) "\n" |
98 | error [24; 24): expected expression | 98 | error [24; 24): expected expression |
99 | error [24; 24): expected SEMI | 99 | error [24; 24): expected SEMICOLON |
100 | error [49; 49): expected pattern | 100 | error [49; 49): expected pattern |
101 | error [49; 49): expected SEMI | 101 | error [49; 49): expected SEMICOLON |
102 | error [75; 75): expected pattern | 102 | error [75; 75): expected pattern |
103 | error [75; 75): expected SEMI | 103 | error [75; 75): expected SEMICOLON |
104 | error [98; 98): expected pattern | 104 | error [98; 98): expected pattern |
105 | error [98; 98): expected SEMI | 105 | error [98; 98): expected SEMICOLON |
106 | error [124; 124): expected pattern | 106 | error [124; 124): expected pattern |
107 | error [124; 124): expected SEMI | 107 | error [124; 124): expected SEMICOLON |
diff --git a/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast index 9f50c85e5..465749f95 100644 --- a/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast +++ b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast | |||
@@ -150,34 +150,34 @@ SOURCE_FILE@[0; 112) | |||
150 | WHITESPACE@[111; 112) "\n" | 150 | WHITESPACE@[111; 112) "\n" |
151 | error [16; 16): expected expression | 151 | error [16; 16): expected expression |
152 | error [17; 17): expected R_BRACK | 152 | error [17; 17): expected R_BRACK |
153 | error [17; 17): expected SEMI | 153 | error [17; 17): expected SEMICOLON |
154 | error [17; 17): expected expression | 154 | error [17; 17): expected expression |
155 | error [18; 18): expected SEMI | 155 | error [18; 18): expected SEMICOLON |
156 | error [25; 25): expected a name | 156 | error [25; 25): expected a name |
157 | error [26; 26): expected `;`, `{`, or `(` | 157 | error [26; 26): expected `;`, `{`, or `(` |
158 | error [30; 30): expected pattern | 158 | error [30; 30): expected pattern |
159 | error [31; 31): expected SEMI | 159 | error [31; 31): expected SEMICOLON |
160 | error [53; 53): expected expression | 160 | error [53; 53): expected expression |
161 | error [54; 54): expected SEMI | 161 | error [54; 54): expected SEMICOLON |
162 | error [54; 54): expected expression | 162 | error [54; 54): expected expression |
163 | error [55; 55): expected SEMI | 163 | error [55; 55): expected SEMICOLON |
164 | error [60; 60): expected type | 164 | error [60; 60): expected type |
165 | error [60; 60): expected `{` | 165 | error [60; 60): expected `{` |
166 | error [60; 60): expected expression | 166 | error [60; 60): expected expression |
167 | error [61; 61): expected SEMI | 167 | error [61; 61): expected SEMICOLON |
168 | error [65; 65): expected pattern | 168 | error [65; 65): expected pattern |
169 | error [65; 65): expected SEMI | 169 | error [65; 65): expected SEMICOLON |
170 | error [65; 65): expected expression | 170 | error [65; 65): expected expression |
171 | error [92; 92): expected expression | 171 | error [92; 92): expected expression |
172 | error [93; 93): expected SEMI | 172 | error [93; 93): expected SEMICOLON |
173 | error [93; 93): expected expression | 173 | error [93; 93): expected expression |
174 | error [94; 94): expected SEMI | 174 | error [94; 94): expected SEMICOLON |
175 | error [95; 95): expected expression | 175 | error [95; 95): expected expression |
176 | error [96; 96): expected SEMI | 176 | error [96; 96): expected SEMICOLON |
177 | error [96; 96): expected expression | 177 | error [96; 96): expected expression |
178 | error [97; 97): expected SEMI | 178 | error [97; 97): expected SEMICOLON |
179 | error [103; 103): expected a name | 179 | error [103; 103): expected a name |
180 | error [104; 104): expected `{` | 180 | error [104; 104): expected `{` |
181 | error [108; 108): expected pattern | 181 | error [108; 108): expected pattern |
182 | error [108; 108): expected SEMI | 182 | error [108; 108): expected SEMICOLON |
183 | error [108; 108): expected expression | 183 | error [108; 108): expected expression |
diff --git a/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rast b/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rast index 775e4b0da..97abe9510 100644 --- a/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rast +++ b/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rast | |||
@@ -17,7 +17,7 @@ SOURCE_FILE@[0; 94) | |||
17 | PATH_SEGMENT@[16; 19) | 17 | PATH_SEGMENT@[16; 19) |
18 | NAME_REF@[16; 19) | 18 | NAME_REF@[16; 19) |
19 | IDENT@[16; 19) "foo" | 19 | IDENT@[16; 19) "foo" |
20 | EXCL@[19; 20) "!" | 20 | BANG@[19; 20) "!" |
21 | WHITESPACE@[20; 21) " " | 21 | WHITESPACE@[20; 21) " " |
22 | TOKEN_TREE@[21; 49) | 22 | TOKEN_TREE@[21; 49) |
23 | L_PAREN@[21; 22) "(" | 23 | L_PAREN@[21; 22) "(" |
diff --git a/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast b/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast index c5c8a29ba..a3cf3e60a 100644 --- a/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast +++ b/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast | |||
@@ -144,7 +144,7 @@ SOURCE_FILE@[0; 240) | |||
144 | EXPR_STMT@[121; 123) | 144 | EXPR_STMT@[121; 123) |
145 | ERROR@[121; 122) | 145 | ERROR@[121; 122) |
146 | R_ANGLE@[121; 122) ">" | 146 | R_ANGLE@[121; 122) ">" |
147 | SEMI@[122; 123) ";" | 147 | SEMICOLON@[122; 123) ";" |
148 | WHITESPACE@[123; 128) "\n " | 148 | WHITESPACE@[123; 128) "\n " |
149 | LET_STMT@[128; 141) | 149 | LET_STMT@[128; 141) |
150 | LET_KW@[128; 131) "let" | 150 | LET_KW@[128; 131) "let" |
@@ -219,7 +219,7 @@ SOURCE_FILE@[0; 240) | |||
219 | R_PAREN@[177; 178) ")" | 219 | R_PAREN@[177; 178) ")" |
220 | R_ANGLE@[178; 179) ">" | 220 | R_ANGLE@[178; 179) ">" |
221 | ERROR@[179; 180) | 221 | ERROR@[179; 180) |
222 | SEMI@[179; 180) ";" | 222 | SEMICOLON@[179; 180) ";" |
223 | WHITESPACE@[180; 185) "\n " | 223 | WHITESPACE@[180; 185) "\n " |
224 | LET_STMT@[185; 235) | 224 | LET_STMT@[185; 235) |
225 | LET_KW@[185; 188) "let" | 225 | LET_KW@[185; 188) "let" |
@@ -286,24 +286,24 @@ SOURCE_FILE@[0; 240) | |||
286 | EXPR_STMT@[235; 237) | 286 | EXPR_STMT@[235; 237) |
287 | ERROR@[235; 236) | 287 | ERROR@[235; 236) |
288 | R_ANGLE@[235; 236) ">" | 288 | R_ANGLE@[235; 236) ">" |
289 | SEMI@[236; 237) ";" | 289 | SEMICOLON@[236; 237) ";" |
290 | WHITESPACE@[237; 238) "\n" | 290 | WHITESPACE@[237; 238) "\n" |
291 | R_CURLY@[238; 239) "}" | 291 | R_CURLY@[238; 239) "}" |
292 | WHITESPACE@[239; 240) "\n" | 292 | WHITESPACE@[239; 240) "\n" |
293 | error [88; 88): expected COMMA | 293 | error [88; 88): expected COMMA |
294 | error [88; 88): expected R_ANGLE | 294 | error [88; 88): expected R_ANGLE |
295 | error [121; 121): expected SEMI | 295 | error [121; 121): expected SEMICOLON |
296 | error [121; 121): expected expression | 296 | error [121; 121): expected expression |
297 | error [140; 140): expected type | 297 | error [140; 140): expected type |
298 | error [141; 141): expected R_PAREN | 298 | error [141; 141): expected R_PAREN |
299 | error [141; 141): expected COMMA | 299 | error [141; 141): expected COMMA |
300 | error [141; 141): expected R_ANGLE | 300 | error [141; 141): expected R_ANGLE |
301 | error [141; 141): expected SEMI | 301 | error [141; 141): expected SEMICOLON |
302 | error [146; 146): expected SEMI | 302 | error [146; 146): expected SEMICOLON |
303 | error [146; 146): expected expression | 303 | error [146; 146): expected expression |
304 | error [147; 147): expected SEMI | 304 | error [147; 147): expected SEMICOLON |
305 | error [148; 148): expected expression | 305 | error [148; 148): expected expression |
306 | error [149; 149): expected SEMI | 306 | error [149; 149): expected SEMICOLON |
307 | error [154; 154): expected pattern | 307 | error [154; 154): expected pattern |
308 | error [155; 155): expected IN_KW | 308 | error [155; 155): expected IN_KW |
309 | error [155; 155): expected expression | 309 | error [155; 155): expected expression |
@@ -314,8 +314,8 @@ error [179; 179): expected expression | |||
314 | error [180; 180): expected COMMA | 314 | error [180; 180): expected COMMA |
315 | error [180; 180): expected expression | 315 | error [180; 180): expected expression |
316 | error [180; 180): expected R_PAREN | 316 | error [180; 180): expected R_PAREN |
317 | error [180; 180): expected SEMI | 317 | error [180; 180): expected SEMICOLON |
318 | error [215; 215): expected COMMA | 318 | error [215; 215): expected COMMA |
319 | error [215; 215): expected R_ANGLE | 319 | error [215; 215): expected R_ANGLE |
320 | error [235; 235): expected SEMI | 320 | error [235; 235): expected SEMICOLON |
321 | error [235; 235): expected expression | 321 | error [235; 235): expected expression |
diff --git a/crates/ra_syntax/test_data/parser/err/0025_nope.rast b/crates/ra_syntax/test_data/parser/err/0025_nope.rast index ca7f2d255..2b37ce94d 100644 --- a/crates/ra_syntax/test_data/parser/err/0025_nope.rast +++ b/crates/ra_syntax/test_data/parser/err/0025_nope.rast | |||
@@ -78,7 +78,7 @@ SOURCE_FILE@[0; 575) | |||
78 | WHITESPACE@[183; 184) " " | 78 | WHITESPACE@[183; 184) " " |
79 | LITERAL@[184; 185) | 79 | LITERAL@[184; 185) |
80 | INT_NUMBER@[184; 185) "1" | 80 | INT_NUMBER@[184; 185) "1" |
81 | SEMI@[185; 186) ";" | 81 | SEMICOLON@[185; 186) ";" |
82 | WHITESPACE@[186; 191) "\n " | 82 | WHITESPACE@[186; 191) "\n " |
83 | ENUM_DEF@[191; 223) | 83 | ENUM_DEF@[191; 223) |
84 | ENUM_KW@[191; 195) "enum" | 84 | ENUM_KW@[191; 195) "enum" |
@@ -185,7 +185,7 @@ SOURCE_FILE@[0; 575) | |||
185 | WHITESPACE@[507; 508) " " | 185 | WHITESPACE@[507; 508) " " |
186 | ERROR@[508; 509) | 186 | ERROR@[508; 509) |
187 | UNDERSCORE@[508; 509) "_" | 187 | UNDERSCORE@[508; 509) "_" |
188 | SEMI@[509; 510) ";" | 188 | SEMICOLON@[509; 510) ";" |
189 | WHITESPACE@[510; 511) " " | 189 | WHITESPACE@[510; 511) " " |
190 | COMMENT@[511; 572) "//~ ERROR: expected e ..." | 190 | COMMENT@[511; 572) "//~ ERROR: expected e ..." |
191 | WHITESPACE@[572; 573) "\n" | 191 | WHITESPACE@[572; 573) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rast b/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rast index 522a0d0e0..00d9fd511 100644 --- a/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rast +++ b/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rast | |||
@@ -27,7 +27,7 @@ SOURCE_FILE@[0; 350) | |||
27 | WHITESPACE@[30; 39) "\n " | 27 | WHITESPACE@[30; 39) "\n " |
28 | ATTR@[39; 83) | 28 | ATTR@[39; 83) |
29 | POUND@[39; 40) "#" | 29 | POUND@[39; 40) "#" |
30 | EXCL@[40; 41) "!" | 30 | BANG@[40; 41) "!" |
31 | L_BRACK@[41; 42) "[" | 31 | L_BRACK@[41; 42) "[" |
32 | PATH@[42; 45) | 32 | PATH@[42; 45) |
33 | PATH_SEGMENT@[42; 45) | 33 | PATH_SEGMENT@[42; 45) |
@@ -42,7 +42,7 @@ SOURCE_FILE@[0; 350) | |||
42 | COMMENT@[92; 122) "//! Nor are ModuleDoc ..." | 42 | COMMENT@[92; 122) "//! Nor are ModuleDoc ..." |
43 | WHITESPACE@[122; 127) "\n " | 43 | WHITESPACE@[122; 127) "\n " |
44 | R_CURLY@[127; 128) "}" | 44 | R_CURLY@[127; 128) "}" |
45 | SEMI@[128; 129) ";" | 45 | SEMICOLON@[128; 129) ";" |
46 | WHITESPACE@[129; 134) "\n " | 46 | WHITESPACE@[129; 134) "\n " |
47 | EXPR_STMT@[134; 257) | 47 | EXPR_STMT@[134; 257) |
48 | IF_EXPR@[134; 257) | 48 | IF_EXPR@[134; 257) |
@@ -58,7 +58,7 @@ SOURCE_FILE@[0; 350) | |||
58 | WHITESPACE@[143; 152) "\n " | 58 | WHITESPACE@[143; 152) "\n " |
59 | ATTR@[152; 171) | 59 | ATTR@[152; 171) |
60 | POUND@[152; 153) "#" | 60 | POUND@[152; 153) "#" |
61 | EXCL@[153; 154) "!" | 61 | BANG@[153; 154) "!" |
62 | L_BRACK@[154; 155) "[" | 62 | L_BRACK@[154; 155) "[" |
63 | PATH@[155; 158) | 63 | PATH@[155; 158) |
64 | PATH_SEGMENT@[155; 158) | 64 | PATH_SEGMENT@[155; 158) |
@@ -72,7 +72,7 @@ SOURCE_FILE@[0; 350) | |||
72 | WHITESPACE@[171; 180) "\n " | 72 | WHITESPACE@[171; 180) "\n " |
73 | ATTR@[180; 212) | 73 | ATTR@[180; 212) |
74 | POUND@[180; 181) "#" | 74 | POUND@[180; 181) "#" |
75 | EXCL@[181; 182) "!" | 75 | BANG@[181; 182) "!" |
76 | L_BRACK@[182; 183) "[" | 76 | L_BRACK@[182; 183) "[" |
77 | PATH@[183; 186) | 77 | PATH@[183; 186) |
78 | PATH_SEGMENT@[183; 186) | 78 | PATH_SEGMENT@[183; 186) |
@@ -101,7 +101,7 @@ SOURCE_FILE@[0; 350) | |||
101 | WHITESPACE@[274; 283) "\n " | 101 | WHITESPACE@[274; 283) "\n " |
102 | ATTR@[283; 302) | 102 | ATTR@[283; 302) |
103 | POUND@[283; 284) "#" | 103 | POUND@[283; 284) "#" |
104 | EXCL@[284; 285) "!" | 104 | BANG@[284; 285) "!" |
105 | L_BRACK@[285; 286) "[" | 105 | L_BRACK@[285; 286) "[" |
106 | PATH@[286; 289) | 106 | PATH@[286; 289) |
107 | PATH_SEGMENT@[286; 289) | 107 | PATH_SEGMENT@[286; 289) |
diff --git a/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast b/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast index c36e2f770..b80101e60 100644 --- a/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast +++ b/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast | |||
@@ -38,7 +38,7 @@ SOURCE_FILE@[0; 293) | |||
38 | ATTR@[51; 52) | 38 | ATTR@[51; 52) |
39 | POUND@[51; 52) "#" | 39 | POUND@[51; 52) "#" |
40 | ERROR@[52; 53) | 40 | ERROR@[52; 53) |
41 | EXCL@[52; 53) "!" | 41 | BANG@[52; 53) "!" |
42 | ARRAY_EXPR@[53; 78) | 42 | ARRAY_EXPR@[53; 78) |
43 | L_BRACK@[53; 54) "[" | 43 | L_BRACK@[53; 54) "[" |
44 | CALL_EXPR@[54; 77) | 44 | CALL_EXPR@[54; 77) |
@@ -104,7 +104,7 @@ SOURCE_FILE@[0; 293) | |||
104 | ATTR@[160; 161) | 104 | ATTR@[160; 161) |
105 | POUND@[160; 161) "#" | 105 | POUND@[160; 161) "#" |
106 | ERROR@[161; 162) | 106 | ERROR@[161; 162) |
107 | EXCL@[161; 162) "!" | 107 | BANG@[161; 162) "!" |
108 | ARRAY_EXPR@[162; 179) | 108 | ARRAY_EXPR@[162; 179) |
109 | L_BRACK@[162; 163) "[" | 109 | L_BRACK@[162; 163) "[" |
110 | CALL_EXPR@[163; 178) | 110 | CALL_EXPR@[163; 178) |
@@ -149,7 +149,7 @@ SOURCE_FILE@[0; 293) | |||
149 | ATTR@[231; 232) | 149 | ATTR@[231; 232) |
150 | POUND@[231; 232) "#" | 150 | POUND@[231; 232) "#" |
151 | ERROR@[232; 233) | 151 | ERROR@[232; 233) |
152 | EXCL@[232; 233) "!" | 152 | BANG@[232; 233) "!" |
153 | ARRAY_EXPR@[233; 250) | 153 | ARRAY_EXPR@[233; 250) |
154 | L_BRACK@[233; 234) "[" | 154 | L_BRACK@[233; 234) "[" |
155 | CALL_EXPR@[234; 249) | 155 | CALL_EXPR@[234; 249) |
diff --git a/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rast b/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rast index 2c91b6841..2ab9ee56f 100644 --- a/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rast +++ b/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rast | |||
@@ -34,7 +34,7 @@ SOURCE_FILE@[0; 91) | |||
34 | TUPLE_EXPR@[32; 34) | 34 | TUPLE_EXPR@[32; 34) |
35 | L_PAREN@[32; 33) "(" | 35 | L_PAREN@[32; 33) "(" |
36 | R_PAREN@[33; 34) ")" | 36 | R_PAREN@[33; 34) ")" |
37 | SEMI@[34; 35) ";" | 37 | SEMICOLON@[34; 35) ";" |
38 | WHITESPACE@[35; 40) "\n " | 38 | WHITESPACE@[35; 40) "\n " |
39 | LET_STMT@[40; 51) | 39 | LET_STMT@[40; 51) |
40 | LET_KW@[40; 43) "let" | 40 | LET_KW@[40; 43) "let" |
@@ -58,7 +58,7 @@ SOURCE_FILE@[0; 91) | |||
58 | TUPLE_EXPR@[56; 58) | 58 | TUPLE_EXPR@[56; 58) |
59 | L_PAREN@[56; 57) "(" | 59 | L_PAREN@[56; 57) "(" |
60 | R_PAREN@[57; 58) ")" | 60 | R_PAREN@[57; 58) ")" |
61 | SEMI@[58; 59) ";" | 61 | SEMICOLON@[58; 59) ";" |
62 | WHITESPACE@[59; 64) "\n " | 62 | WHITESPACE@[59; 64) "\n " |
63 | LET_STMT@[64; 79) | 63 | LET_STMT@[64; 79) |
64 | LET_KW@[64; 67) "let" | 64 | LET_KW@[64; 67) "let" |
@@ -84,13 +84,13 @@ SOURCE_FILE@[0; 91) | |||
84 | TUPLE_EXPR@[84; 86) | 84 | TUPLE_EXPR@[84; 86) |
85 | L_PAREN@[84; 85) "(" | 85 | L_PAREN@[84; 85) "(" |
86 | R_PAREN@[85; 86) ")" | 86 | R_PAREN@[85; 86) ")" |
87 | SEMI@[86; 87) ";" | 87 | SEMICOLON@[86; 87) ";" |
88 | WHITESPACE@[87; 88) "\n" | 88 | WHITESPACE@[87; 88) "\n" |
89 | R_CURLY@[88; 89) "}" | 89 | R_CURLY@[88; 89) "}" |
90 | WHITESPACE@[89; 91) "\n\n" | 90 | WHITESPACE@[89; 91) "\n\n" |
91 | error [24; 24): expected a name | 91 | error [24; 24): expected a name |
92 | error [27; 27): expected SEMI | 92 | error [27; 27): expected SEMICOLON |
93 | error [48; 48): expected a name | 93 | error [48; 48): expected a name |
94 | error [51; 51): expected SEMI | 94 | error [51; 51): expected SEMICOLON |
95 | error [76; 76): expected a name | 95 | error [76; 76): expected a name |
96 | error [79; 79): expected SEMI | 96 | error [79; 79): expected SEMICOLON |
diff --git a/crates/ra_syntax/test_data/parser/err/0035_use_recover.rast b/crates/ra_syntax/test_data/parser/err/0035_use_recover.rast index 8cb4ea796..f255b0a6b 100644 --- a/crates/ra_syntax/test_data/parser/err/0035_use_recover.rast +++ b/crates/ra_syntax/test_data/parser/err/0035_use_recover.rast | |||
@@ -8,11 +8,11 @@ SOURCE_FILE@[0; 48) | |||
8 | PATH_SEGMENT@[4; 7) | 8 | PATH_SEGMENT@[4; 7) |
9 | NAME_REF@[4; 7) | 9 | NAME_REF@[4; 7) |
10 | IDENT@[4; 7) "foo" | 10 | IDENT@[4; 7) "foo" |
11 | COLONCOLON@[7; 9) "::" | 11 | COLON2@[7; 9) "::" |
12 | PATH_SEGMENT@[9; 12) | 12 | PATH_SEGMENT@[9; 12) |
13 | NAME_REF@[9; 12) | 13 | NAME_REF@[9; 12) |
14 | IDENT@[9; 12) "bar" | 14 | IDENT@[9; 12) "bar" |
15 | SEMI@[12; 13) ";" | 15 | SEMICOLON@[12; 13) ";" |
16 | WHITESPACE@[13; 14) "\n" | 16 | WHITESPACE@[13; 14) "\n" |
17 | USE_ITEM@[14; 17) | 17 | USE_ITEM@[14; 17) |
18 | USE_KW@[14; 17) "use" | 18 | USE_KW@[14; 17) "use" |
@@ -25,11 +25,11 @@ SOURCE_FILE@[0; 48) | |||
25 | PATH@[22; 27) | 25 | PATH@[22; 27) |
26 | PATH_SEGMENT@[22; 27) | 26 | PATH_SEGMENT@[22; 27) |
27 | CRATE_KW@[22; 27) "crate" | 27 | CRATE_KW@[22; 27) "crate" |
28 | COLONCOLON@[27; 29) "::" | 28 | COLON2@[27; 29) "::" |
29 | PATH_SEGMENT@[29; 32) | 29 | PATH_SEGMENT@[29; 32) |
30 | NAME_REF@[29; 32) | 30 | NAME_REF@[29; 32) |
31 | IDENT@[29; 32) "baz" | 31 | IDENT@[29; 32) "baz" |
32 | SEMI@[32; 33) ";" | 32 | SEMICOLON@[32; 33) ";" |
33 | WHITESPACE@[33; 34) "\n" | 33 | WHITESPACE@[33; 34) "\n" |
34 | USE_ITEM@[34; 37) | 34 | USE_ITEM@[34; 37) |
35 | USE_KW@[34; 37) "use" | 35 | USE_KW@[34; 37) "use" |
@@ -49,6 +49,6 @@ SOURCE_FILE@[0; 48) | |||
49 | R_CURLY@[46; 47) "}" | 49 | R_CURLY@[46; 47) "}" |
50 | WHITESPACE@[47; 48) "\n" | 50 | WHITESPACE@[47; 48) "\n" |
51 | error [17; 17): expected one of `*`, `::`, `{`, `self`, `super` or an identifier | 51 | error [17; 17): expected one of `*`, `::`, `{`, `self`, `super` or an identifier |
52 | error [17; 17): expected SEMI | 52 | error [17; 17): expected SEMICOLON |
53 | error [37; 37): expected one of `*`, `::`, `{`, `self`, `super` or an identifier | 53 | error [37; 37): expected one of `*`, `::`, `{`, `self`, `super` or an identifier |
54 | error [37; 37): expected SEMI | 54 | error [37; 37): expected SEMICOLON |
diff --git a/crates/ra_syntax/test_data/parser/err/0036_partial_use.rast b/crates/ra_syntax/test_data/parser/err/0036_partial_use.rast index f5490fbe8..1f2b4f6d9 100644 --- a/crates/ra_syntax/test_data/parser/err/0036_partial_use.rast +++ b/crates/ra_syntax/test_data/parser/err/0036_partial_use.rast | |||
@@ -7,7 +7,7 @@ SOURCE_FILE@[0; 37) | |||
7 | PATH_SEGMENT@[4; 7) | 7 | PATH_SEGMENT@[4; 7) |
8 | NAME_REF@[4; 7) | 8 | NAME_REF@[4; 7) |
9 | IDENT@[4; 7) "std" | 9 | IDENT@[4; 7) "std" |
10 | COLONCOLON@[7; 9) "::" | 10 | COLON2@[7; 9) "::" |
11 | USE_TREE_LIST@[9; 36) | 11 | USE_TREE_LIST@[9; 36) |
12 | L_CURLY@[9; 10) "{" | 12 | L_CURLY@[9; 10) "{" |
13 | USE_TREE@[10; 22) | 13 | USE_TREE@[10; 22) |
@@ -16,12 +16,12 @@ SOURCE_FILE@[0; 37) | |||
16 | PATH_SEGMENT@[10; 15) | 16 | PATH_SEGMENT@[10; 15) |
17 | NAME_REF@[10; 15) | 17 | NAME_REF@[10; 15) |
18 | IDENT@[10; 15) "error" | 18 | IDENT@[10; 15) "error" |
19 | COLONCOLON@[15; 17) "::" | 19 | COLON2@[15; 17) "::" |
20 | PATH_SEGMENT@[17; 22) | 20 | PATH_SEGMENT@[17; 22) |
21 | NAME_REF@[17; 22) | 21 | NAME_REF@[17; 22) |
22 | IDENT@[17; 22) "Error" | 22 | IDENT@[17; 22) "Error" |
23 | ERROR@[22; 23) | 23 | ERROR@[22; 23) |
24 | SEMI@[22; 23) ";" | 24 | SEMICOLON@[22; 23) ";" |
25 | WHITESPACE@[23; 24) "\n" | 25 | WHITESPACE@[23; 24) "\n" |
26 | ERROR@[24; 27) | 26 | ERROR@[24; 27) |
27 | USE_KW@[24; 27) "use" | 27 | USE_KW@[24; 27) "use" |
@@ -32,12 +32,12 @@ SOURCE_FILE@[0; 37) | |||
32 | PATH_SEGMENT@[28; 31) | 32 | PATH_SEGMENT@[28; 31) |
33 | NAME_REF@[28; 31) | 33 | NAME_REF@[28; 31) |
34 | IDENT@[28; 31) "std" | 34 | IDENT@[28; 31) "std" |
35 | COLONCOLON@[31; 33) "::" | 35 | COLON2@[31; 33) "::" |
36 | PATH_SEGMENT@[33; 35) | 36 | PATH_SEGMENT@[33; 35) |
37 | NAME_REF@[33; 35) | 37 | NAME_REF@[33; 35) |
38 | IDENT@[33; 35) "io" | 38 | IDENT@[33; 35) "io" |
39 | ERROR@[35; 36) | 39 | ERROR@[35; 36) |
40 | SEMI@[35; 36) ";" | 40 | SEMICOLON@[35; 36) ";" |
41 | WHITESPACE@[36; 37) "\n" | 41 | WHITESPACE@[36; 37) "\n" |
42 | error [22; 22): expected COMMA | 42 | error [22; 22): expected COMMA |
43 | error [22; 22): expected one of `*`, `::`, `{`, `self`, `super` or an identifier | 43 | error [22; 22): expected one of `*`, `::`, `{`, `self`, `super` or an identifier |
@@ -48,4 +48,4 @@ error [35; 35): expected COMMA | |||
48 | error [35; 35): expected one of `*`, `::`, `{`, `self`, `super` or an identifier | 48 | error [35; 35): expected one of `*`, `::`, `{`, `self`, `super` or an identifier |
49 | error [36; 36): expected COMMA | 49 | error [36; 36): expected COMMA |
50 | error [36; 36): expected R_CURLY | 50 | error [36; 36): expected R_CURLY |
51 | error [36; 36): expected SEMI | 51 | error [36; 36): expected SEMICOLON |
diff --git a/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast b/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast index d8622d45f..5319bf936 100644 --- a/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast +++ b/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast | |||
@@ -65,7 +65,7 @@ SOURCE_FILE@[0; 118) | |||
65 | TUPLE_TYPE@[78; 80) | 65 | TUPLE_TYPE@[78; 80) |
66 | L_PAREN@[78; 79) "(" | 66 | L_PAREN@[78; 79) "(" |
67 | R_PAREN@[79; 80) ")" | 67 | R_PAREN@[79; 80) ")" |
68 | SEMI@[80; 81) ";" | 68 | SEMICOLON@[80; 81) ";" |
69 | WHITESPACE@[81; 86) "\n " | 69 | WHITESPACE@[81; 86) "\n " |
70 | CONST_DEF@[86; 115) | 70 | CONST_DEF@[86; 115) |
71 | VISIBILITY@[86; 96) | 71 | VISIBILITY@[86; 96) |
@@ -90,7 +90,7 @@ SOURCE_FILE@[0; 118) | |||
90 | WHITESPACE@[111; 112) " " | 90 | WHITESPACE@[111; 112) " " |
91 | LITERAL@[112; 114) | 91 | LITERAL@[112; 114) |
92 | INT_NUMBER@[112; 114) "92" | 92 | INT_NUMBER@[112; 114) "92" |
93 | SEMI@[114; 115) ";" | 93 | SEMICOLON@[114; 115) ";" |
94 | WHITESPACE@[115; 116) "\n" | 94 | WHITESPACE@[115; 116) "\n" |
95 | R_CURLY@[116; 117) "}" | 95 | R_CURLY@[116; 117) "}" |
96 | WHITESPACE@[117; 118) "\n" | 96 | WHITESPACE@[117; 118) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rast b/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rast index 3810b9680..9efdf7ef4 100644 --- a/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rast +++ b/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rast | |||
@@ -16,13 +16,13 @@ SOURCE_FILE@[0; 33) | |||
16 | RANGE_EXPR@[16; 20) | 16 | RANGE_EXPR@[16; 20) |
17 | LITERAL@[16; 17) | 17 | LITERAL@[16; 17) |
18 | INT_NUMBER@[16; 17) "0" | 18 | INT_NUMBER@[16; 17) "0" |
19 | DOTDOTEQ@[17; 20) "..=" | 19 | DOT2EQ@[17; 20) "..=" |
20 | SEMI@[20; 21) ";" | 20 | SEMICOLON@[20; 21) ";" |
21 | WHITESPACE@[21; 26) "\n " | 21 | WHITESPACE@[21; 26) "\n " |
22 | EXPR_STMT@[26; 30) | 22 | EXPR_STMT@[26; 30) |
23 | RANGE_EXPR@[26; 29) | 23 | RANGE_EXPR@[26; 29) |
24 | DOTDOTEQ@[26; 29) "..=" | 24 | DOT2EQ@[26; 29) "..=" |
25 | SEMI@[29; 30) ";" | 25 | SEMICOLON@[29; 30) ";" |
26 | WHITESPACE@[30; 31) "\n" | 26 | WHITESPACE@[30; 31) "\n" |
27 | R_CURLY@[31; 32) "}" | 27 | R_CURLY@[31; 32) "}" |
28 | WHITESPACE@[32; 33) "\n" | 28 | WHITESPACE@[32; 33) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast index 4a2f0a696..edf9c3247 100644 --- a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast +++ b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast | |||
@@ -64,7 +64,7 @@ SOURCE_FILE@[0; 83) | |||
64 | NAME_REF@[67; 70) | 64 | NAME_REF@[67; 70) |
65 | IDENT@[67; 70) "max" | 65 | IDENT@[67; 70) "max" |
66 | TYPE_ARG_LIST@[70; 77) | 66 | TYPE_ARG_LIST@[70; 77) |
67 | COLONCOLON@[70; 72) "::" | 67 | COLON2@[70; 72) "::" |
68 | L_ANGLE@[72; 73) "<" | 68 | L_ANGLE@[72; 73) "<" |
69 | TYPE_ARG@[73; 76) | 69 | TYPE_ARG@[73; 76) |
70 | PATH_TYPE@[73; 76) | 70 | PATH_TYPE@[73; 76) |
@@ -76,7 +76,7 @@ SOURCE_FILE@[0; 83) | |||
76 | ARG_LIST@[77; 79) | 76 | ARG_LIST@[77; 79) |
77 | L_PAREN@[77; 78) "(" | 77 | L_PAREN@[77; 78) "(" |
78 | R_PAREN@[78; 79) ")" | 78 | R_PAREN@[78; 79) ")" |
79 | SEMI@[79; 80) ";" | 79 | SEMICOLON@[79; 80) ";" |
80 | WHITESPACE@[80; 81) "\n" | 80 | WHITESPACE@[80; 81) "\n" |
81 | R_CURLY@[81; 82) "}" | 81 | R_CURLY@[81; 82) "}" |
82 | WHITESPACE@[82; 83) "\n" | 82 | WHITESPACE@[82; 83) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast b/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast index 530533b71..9d807c84f 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast | |||
@@ -18,10 +18,10 @@ SOURCE_FILE@[0; 18) | |||
18 | ERROR@[15; 16) | 18 | ERROR@[15; 16) |
19 | R_BRACK@[15; 16) "]" | 19 | R_BRACK@[15; 16) "]" |
20 | ERROR@[16; 17) | 20 | ERROR@[16; 17) |
21 | SEMI@[16; 17) ";" | 21 | SEMICOLON@[16; 17) ";" |
22 | WHITESPACE@[17; 18) "\n" | 22 | WHITESPACE@[17; 18) "\n" |
23 | error [12; 12): expected `;` or `]` | 23 | error [12; 12): expected `;` or `]` |
24 | error [12; 12): expected SEMI | 24 | error [12; 12): expected SEMICOLON |
25 | error [13; 13): expected an item | 25 | error [13; 13): expected an item |
26 | error [15; 15): expected an item | 26 | error [15; 15): expected an item |
27 | error [16; 16): expected an item | 27 | error [16; 16): expected an item |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast b/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast index 01a853d63..a85855f8c 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast | |||
@@ -24,6 +24,6 @@ SOURCE_FILE@[0; 30) | |||
24 | R_CURLY@[28; 29) "}" | 24 | R_CURLY@[28; 29) "}" |
25 | WHITESPACE@[29; 30) "\n" | 25 | WHITESPACE@[29; 30) "\n" |
26 | error [22; 22): expected a loop | 26 | error [22; 22): expected a loop |
27 | error [22; 22): expected SEMI | 27 | error [22; 22): expected SEMICOLON |
28 | error [27; 27): expected type | 28 | error [27; 27): expected type |
29 | error [27; 27): expected `{` | 29 | error [27; 27): expected `{` |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast b/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast index 2ab29eecc..e9efad674 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast | |||
@@ -12,6 +12,6 @@ SOURCE_FILE@[0; 14) | |||
12 | TUPLE_TYPE@[10; 12) | 12 | TUPLE_TYPE@[10; 12) |
13 | L_PAREN@[10; 11) "(" | 13 | L_PAREN@[10; 11) "(" |
14 | R_PAREN@[11; 12) ")" | 14 | R_PAREN@[11; 12) ")" |
15 | SEMI@[12; 13) ";" | 15 | SEMICOLON@[12; 13) ";" |
16 | WHITESPACE@[13; 14) "\n" | 16 | WHITESPACE@[13; 14) "\n" |
17 | error [10; 10): expected mut or const in raw pointer type (use `*mut T` or `*const T` as appropriate) | 17 | error [10; 10): expected mut or const in raw pointer type (use `*mut T` or `*const T` as appropriate) |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast b/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast index 9e9186ad4..b8a494085 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast | |||
@@ -14,10 +14,10 @@ SOURCE_FILE@[0; 20) | |||
14 | ERROR@[17; 18) | 14 | ERROR@[17; 18) |
15 | R_PAREN@[17; 18) ")" | 15 | R_PAREN@[17; 18) ")" |
16 | ERROR@[18; 19) | 16 | ERROR@[18; 19) |
17 | SEMI@[18; 19) ";" | 17 | SEMICOLON@[18; 19) ";" |
18 | WHITESPACE@[19; 20) "\n" | 18 | WHITESPACE@[19; 20) "\n" |
19 | error [15; 15): expected `fn` | 19 | error [15; 15): expected `fn` |
20 | error [15; 15): expected SEMI | 20 | error [15; 15): expected SEMICOLON |
21 | error [16; 16): expected an item | 21 | error [16; 16): expected an item |
22 | error [17; 17): expected an item | 22 | error [17; 17): expected an item |
23 | error [18; 18): expected an item | 23 | error [18; 18): expected an item |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast b/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast index a4002a998..c3f7eb477 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast | |||
@@ -29,4 +29,4 @@ SOURCE_FILE@[0; 30) | |||
29 | WHITESPACE@[27; 28) " " | 29 | WHITESPACE@[27; 28) " " |
30 | R_CURLY@[28; 29) "}" | 30 | R_CURLY@[28; 29) "}" |
31 | WHITESPACE@[29; 30) "\n" | 31 | WHITESPACE@[29; 30) "\n" |
32 | error [27; 27): expected SEMI | 32 | error [27; 27): expected SEMICOLON |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rast b/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rast index 6f45a4fa6..a345f8488 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rast | |||
@@ -19,7 +19,7 @@ SOURCE_FILE@[0; 21) | |||
19 | EXPR_STMT@[15; 18) | 19 | EXPR_STMT@[15; 18) |
20 | LITERAL@[15; 17) | 20 | LITERAL@[15; 17) |
21 | INT_NUMBER@[15; 17) "92" | 21 | INT_NUMBER@[15; 17) "92" |
22 | SEMI@[17; 18) ";" | 22 | SEMICOLON@[17; 18) ";" |
23 | WHITESPACE@[18; 19) " " | 23 | WHITESPACE@[18; 19) " " |
24 | R_CURLY@[19; 20) "}" | 24 | R_CURLY@[19; 20) "}" |
25 | WHITESPACE@[20; 21) "\n" | 25 | WHITESPACE@[20; 21) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast b/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast index e6d3a5c95..c3a70147a 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast | |||
@@ -30,7 +30,7 @@ SOURCE_FILE@[0; 48) | |||
30 | WHITESPACE@[22; 23) " " | 30 | WHITESPACE@[22; 23) " " |
31 | LITERAL@[23; 24) | 31 | LITERAL@[23; 24) |
32 | INT_NUMBER@[23; 24) "2" | 32 | INT_NUMBER@[23; 24) "2" |
33 | SEMI@[24; 25) ";" | 33 | SEMICOLON@[24; 25) ";" |
34 | WHITESPACE@[25; 29) "\n " | 34 | WHITESPACE@[25; 29) "\n " |
35 | EXPR_STMT@[29; 45) | 35 | EXPR_STMT@[29; 45) |
36 | ATTR@[29; 33) | 36 | ATTR@[29; 33) |
@@ -53,7 +53,7 @@ SOURCE_FILE@[0; 48) | |||
53 | BLOCK@[42; 44) | 53 | BLOCK@[42; 44) |
54 | L_CURLY@[42; 43) "{" | 54 | L_CURLY@[42; 43) "{" |
55 | R_CURLY@[43; 44) "}" | 55 | R_CURLY@[43; 44) "}" |
56 | SEMI@[44; 45) ";" | 56 | SEMICOLON@[44; 45) ";" |
57 | WHITESPACE@[45; 46) "\n" | 57 | WHITESPACE@[45; 46) "\n" |
58 | R_CURLY@[46; 47) "}" | 58 | R_CURLY@[46; 47) "}" |
59 | WHITESPACE@[47; 48) "\n" | 59 | WHITESPACE@[47; 48) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast b/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast index 8ad2a588f..61d737abe 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast | |||
@@ -21,7 +21,7 @@ SOURCE_FILE@[0; 47) | |||
21 | IDENT@[15; 16) "x" | 21 | IDENT@[15; 16) "x" |
22 | DOT@[16; 17) "." | 22 | DOT@[16; 17) "." |
23 | FLOAT_NUMBER@[17; 19) "0." | 23 | FLOAT_NUMBER@[17; 19) "0." |
24 | SEMI@[19; 20) ";" | 24 | SEMICOLON@[19; 20) ";" |
25 | WHITESPACE@[20; 25) "\n " | 25 | WHITESPACE@[20; 25) "\n " |
26 | EXPR_STMT@[25; 32) | 26 | EXPR_STMT@[25; 32) |
27 | FIELD_EXPR@[25; 31) | 27 | FIELD_EXPR@[25; 31) |
@@ -33,7 +33,7 @@ SOURCE_FILE@[0; 47) | |||
33 | DOT@[26; 27) "." | 33 | DOT@[26; 27) "." |
34 | NAME_REF@[27; 31) | 34 | NAME_REF@[27; 31) |
35 | INT_NUMBER@[27; 31) "1i32" | 35 | INT_NUMBER@[27; 31) "1i32" |
36 | SEMI@[31; 32) ";" | 36 | SEMICOLON@[31; 32) ";" |
37 | WHITESPACE@[32; 37) "\n " | 37 | WHITESPACE@[32; 37) "\n " |
38 | EXPR_STMT@[37; 44) | 38 | EXPR_STMT@[37; 44) |
39 | FIELD_EXPR@[37; 43) | 39 | FIELD_EXPR@[37; 43) |
@@ -45,7 +45,7 @@ SOURCE_FILE@[0; 47) | |||
45 | DOT@[38; 39) "." | 45 | DOT@[38; 39) "." |
46 | NAME_REF@[39; 43) | 46 | NAME_REF@[39; 43) |
47 | INT_NUMBER@[39; 43) "0x01" | 47 | INT_NUMBER@[39; 43) "0x01" |
48 | SEMI@[43; 44) ";" | 48 | SEMICOLON@[43; 44) ";" |
49 | WHITESPACE@[44; 45) "\n" | 49 | WHITESPACE@[44; 45) "\n" |
50 | R_CURLY@[45; 46) "}" | 50 | R_CURLY@[45; 46) "}" |
51 | WHITESPACE@[46; 47) "\n" | 51 | WHITESPACE@[46; 47) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.rast b/crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.rast index 5b3dc5af2..62fca0a39 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.rast | |||
@@ -16,6 +16,6 @@ SOURCE_FILE@[0; 19) | |||
16 | WHITESPACE@[15; 16) " " | 16 | WHITESPACE@[15; 16) " " |
17 | LITERAL@[16; 17) | 17 | LITERAL@[16; 17) |
18 | INT_NUMBER@[16; 17) "5" | 18 | INT_NUMBER@[16; 17) "5" |
19 | SEMI@[17; 18) ";" | 19 | SEMICOLON@[17; 18) ";" |
20 | WHITESPACE@[18; 19) "\n" | 20 | WHITESPACE@[18; 19) "\n" |
21 | error [7; 7): expected a name | 21 | error [7; 7): expected a name |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast b/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast index 25d80be1d..aa960d3ef 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast | |||
@@ -27,7 +27,7 @@ SOURCE_FILE@[0; 62) | |||
27 | PATH_SEGMENT@[31; 34) | 27 | PATH_SEGMENT@[31; 34) |
28 | NAME_REF@[31; 34) | 28 | NAME_REF@[31; 34) |
29 | IDENT@[31; 34) "Bar" | 29 | IDENT@[31; 34) "Bar" |
30 | SEMI@[34; 35) ";" | 30 | SEMICOLON@[34; 35) ";" |
31 | WHITESPACE@[35; 40) "\n " | 31 | WHITESPACE@[35; 40) "\n " |
32 | MACRO_CALL@[40; 47) | 32 | MACRO_CALL@[40; 47) |
33 | PATH@[40; 47) | 33 | PATH@[40; 47) |
@@ -51,9 +51,9 @@ SOURCE_FILE@[0; 62) | |||
51 | WHITESPACE@[59; 60) "\n" | 51 | WHITESPACE@[59; 60) "\n" |
52 | R_CURLY@[60; 61) "}" | 52 | R_CURLY@[60; 61) "}" |
53 | WHITESPACE@[61; 62) "\n" | 53 | WHITESPACE@[61; 62) "\n" |
54 | error [21; 21): expected EXCL | 54 | error [21; 21): expected BANG |
55 | error [21; 21): expected `{`, `[`, `(` | 55 | error [21; 21): expected `{`, `[`, `(` |
56 | error [21; 21): expected SEMI | 56 | error [21; 21): expected SEMICOLON |
57 | error [47; 47): expected EXCL | 57 | error [47; 47): expected BANG |
58 | error [47; 47): expected `{`, `[`, `(` | 58 | error [47; 47): expected `{`, `[`, `(` |
59 | error [47; 47): expected SEMI | 59 | error [47; 47): expected SEMICOLON |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast b/crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast new file mode 100644 index 000000000..75043c9c0 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast | |||
@@ -0,0 +1,49 @@ | |||
1 | SOURCE_FILE@[0; 45) | ||
2 | FN_DEF@[0; 44) | ||
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; 44) | ||
12 | BLOCK@[10; 44) | ||
13 | L_CURLY@[10; 11) "{" | ||
14 | WHITESPACE@[11; 16) "\n " | ||
15 | RECORD_LIT@[16; 42) | ||
16 | PATH@[16; 17) | ||
17 | PATH_SEGMENT@[16; 17) | ||
18 | NAME_REF@[16; 17) | ||
19 | IDENT@[16; 17) "S" | ||
20 | WHITESPACE@[17; 18) " " | ||
21 | RECORD_FIELD_LIST@[18; 42) | ||
22 | L_CURLY@[18; 19) "{" | ||
23 | WHITESPACE@[19; 20) " " | ||
24 | RECORD_FIELD@[20; 40) | ||
25 | NAME_REF@[20; 25) | ||
26 | IDENT@[20; 25) "field" | ||
27 | WHITESPACE@[25; 26) " " | ||
28 | RANGE_EXPR@[26; 40) | ||
29 | DOT2@[26; 28) ".." | ||
30 | CALL_EXPR@[28; 40) | ||
31 | PATH_EXPR@[28; 38) | ||
32 | PATH@[28; 38) | ||
33 | PATH@[28; 29) | ||
34 | PATH_SEGMENT@[28; 29) | ||
35 | NAME_REF@[28; 29) | ||
36 | IDENT@[28; 29) "S" | ||
37 | COLON2@[29; 31) "::" | ||
38 | PATH_SEGMENT@[31; 38) | ||
39 | NAME_REF@[31; 38) | ||
40 | IDENT@[31; 38) "default" | ||
41 | ARG_LIST@[38; 40) | ||
42 | L_PAREN@[38; 39) "(" | ||
43 | R_PAREN@[39; 40) ")" | ||
44 | WHITESPACE@[40; 41) " " | ||
45 | R_CURLY@[41; 42) "}" | ||
46 | WHITESPACE@[42; 43) "\n" | ||
47 | R_CURLY@[43; 44) "}" | ||
48 | WHITESPACE@[44; 45) "\n" | ||
49 | error [25; 25): expected COLON | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rs b/crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rs new file mode 100644 index 000000000..a4e5b2f69 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | fn main() { | ||
2 | S { field ..S::default() } | ||
3 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast b/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast index ad9f0965e..25c6ef7e3 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast | |||
@@ -25,7 +25,7 @@ SOURCE_FILE@[0; 83) | |||
25 | PATH_SEGMENT@[21; 26) | 25 | PATH_SEGMENT@[21; 26) |
26 | NAME_REF@[21; 26) | 26 | NAME_REF@[21; 26) |
27 | IDENT@[21; 26) "Clone" | 27 | IDENT@[21; 26) "Clone" |
28 | SEMI@[26; 27) ";" | 28 | SEMICOLON@[26; 27) ";" |
29 | WHITESPACE@[27; 32) "\n " | 29 | WHITESPACE@[27; 32) "\n " |
30 | CONST_DEF@[32; 45) | 30 | CONST_DEF@[32; 45) |
31 | CONST_KW@[32; 37) "const" | 31 | CONST_KW@[32; 37) "const" |
@@ -39,7 +39,7 @@ SOURCE_FILE@[0; 83) | |||
39 | PATH_SEGMENT@[41; 44) | 39 | PATH_SEGMENT@[41; 44) |
40 | NAME_REF@[41; 44) | 40 | NAME_REF@[41; 44) |
41 | IDENT@[41; 44) "i32" | 41 | IDENT@[41; 44) "i32" |
42 | SEMI@[44; 45) ";" | 42 | SEMICOLON@[44; 45) ";" |
43 | WHITESPACE@[45; 50) "\n " | 43 | WHITESPACE@[45; 50) "\n " |
44 | FN_DEF@[50; 61) | 44 | FN_DEF@[50; 61) |
45 | FN_KW@[50; 52) "fn" | 45 | FN_KW@[50; 52) "fn" |
@@ -66,7 +66,7 @@ SOURCE_FILE@[0; 83) | |||
66 | AMP@[73; 74) "&" | 66 | AMP@[73; 74) "&" |
67 | SELF_KW@[74; 78) "self" | 67 | SELF_KW@[74; 78) "self" |
68 | R_PAREN@[78; 79) ")" | 68 | R_PAREN@[78; 79) ")" |
69 | SEMI@[79; 80) ";" | 69 | SEMICOLON@[79; 80) ";" |
70 | WHITESPACE@[80; 81) "\n" | 70 | WHITESPACE@[80; 81) "\n" |
71 | R_CURLY@[81; 82) "}" | 71 | R_CURLY@[81; 82) "}" |
72 | WHITESPACE@[82; 83) "\n" | 72 | WHITESPACE@[82; 83) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0002_use_tree_list.rast b/crates/ra_syntax/test_data/parser/inline/ok/0002_use_tree_list.rast index 1b318dfb9..69c459daf 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0002_use_tree_list.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0002_use_tree_list.rast | |||
@@ -12,15 +12,15 @@ SOURCE_FILE@[0; 250) | |||
12 | PATH@[5; 10) | 12 | PATH@[5; 10) |
13 | PATH_SEGMENT@[5; 10) | 13 | PATH_SEGMENT@[5; 10) |
14 | CRATE_KW@[5; 10) "crate" | 14 | CRATE_KW@[5; 10) "crate" |
15 | COLONCOLON@[10; 12) "::" | 15 | COLON2@[10; 12) "::" |
16 | PATH_SEGMENT@[12; 16) | 16 | PATH_SEGMENT@[12; 16) |
17 | NAME_REF@[12; 16) | 17 | NAME_REF@[12; 16) |
18 | IDENT@[12; 16) "path" | 18 | IDENT@[12; 16) "path" |
19 | COLONCOLON@[16; 18) "::" | 19 | COLON2@[16; 18) "::" |
20 | PATH_SEGMENT@[18; 22) | 20 | PATH_SEGMENT@[18; 22) |
21 | NAME_REF@[18; 22) | 21 | NAME_REF@[18; 22) |
22 | IDENT@[18; 22) "from" | 22 | IDENT@[18; 22) "from" |
23 | COLONCOLON@[22; 24) "::" | 23 | COLON2@[22; 24) "::" |
24 | PATH_SEGMENT@[24; 28) | 24 | PATH_SEGMENT@[24; 28) |
25 | NAME_REF@[24; 28) | 25 | NAME_REF@[24; 28) |
26 | IDENT@[24; 28) "root" | 26 | IDENT@[24; 28) "root" |
@@ -34,20 +34,20 @@ SOURCE_FILE@[0; 250) | |||
34 | PATH_SEGMENT@[30; 32) | 34 | PATH_SEGMENT@[30; 32) |
35 | NAME_REF@[30; 32) | 35 | NAME_REF@[30; 32) |
36 | IDENT@[30; 32) "or" | 36 | IDENT@[30; 32) "or" |
37 | COLONCOLON@[32; 34) "::" | 37 | COLON2@[32; 34) "::" |
38 | PATH_SEGMENT@[34; 38) | 38 | PATH_SEGMENT@[34; 38) |
39 | NAME_REF@[34; 38) | 39 | NAME_REF@[34; 38) |
40 | IDENT@[34; 38) "path" | 40 | IDENT@[34; 38) "path" |
41 | COLONCOLON@[38; 40) "::" | 41 | COLON2@[38; 40) "::" |
42 | PATH_SEGMENT@[40; 44) | 42 | PATH_SEGMENT@[40; 44) |
43 | NAME_REF@[40; 44) | 43 | NAME_REF@[40; 44) |
44 | IDENT@[40; 44) "from" | 44 | IDENT@[40; 44) "from" |
45 | COLONCOLON@[44; 46) "::" | 45 | COLON2@[44; 46) "::" |
46 | PATH_SEGMENT@[46; 56) | 46 | PATH_SEGMENT@[46; 56) |
47 | NAME_REF@[46; 56) | 47 | NAME_REF@[46; 56) |
48 | IDENT@[46; 56) "crate_name" | 48 | IDENT@[46; 56) "crate_name" |
49 | R_CURLY@[56; 57) "}" | 49 | R_CURLY@[56; 57) "}" |
50 | SEMI@[57; 58) ";" | 50 | SEMICOLON@[57; 58) ";" |
51 | WHITESPACE@[58; 59) " " | 51 | WHITESPACE@[58; 59) " " |
52 | COMMENT@[59; 97) "// Rust 2018 (with a ..." | 52 | COMMENT@[59; 97) "// Rust 2018 (with a ..." |
53 | WHITESPACE@[97; 98) "\n" | 53 | WHITESPACE@[97; 98) "\n" |
@@ -64,16 +64,16 @@ SOURCE_FILE@[0; 250) | |||
64 | PATH_SEGMENT@[103; 107) | 64 | PATH_SEGMENT@[103; 107) |
65 | NAME_REF@[103; 107) | 65 | NAME_REF@[103; 107) |
66 | IDENT@[103; 107) "path" | 66 | IDENT@[103; 107) "path" |
67 | COLONCOLON@[107; 109) "::" | 67 | COLON2@[107; 109) "::" |
68 | PATH_SEGMENT@[109; 113) | 68 | PATH_SEGMENT@[109; 113) |
69 | NAME_REF@[109; 113) | 69 | NAME_REF@[109; 113) |
70 | IDENT@[109; 113) "from" | 70 | IDENT@[109; 113) "from" |
71 | COLONCOLON@[113; 115) "::" | 71 | COLON2@[113; 115) "::" |
72 | PATH_SEGMENT@[115; 119) | 72 | PATH_SEGMENT@[115; 119) |
73 | NAME_REF@[115; 119) | 73 | NAME_REF@[115; 119) |
74 | IDENT@[115; 119) "root" | 74 | IDENT@[115; 119) "root" |
75 | R_CURLY@[119; 120) "}" | 75 | R_CURLY@[119; 120) "}" |
76 | SEMI@[120; 121) ";" | 76 | SEMICOLON@[120; 121) ";" |
77 | WHITESPACE@[121; 122) " " | 77 | WHITESPACE@[121; 122) " " |
78 | COMMENT@[122; 134) "// Rust 2015" | 78 | COMMENT@[122; 134) "// Rust 2015" |
79 | WHITESPACE@[134; 135) "\n" | 79 | WHITESPACE@[134; 135) "\n" |
@@ -81,7 +81,7 @@ SOURCE_FILE@[0; 250) | |||
81 | USE_KW@[135; 138) "use" | 81 | USE_KW@[135; 138) "use" |
82 | WHITESPACE@[138; 139) " " | 82 | WHITESPACE@[138; 139) " " |
83 | USE_TREE@[139; 165) | 83 | USE_TREE@[139; 165) |
84 | COLONCOLON@[139; 141) "::" | 84 | COLON2@[139; 141) "::" |
85 | USE_TREE_LIST@[141; 165) | 85 | USE_TREE_LIST@[141; 165) |
86 | L_CURLY@[141; 142) "{" | 86 | L_CURLY@[141; 142) "{" |
87 | USE_TREE@[142; 164) | 87 | USE_TREE@[142; 164) |
@@ -91,16 +91,16 @@ SOURCE_FILE@[0; 250) | |||
91 | PATH_SEGMENT@[142; 146) | 91 | PATH_SEGMENT@[142; 146) |
92 | NAME_REF@[142; 146) | 92 | NAME_REF@[142; 146) |
93 | IDENT@[142; 146) "some" | 93 | IDENT@[142; 146) "some" |
94 | COLONCOLON@[146; 148) "::" | 94 | COLON2@[146; 148) "::" |
95 | PATH_SEGMENT@[148; 158) | 95 | PATH_SEGMENT@[148; 158) |
96 | NAME_REF@[148; 158) | 96 | NAME_REF@[148; 158) |
97 | IDENT@[148; 158) "arbritrary" | 97 | IDENT@[148; 158) "arbritrary" |
98 | COLONCOLON@[158; 160) "::" | 98 | COLON2@[158; 160) "::" |
99 | PATH_SEGMENT@[160; 164) | 99 | PATH_SEGMENT@[160; 164) |
100 | NAME_REF@[160; 164) | 100 | NAME_REF@[160; 164) |
101 | IDENT@[160; 164) "path" | 101 | IDENT@[160; 164) "path" |
102 | R_CURLY@[164; 165) "}" | 102 | R_CURLY@[164; 165) "}" |
103 | SEMI@[165; 166) ";" | 103 | SEMICOLON@[165; 166) ";" |
104 | WHITESPACE@[166; 167) " " | 104 | WHITESPACE@[166; 167) " " |
105 | COMMENT@[167; 179) "// Rust 2015" | 105 | COMMENT@[167; 179) "// Rust 2015" |
106 | WHITESPACE@[179; 180) "\n" | 106 | WHITESPACE@[179; 180) "\n" |
@@ -108,7 +108,7 @@ SOURCE_FILE@[0; 250) | |||
108 | USE_KW@[180; 183) "use" | 108 | USE_KW@[180; 183) "use" |
109 | WHITESPACE@[183; 184) " " | 109 | WHITESPACE@[183; 184) " " |
110 | USE_TREE@[184; 205) | 110 | USE_TREE@[184; 205) |
111 | COLONCOLON@[184; 186) "::" | 111 | COLON2@[184; 186) "::" |
112 | USE_TREE_LIST@[186; 205) | 112 | USE_TREE_LIST@[186; 205) |
113 | L_CURLY@[186; 187) "{" | 113 | L_CURLY@[186; 187) "{" |
114 | USE_TREE@[187; 204) | 114 | USE_TREE@[187; 204) |
@@ -122,14 +122,14 @@ SOURCE_FILE@[0; 250) | |||
122 | PATH@[189; 194) | 122 | PATH@[189; 194) |
123 | PATH_SEGMENT@[189; 194) | 123 | PATH_SEGMENT@[189; 194) |
124 | CRATE_KW@[189; 194) "crate" | 124 | CRATE_KW@[189; 194) "crate" |
125 | COLONCOLON@[194; 196) "::" | 125 | COLON2@[194; 196) "::" |
126 | PATH_SEGMENT@[196; 202) | 126 | PATH_SEGMENT@[196; 202) |
127 | NAME_REF@[196; 202) | 127 | NAME_REF@[196; 202) |
128 | IDENT@[196; 202) "export" | 128 | IDENT@[196; 202) "export" |
129 | R_CURLY@[202; 203) "}" | 129 | R_CURLY@[202; 203) "}" |
130 | R_CURLY@[203; 204) "}" | 130 | R_CURLY@[203; 204) "}" |
131 | R_CURLY@[204; 205) "}" | 131 | R_CURLY@[204; 205) "}" |
132 | SEMI@[205; 206) ";" | 132 | SEMICOLON@[205; 206) ";" |
133 | WHITESPACE@[206; 207) " " | 133 | WHITESPACE@[206; 207) " " |
134 | COMMENT@[207; 249) "// Nonsensical but pe ..." | 134 | COMMENT@[207; 249) "// Nonsensical but pe ..." |
135 | WHITESPACE@[249; 250) "\n" | 135 | WHITESPACE@[249; 250) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast b/crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast index 9241f6fb2..a0cf1e4f6 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast | |||
@@ -56,5 +56,5 @@ SOURCE_FILE@[0; 39) | |||
56 | R_PAREN@[34; 35) ")" | 56 | R_PAREN@[34; 35) ")" |
57 | R_PAREN@[35; 36) ")" | 57 | R_PAREN@[35; 36) ")" |
58 | R_ANGLE@[36; 37) ">" | 58 | R_ANGLE@[36; 37) ">" |
59 | SEMI@[37; 38) ";" | 59 | SEMICOLON@[37; 38) ";" |
60 | WHITESPACE@[38; 39) "\n" | 60 | WHITESPACE@[38; 39) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast b/crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast index a7186c7a8..027abf179 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast | |||
@@ -36,5 +36,5 @@ SOURCE_FILE@[0; 35) | |||
36 | IDENT@[27; 31) "Copy" | 36 | IDENT@[27; 31) "Copy" |
37 | R_PAREN@[31; 32) ")" | 37 | R_PAREN@[31; 32) ")" |
38 | R_ANGLE@[32; 33) ">" | 38 | R_ANGLE@[32; 33) ">" |
39 | SEMI@[33; 34) ";" | 39 | SEMICOLON@[33; 34) ";" |
40 | WHITESPACE@[34; 35) "\n" | 40 | WHITESPACE@[34; 35) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast b/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast index 3812adc9e..f4697fed6 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast | |||
@@ -21,7 +21,7 @@ SOURCE_FILE@[0; 103) | |||
21 | PATH_SEGMENT@[19; 22) | 21 | PATH_SEGMENT@[19; 22) |
22 | NAME_REF@[19; 22) | 22 | NAME_REF@[19; 22) |
23 | IDENT@[19; 22) "foo" | 23 | IDENT@[19; 22) "foo" |
24 | COLONCOLON@[22; 24) "::" | 24 | COLON2@[22; 24) "::" |
25 | PATH_SEGMENT@[24; 27) | 25 | PATH_SEGMENT@[24; 27) |
26 | NAME_REF@[24; 27) | 26 | NAME_REF@[24; 27) |
27 | IDENT@[24; 27) "Bar" | 27 | IDENT@[24; 27) "Bar" |
@@ -31,7 +31,7 @@ SOURCE_FILE@[0; 103) | |||
31 | TUPLE_EXPR@[30; 32) | 31 | TUPLE_EXPR@[30; 32) |
32 | L_PAREN@[30; 31) "(" | 32 | L_PAREN@[30; 31) "(" |
33 | R_PAREN@[31; 32) ")" | 33 | R_PAREN@[31; 32) ")" |
34 | SEMI@[32; 33) ";" | 34 | SEMICOLON@[32; 33) ";" |
35 | WHITESPACE@[33; 38) "\n " | 35 | WHITESPACE@[33; 38) "\n " |
36 | LET_STMT@[38; 53) | 36 | LET_STMT@[38; 53) |
37 | LET_KW@[38; 41) "let" | 37 | LET_KW@[38; 41) "let" |
@@ -39,7 +39,7 @@ SOURCE_FILE@[0; 103) | |||
39 | PATH_PAT@[42; 47) | 39 | PATH_PAT@[42; 47) |
40 | PATH@[42; 47) | 40 | PATH@[42; 47) |
41 | PATH_SEGMENT@[42; 47) | 41 | PATH_SEGMENT@[42; 47) |
42 | COLONCOLON@[42; 44) "::" | 42 | COLON2@[42; 44) "::" |
43 | NAME_REF@[44; 47) | 43 | NAME_REF@[44; 47) |
44 | IDENT@[44; 47) "Bar" | 44 | IDENT@[44; 47) "Bar" |
45 | WHITESPACE@[47; 48) " " | 45 | WHITESPACE@[47; 48) " " |
@@ -48,7 +48,7 @@ SOURCE_FILE@[0; 103) | |||
48 | TUPLE_EXPR@[50; 52) | 48 | TUPLE_EXPR@[50; 52) |
49 | L_PAREN@[50; 51) "(" | 49 | L_PAREN@[50; 51) "(" |
50 | R_PAREN@[51; 52) ")" | 50 | R_PAREN@[51; 52) ")" |
51 | SEMI@[52; 53) ";" | 51 | SEMICOLON@[52; 53) ";" |
52 | WHITESPACE@[53; 58) "\n " | 52 | WHITESPACE@[53; 58) "\n " |
53 | LET_STMT@[58; 78) | 53 | LET_STMT@[58; 78) |
54 | LET_KW@[58; 61) "let" | 54 | LET_KW@[58; 61) "let" |
@@ -62,7 +62,7 @@ SOURCE_FILE@[0; 103) | |||
62 | RECORD_FIELD_PAT_LIST@[66; 72) | 62 | RECORD_FIELD_PAT_LIST@[66; 72) |
63 | L_CURLY@[66; 67) "{" | 63 | L_CURLY@[66; 67) "{" |
64 | WHITESPACE@[67; 68) " " | 64 | WHITESPACE@[67; 68) " " |
65 | DOTDOT@[68; 70) ".." | 65 | DOT2@[68; 70) ".." |
66 | WHITESPACE@[70; 71) " " | 66 | WHITESPACE@[70; 71) " " |
67 | R_CURLY@[71; 72) "}" | 67 | R_CURLY@[71; 72) "}" |
68 | WHITESPACE@[72; 73) " " | 68 | WHITESPACE@[72; 73) " " |
@@ -71,7 +71,7 @@ SOURCE_FILE@[0; 103) | |||
71 | TUPLE_EXPR@[75; 77) | 71 | TUPLE_EXPR@[75; 77) |
72 | L_PAREN@[75; 76) "(" | 72 | L_PAREN@[75; 76) "(" |
73 | R_PAREN@[76; 77) ")" | 73 | R_PAREN@[76; 77) ")" |
74 | SEMI@[77; 78) ";" | 74 | SEMICOLON@[77; 78) ";" |
75 | WHITESPACE@[78; 83) "\n " | 75 | WHITESPACE@[78; 83) "\n " |
76 | LET_STMT@[83; 100) | 76 | LET_STMT@[83; 100) |
77 | LET_KW@[83; 86) "let" | 77 | LET_KW@[83; 86) "let" |
@@ -83,7 +83,7 @@ SOURCE_FILE@[0; 103) | |||
83 | IDENT@[87; 90) "Bar" | 83 | IDENT@[87; 90) "Bar" |
84 | L_PAREN@[90; 91) "(" | 84 | L_PAREN@[90; 91) "(" |
85 | DOT_DOT_PAT@[91; 93) | 85 | DOT_DOT_PAT@[91; 93) |
86 | DOTDOT@[91; 93) ".." | 86 | DOT2@[91; 93) ".." |
87 | R_PAREN@[93; 94) ")" | 87 | R_PAREN@[93; 94) ")" |
88 | WHITESPACE@[94; 95) " " | 88 | WHITESPACE@[94; 95) " " |
89 | EQ@[95; 96) "=" | 89 | EQ@[95; 96) "=" |
@@ -91,7 +91,7 @@ SOURCE_FILE@[0; 103) | |||
91 | TUPLE_EXPR@[97; 99) | 91 | TUPLE_EXPR@[97; 99) |
92 | L_PAREN@[97; 98) "(" | 92 | L_PAREN@[97; 98) "(" |
93 | R_PAREN@[98; 99) ")" | 93 | R_PAREN@[98; 99) ")" |
94 | SEMI@[99; 100) ";" | 94 | SEMICOLON@[99; 100) ";" |
95 | WHITESPACE@[100; 101) "\n" | 95 | WHITESPACE@[100; 101) "\n" |
96 | R_CURLY@[101; 102) "}" | 96 | R_CURLY@[101; 102) "}" |
97 | WHITESPACE@[102; 103) "\n" | 97 | WHITESPACE@[102; 103) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0009_loop_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0009_loop_expr.rast index 2d8872022..cc759310a 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0009_loop_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0009_loop_expr.rast | |||
@@ -20,7 +20,7 @@ SOURCE_FILE@[0; 26) | |||
20 | BLOCK@[20; 22) | 20 | BLOCK@[20; 22) |
21 | L_CURLY@[20; 21) "{" | 21 | L_CURLY@[20; 21) "{" |
22 | R_CURLY@[21; 22) "}" | 22 | R_CURLY@[21; 22) "}" |
23 | SEMI@[22; 23) ";" | 23 | SEMICOLON@[22; 23) ";" |
24 | WHITESPACE@[23; 24) "\n" | 24 | WHITESPACE@[23; 24) "\n" |
25 | R_CURLY@[24; 25) "}" | 25 | R_CURLY@[24; 25) "}" |
26 | WHITESPACE@[25; 26) "\n" | 26 | WHITESPACE@[25; 26) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0011_field_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0011_field_expr.rast index 29b268b55..c2fafe472 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0011_field_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0011_field_expr.rast | |||
@@ -22,7 +22,7 @@ SOURCE_FILE@[0; 48) | |||
22 | DOT@[16; 17) "." | 22 | DOT@[16; 17) "." |
23 | NAME_REF@[17; 20) | 23 | NAME_REF@[17; 20) |
24 | IDENT@[17; 20) "foo" | 24 | IDENT@[17; 20) "foo" |
25 | SEMI@[20; 21) ";" | 25 | SEMICOLON@[20; 21) ";" |
26 | WHITESPACE@[21; 26) "\n " | 26 | WHITESPACE@[21; 26) "\n " |
27 | EXPR_STMT@[26; 34) | 27 | EXPR_STMT@[26; 34) |
28 | FIELD_EXPR@[26; 33) | 28 | FIELD_EXPR@[26; 33) |
@@ -38,7 +38,7 @@ SOURCE_FILE@[0; 48) | |||
38 | DOT@[29; 30) "." | 38 | DOT@[29; 30) "." |
39 | NAME_REF@[30; 33) | 39 | NAME_REF@[30; 33) |
40 | IDENT@[30; 33) "bar" | 40 | IDENT@[30; 33) "bar" |
41 | SEMI@[33; 34) ";" | 41 | SEMICOLON@[33; 34) ";" |
42 | WHITESPACE@[34; 39) "\n " | 42 | WHITESPACE@[34; 39) "\n " |
43 | EXPR_STMT@[39; 45) | 43 | EXPR_STMT@[39; 45) |
44 | CALL_EXPR@[39; 44) | 44 | CALL_EXPR@[39; 44) |
@@ -54,7 +54,7 @@ SOURCE_FILE@[0; 48) | |||
54 | ARG_LIST@[42; 44) | 54 | ARG_LIST@[42; 44) |
55 | L_PAREN@[42; 43) "(" | 55 | L_PAREN@[42; 43) "(" |
56 | R_PAREN@[43; 44) ")" | 56 | R_PAREN@[43; 44) ")" |
57 | SEMI@[44; 45) ";" | 57 | SEMICOLON@[44; 45) ";" |
58 | WHITESPACE@[45; 46) "\n" | 58 | WHITESPACE@[45; 46) "\n" |
59 | R_CURLY@[46; 47) "}" | 59 | R_CURLY@[46; 47) "}" |
60 | WHITESPACE@[47; 48) "\n" | 60 | WHITESPACE@[47; 48) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast b/crates/ra_syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast index da04dac5c..15d8c736d 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast | |||
@@ -29,5 +29,5 @@ SOURCE_FILE@[0; 31) | |||
29 | TUPLE_TYPE@[27; 29) | 29 | TUPLE_TYPE@[27; 29) |
30 | L_PAREN@[27; 28) "(" | 30 | L_PAREN@[27; 28) "(" |
31 | R_PAREN@[28; 29) ")" | 31 | R_PAREN@[28; 29) ")" |
32 | SEMI@[29; 30) ";" | 32 | SEMICOLON@[29; 30) ";" |
33 | WHITESPACE@[30; 31) "\n" | 33 | WHITESPACE@[30; 31) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast b/crates/ra_syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast index c05f873d6..a72d56495 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast | |||
@@ -14,7 +14,7 @@ SOURCE_FILE@[0; 36) | |||
14 | TUPLE_TYPE@[14; 16) | 14 | TUPLE_TYPE@[14; 16) |
15 | L_PAREN@[14; 15) "(" | 15 | L_PAREN@[14; 15) "(" |
16 | R_PAREN@[15; 16) ")" | 16 | R_PAREN@[15; 16) ")" |
17 | SEMI@[16; 17) ";" | 17 | SEMICOLON@[16; 17) ";" |
18 | WHITESPACE@[17; 18) "\n" | 18 | WHITESPACE@[17; 18) "\n" |
19 | TYPE_ALIAS_DEF@[18; 35) | 19 | TYPE_ALIAS_DEF@[18; 35) |
20 | TYPE_KW@[18; 22) "type" | 20 | TYPE_KW@[18; 22) "type" |
@@ -31,5 +31,5 @@ SOURCE_FILE@[0; 36) | |||
31 | TUPLE_TYPE@[32; 34) | 31 | TUPLE_TYPE@[32; 34) |
32 | L_PAREN@[32; 33) "(" | 32 | L_PAREN@[32; 33) "(" |
33 | R_PAREN@[33; 34) ")" | 33 | R_PAREN@[33; 34) ")" |
34 | SEMI@[34; 35) ";" | 34 | SEMICOLON@[34; 35) ";" |
35 | WHITESPACE@[35; 36) "\n" | 35 | WHITESPACE@[35; 36) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0014_never_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0014_never_type.rast index ac53e4fd3..3c98467c7 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0014_never_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0014_never_type.rast | |||
@@ -8,6 +8,6 @@ SOURCE_FILE@[0; 16) | |||
8 | EQ@[11; 12) "=" | 8 | EQ@[11; 12) "=" |
9 | WHITESPACE@[12; 13) " " | 9 | WHITESPACE@[12; 13) " " |
10 | NEVER_TYPE@[13; 14) | 10 | NEVER_TYPE@[13; 14) |
11 | EXCL@[13; 14) "!" | 11 | BANG@[13; 14) "!" |
12 | SEMI@[14; 15) ";" | 12 | SEMICOLON@[14; 15) ";" |
13 | WHITESPACE@[15; 16) "\n" | 13 | WHITESPACE@[15; 16) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0015_continue_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0015_continue_expr.rast index c051c1c86..adaece119 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0015_continue_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0015_continue_expr.rast | |||
@@ -22,14 +22,14 @@ SOURCE_FILE@[0; 69) | |||
22 | EXPR_STMT@[30; 39) | 22 | EXPR_STMT@[30; 39) |
23 | CONTINUE_EXPR@[30; 38) | 23 | CONTINUE_EXPR@[30; 38) |
24 | CONTINUE_KW@[30; 38) "continue" | 24 | CONTINUE_KW@[30; 38) "continue" |
25 | SEMI@[38; 39) ";" | 25 | SEMICOLON@[38; 39) ";" |
26 | WHITESPACE@[39; 48) "\n " | 26 | WHITESPACE@[39; 48) "\n " |
27 | EXPR_STMT@[48; 60) | 27 | EXPR_STMT@[48; 60) |
28 | CONTINUE_EXPR@[48; 59) | 28 | CONTINUE_EXPR@[48; 59) |
29 | CONTINUE_KW@[48; 56) "continue" | 29 | CONTINUE_KW@[48; 56) "continue" |
30 | WHITESPACE@[56; 57) " " | 30 | WHITESPACE@[56; 57) " " |
31 | LIFETIME@[57; 59) "\'l" | 31 | LIFETIME@[57; 59) "\'l" |
32 | SEMI@[59; 60) ";" | 32 | SEMICOLON@[59; 60) ";" |
33 | WHITESPACE@[60; 65) "\n " | 33 | WHITESPACE@[60; 65) "\n " |
34 | R_CURLY@[65; 66) "}" | 34 | R_CURLY@[65; 66) "}" |
35 | WHITESPACE@[66; 67) "\n" | 35 | WHITESPACE@[66; 67) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0017_array_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0017_array_type.rast index b4055c9f0..f4c86a05f 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0017_array_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0017_array_type.rast | |||
@@ -12,10 +12,10 @@ SOURCE_FILE@[0; 19) | |||
12 | TUPLE_TYPE@[10; 12) | 12 | TUPLE_TYPE@[10; 12) |
13 | L_PAREN@[10; 11) "(" | 13 | L_PAREN@[10; 11) "(" |
14 | R_PAREN@[11; 12) ")" | 14 | R_PAREN@[11; 12) ")" |
15 | SEMI@[12; 13) ";" | 15 | SEMICOLON@[12; 13) ";" |
16 | WHITESPACE@[13; 14) " " | 16 | WHITESPACE@[13; 14) " " |
17 | LITERAL@[14; 16) | 17 | LITERAL@[14; 16) |
18 | INT_NUMBER@[14; 16) "92" | 18 | INT_NUMBER@[14; 16) "92" |
19 | R_BRACK@[16; 17) "]" | 19 | R_BRACK@[16; 17) "]" |
20 | SEMI@[17; 18) ";" | 20 | SEMICOLON@[17; 18) ";" |
21 | WHITESPACE@[18; 19) "\n" | 21 | WHITESPACE@[18; 19) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0019_unary_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0019_unary_expr.rast index 2d71efd86..5a42f360c 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0019_unary_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0019_unary_expr.rast | |||
@@ -21,16 +21,16 @@ SOURCE_FILE@[0; 44) | |||
21 | AMP@[17; 18) "&" | 21 | AMP@[17; 18) "&" |
22 | LITERAL@[18; 19) | 22 | LITERAL@[18; 19) |
23 | INT_NUMBER@[18; 19) "1" | 23 | INT_NUMBER@[18; 19) "1" |
24 | SEMI@[19; 20) ";" | 24 | SEMICOLON@[19; 20) ";" |
25 | WHITESPACE@[20; 25) "\n " | 25 | WHITESPACE@[20; 25) "\n " |
26 | EXPR_STMT@[25; 32) | 26 | EXPR_STMT@[25; 32) |
27 | PREFIX_EXPR@[25; 31) | 27 | PREFIX_EXPR@[25; 31) |
28 | EXCL@[25; 26) "!" | 28 | BANG@[25; 26) "!" |
29 | PREFIX_EXPR@[26; 31) | 29 | PREFIX_EXPR@[26; 31) |
30 | EXCL@[26; 27) "!" | 30 | BANG@[26; 27) "!" |
31 | LITERAL@[27; 31) | 31 | LITERAL@[27; 31) |
32 | TRUE_KW@[27; 31) "true" | 32 | TRUE_KW@[27; 31) "true" |
33 | SEMI@[31; 32) ";" | 33 | SEMICOLON@[31; 32) ";" |
34 | WHITESPACE@[32; 37) "\n " | 34 | WHITESPACE@[32; 37) "\n " |
35 | EXPR_STMT@[37; 41) | 35 | EXPR_STMT@[37; 41) |
36 | PREFIX_EXPR@[37; 40) | 36 | PREFIX_EXPR@[37; 40) |
@@ -39,7 +39,7 @@ SOURCE_FILE@[0; 44) | |||
39 | MINUS@[38; 39) "-" | 39 | MINUS@[38; 39) "-" |
40 | LITERAL@[39; 40) | 40 | LITERAL@[39; 40) |
41 | INT_NUMBER@[39; 40) "1" | 41 | INT_NUMBER@[39; 40) "1" |
42 | SEMI@[40; 41) ";" | 42 | SEMICOLON@[40; 41) ";" |
43 | WHITESPACE@[41; 42) "\n" | 43 | WHITESPACE@[41; 42) "\n" |
44 | R_CURLY@[42; 43) "}" | 44 | R_CURLY@[42; 43) "}" |
45 | WHITESPACE@[43; 44) "\n" | 45 | WHITESPACE@[43; 44) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0020_use_star.rast b/crates/ra_syntax/test_data/parser/inline/ok/0020_use_star.rast index dd2095d90..c1bedb37c 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0020_use_star.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0020_use_star.rast | |||
@@ -4,15 +4,15 @@ SOURCE_FILE@[0; 60) | |||
4 | WHITESPACE@[3; 4) " " | 4 | WHITESPACE@[3; 4) " " |
5 | USE_TREE@[4; 5) | 5 | USE_TREE@[4; 5) |
6 | STAR@[4; 5) "*" | 6 | STAR@[4; 5) "*" |
7 | SEMI@[5; 6) ";" | 7 | SEMICOLON@[5; 6) ";" |
8 | WHITESPACE@[6; 7) "\n" | 8 | WHITESPACE@[6; 7) "\n" |
9 | USE_ITEM@[7; 15) | 9 | USE_ITEM@[7; 15) |
10 | USE_KW@[7; 10) "use" | 10 | USE_KW@[7; 10) "use" |
11 | WHITESPACE@[10; 11) " " | 11 | WHITESPACE@[10; 11) " " |
12 | USE_TREE@[11; 14) | 12 | USE_TREE@[11; 14) |
13 | COLONCOLON@[11; 13) "::" | 13 | COLON2@[11; 13) "::" |
14 | STAR@[13; 14) "*" | 14 | STAR@[13; 14) "*" |
15 | SEMI@[14; 15) ";" | 15 | SEMICOLON@[14; 15) ";" |
16 | WHITESPACE@[15; 16) "\n" | 16 | WHITESPACE@[15; 16) "\n" |
17 | USE_ITEM@[16; 36) | 17 | USE_ITEM@[16; 36) |
18 | USE_KW@[16; 19) "use" | 18 | USE_KW@[16; 19) "use" |
@@ -23,17 +23,17 @@ SOURCE_FILE@[0; 60) | |||
23 | PATH_SEGMENT@[20; 24) | 23 | PATH_SEGMENT@[20; 24) |
24 | NAME_REF@[20; 24) | 24 | NAME_REF@[20; 24) |
25 | IDENT@[20; 24) "some" | 25 | IDENT@[20; 24) "some" |
26 | COLONCOLON@[24; 26) "::" | 26 | COLON2@[24; 26) "::" |
27 | PATH_SEGMENT@[26; 30) | 27 | PATH_SEGMENT@[26; 30) |
28 | NAME_REF@[26; 30) | 28 | NAME_REF@[26; 30) |
29 | IDENT@[26; 30) "path" | 29 | IDENT@[26; 30) "path" |
30 | COLONCOLON@[30; 32) "::" | 30 | COLON2@[30; 32) "::" |
31 | USE_TREE_LIST@[32; 35) | 31 | USE_TREE_LIST@[32; 35) |
32 | L_CURLY@[32; 33) "{" | 32 | L_CURLY@[32; 33) "{" |
33 | USE_TREE@[33; 34) | 33 | USE_TREE@[33; 34) |
34 | STAR@[33; 34) "*" | 34 | STAR@[33; 34) "*" |
35 | R_CURLY@[34; 35) "}" | 35 | R_CURLY@[34; 35) "}" |
36 | SEMI@[35; 36) ";" | 36 | SEMICOLON@[35; 36) ";" |
37 | WHITESPACE@[36; 37) "\n" | 37 | WHITESPACE@[36; 37) "\n" |
38 | USE_ITEM@[37; 59) | 38 | USE_ITEM@[37; 59) |
39 | USE_KW@[37; 40) "use" | 39 | USE_KW@[37; 40) "use" |
@@ -44,16 +44,16 @@ SOURCE_FILE@[0; 60) | |||
44 | PATH_SEGMENT@[41; 45) | 44 | PATH_SEGMENT@[41; 45) |
45 | NAME_REF@[41; 45) | 45 | NAME_REF@[41; 45) |
46 | IDENT@[41; 45) "some" | 46 | IDENT@[41; 45) "some" |
47 | COLONCOLON@[45; 47) "::" | 47 | COLON2@[45; 47) "::" |
48 | PATH_SEGMENT@[47; 51) | 48 | PATH_SEGMENT@[47; 51) |
49 | NAME_REF@[47; 51) | 49 | NAME_REF@[47; 51) |
50 | IDENT@[47; 51) "path" | 50 | IDENT@[47; 51) "path" |
51 | COLONCOLON@[51; 53) "::" | 51 | COLON2@[51; 53) "::" |
52 | USE_TREE_LIST@[53; 58) | 52 | USE_TREE_LIST@[53; 58) |
53 | L_CURLY@[53; 54) "{" | 53 | L_CURLY@[53; 54) "{" |
54 | USE_TREE@[54; 57) | 54 | USE_TREE@[54; 57) |
55 | COLONCOLON@[54; 56) "::" | 55 | COLON2@[54; 56) "::" |
56 | STAR@[56; 57) "*" | 56 | STAR@[56; 57) "*" |
57 | R_CURLY@[57; 58) "}" | 57 | R_CURLY@[57; 58) "}" |
58 | SEMI@[58; 59) ";" | 58 | SEMICOLON@[58; 59) ";" |
59 | WHITESPACE@[59; 60) "\n" | 59 | WHITESPACE@[59; 60) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.rast b/crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.rast index b1af67976..767a49ce6 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.rast | |||
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 89) | |||
24 | PATH_SEGMENT@[22; 25) | 24 | PATH_SEGMENT@[22; 25) |
25 | NAME_REF@[22; 25) | 25 | NAME_REF@[22; 25) |
26 | IDENT@[22; 25) "i32" | 26 | IDENT@[22; 25) "i32" |
27 | SEMI@[25; 26) ";" | 27 | SEMICOLON@[25; 26) ";" |
28 | WHITESPACE@[26; 31) "\n " | 28 | WHITESPACE@[26; 31) "\n " |
29 | CONST_DEF@[31; 49) | 29 | CONST_DEF@[31; 49) |
30 | CONST_KW@[31; 36) "const" | 30 | CONST_KW@[31; 36) "const" |
@@ -43,7 +43,7 @@ SOURCE_FILE@[0; 89) | |||
43 | WHITESPACE@[45; 46) " " | 43 | WHITESPACE@[45; 46) " " |
44 | LITERAL@[46; 48) | 44 | LITERAL@[46; 48) |
45 | INT_NUMBER@[46; 48) "92" | 45 | INT_NUMBER@[46; 48) "92" |
46 | SEMI@[48; 49) ";" | 46 | SEMICOLON@[48; 49) ";" |
47 | WHITESPACE@[49; 54) "\n " | 47 | WHITESPACE@[49; 54) "\n " |
48 | FN_DEF@[54; 65) | 48 | FN_DEF@[54; 65) |
49 | FN_KW@[54; 56) "fn" | 49 | FN_KW@[54; 56) "fn" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0022_crate_visibility.rast b/crates/ra_syntax/test_data/parser/inline/ok/0022_crate_visibility.rast index 891943f6e..e0fc96d33 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0022_crate_visibility.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0022_crate_visibility.rast | |||
@@ -10,7 +10,7 @@ SOURCE_FILE@[0; 81) | |||
10 | WHITESPACE@[17; 18) " " | 10 | WHITESPACE@[17; 18) " " |
11 | NAME@[18; 19) | 11 | NAME@[18; 19) |
12 | IDENT@[18; 19) "S" | 12 | IDENT@[18; 19) "S" |
13 | SEMI@[19; 20) ";" | 13 | SEMICOLON@[19; 20) ";" |
14 | WHITESPACE@[20; 21) "\n" | 14 | WHITESPACE@[20; 21) "\n" |
15 | STRUCT_DEF@[21; 40) | 15 | STRUCT_DEF@[21; 40) |
16 | VISIBILITY@[21; 30) | 16 | VISIBILITY@[21; 30) |
@@ -23,7 +23,7 @@ SOURCE_FILE@[0; 81) | |||
23 | WHITESPACE@[37; 38) " " | 23 | WHITESPACE@[37; 38) " " |
24 | NAME@[38; 39) | 24 | NAME@[38; 39) |
25 | IDENT@[38; 39) "S" | 25 | IDENT@[38; 39) "S" |
26 | SEMI@[39; 40) ";" | 26 | SEMICOLON@[39; 40) ";" |
27 | WHITESPACE@[40; 41) "\n" | 27 | WHITESPACE@[40; 41) "\n" |
28 | STRUCT_DEF@[41; 60) | 28 | STRUCT_DEF@[41; 60) |
29 | VISIBILITY@[41; 50) | 29 | VISIBILITY@[41; 50) |
@@ -36,7 +36,7 @@ SOURCE_FILE@[0; 81) | |||
36 | WHITESPACE@[57; 58) " " | 36 | WHITESPACE@[57; 58) " " |
37 | NAME@[58; 59) | 37 | NAME@[58; 59) |
38 | IDENT@[58; 59) "S" | 38 | IDENT@[58; 59) "S" |
39 | SEMI@[59; 60) ";" | 39 | SEMICOLON@[59; 60) ";" |
40 | WHITESPACE@[60; 61) "\n" | 40 | WHITESPACE@[60; 61) "\n" |
41 | STRUCT_DEF@[61; 80) | 41 | STRUCT_DEF@[61; 80) |
42 | VISIBILITY@[61; 70) | 42 | VISIBILITY@[61; 70) |
@@ -49,5 +49,5 @@ SOURCE_FILE@[0; 81) | |||
49 | WHITESPACE@[77; 78) " " | 49 | WHITESPACE@[77; 78) " " |
50 | NAME@[78; 79) | 50 | NAME@[78; 79) |
51 | IDENT@[78; 79) "S" | 51 | IDENT@[78; 79) "S" |
52 | SEMI@[79; 80) ";" | 52 | SEMICOLON@[79; 80) ";" |
53 | WHITESPACE@[80; 81) "\n" | 53 | WHITESPACE@[80; 81) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast index 0f32aec9e..b7acc3f07 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast | |||
@@ -9,5 +9,5 @@ SOURCE_FILE@[0; 22) | |||
9 | WHITESPACE@[18; 19) " " | 9 | WHITESPACE@[18; 19) " " |
10 | PLACEHOLDER_TYPE@[19; 20) | 10 | PLACEHOLDER_TYPE@[19; 20) |
11 | UNDERSCORE@[19; 20) "_" | 11 | UNDERSCORE@[19; 20) "_" |
12 | SEMI@[20; 21) ";" | 12 | SEMICOLON@[20; 21) ";" |
13 | WHITESPACE@[21; 22) "\n" | 13 | WHITESPACE@[21; 22) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0024_slice_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0024_slice_pat.rast index 48aaeaf07..430e4a999 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0024_slice_pat.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0024_slice_pat.rast | |||
@@ -28,7 +28,7 @@ SOURCE_FILE@[0; 39) | |||
28 | COMMA@[25; 26) "," | 28 | COMMA@[25; 26) "," |
29 | WHITESPACE@[26; 27) " " | 29 | WHITESPACE@[26; 27) " " |
30 | DOT_DOT_PAT@[27; 29) | 30 | DOT_DOT_PAT@[27; 29) |
31 | DOTDOT@[27; 29) ".." | 31 | DOT2@[27; 29) ".." |
32 | R_BRACK@[29; 30) "]" | 32 | R_BRACK@[29; 30) "]" |
33 | WHITESPACE@[30; 31) " " | 33 | WHITESPACE@[30; 31) " " |
34 | EQ@[31; 32) "=" | 34 | EQ@[31; 32) "=" |
@@ -36,7 +36,7 @@ SOURCE_FILE@[0; 39) | |||
36 | ARRAY_EXPR@[33; 35) | 36 | ARRAY_EXPR@[33; 35) |
37 | L_BRACK@[33; 34) "[" | 37 | L_BRACK@[33; 34) "[" |
38 | R_BRACK@[34; 35) "]" | 38 | R_BRACK@[34; 35) "]" |
39 | SEMI@[35; 36) ";" | 39 | SEMICOLON@[35; 36) ";" |
40 | WHITESPACE@[36; 37) "\n" | 40 | WHITESPACE@[36; 37) "\n" |
41 | R_CURLY@[37; 38) "}" | 41 | R_CURLY@[37; 38) "}" |
42 | WHITESPACE@[38; 39) "\n" | 42 | WHITESPACE@[38; 39) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0025_slice_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0025_slice_type.rast index b3a24281e..4eee1e7f1 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0025_slice_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0025_slice_type.rast | |||
@@ -13,5 +13,5 @@ SOURCE_FILE@[0; 15) | |||
13 | L_PAREN@[10; 11) "(" | 13 | L_PAREN@[10; 11) "(" |
14 | R_PAREN@[11; 12) ")" | 14 | R_PAREN@[11; 12) ")" |
15 | R_BRACK@[12; 13) "]" | 15 | R_BRACK@[12; 13) "]" |
16 | SEMI@[13; 14) ";" | 16 | SEMICOLON@[13; 14) ";" |
17 | WHITESPACE@[14; 15) "\n" | 17 | WHITESPACE@[14; 15) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rast b/crates/ra_syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rast index 666386d31..d8d82dacc 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rast | |||
@@ -28,7 +28,7 @@ SOURCE_FILE@[0; 97) | |||
28 | TUPLE_EXPR@[25; 27) | 28 | TUPLE_EXPR@[25; 27) |
29 | L_PAREN@[25; 26) "(" | 29 | L_PAREN@[25; 26) "(" |
30 | R_PAREN@[26; 27) ")" | 30 | R_PAREN@[26; 27) ")" |
31 | SEMI@[27; 28) ";" | 31 | SEMICOLON@[27; 28) ";" |
32 | WHITESPACE@[28; 33) "\n " | 32 | WHITESPACE@[28; 33) "\n " |
33 | LET_STMT@[33; 47) | 33 | LET_STMT@[33; 47) |
34 | LET_KW@[33; 36) "let" | 34 | LET_KW@[33; 36) "let" |
@@ -48,7 +48,7 @@ SOURCE_FILE@[0; 97) | |||
48 | TUPLE_EXPR@[44; 46) | 48 | TUPLE_EXPR@[44; 46) |
49 | L_PAREN@[44; 45) "(" | 49 | L_PAREN@[44; 45) "(" |
50 | R_PAREN@[45; 46) ")" | 50 | R_PAREN@[45; 46) ")" |
51 | SEMI@[46; 47) ";" | 51 | SEMICOLON@[46; 47) ";" |
52 | WHITESPACE@[47; 52) "\n " | 52 | WHITESPACE@[47; 52) "\n " |
53 | LET_STMT@[52; 67) | 53 | LET_STMT@[52; 67) |
54 | LET_KW@[52; 55) "let" | 54 | LET_KW@[52; 55) "let" |
@@ -69,7 +69,7 @@ SOURCE_FILE@[0; 97) | |||
69 | TUPLE_EXPR@[64; 66) | 69 | TUPLE_EXPR@[64; 66) |
70 | L_PAREN@[64; 65) "(" | 70 | L_PAREN@[64; 65) "(" |
71 | R_PAREN@[65; 66) ")" | 71 | R_PAREN@[65; 66) ")" |
72 | SEMI@[66; 67) ";" | 72 | SEMICOLON@[66; 67) ";" |
73 | WHITESPACE@[67; 72) "\n " | 73 | WHITESPACE@[67; 72) "\n " |
74 | LET_STMT@[72; 94) | 74 | LET_STMT@[72; 94) |
75 | LET_KW@[72; 75) "let" | 75 | LET_KW@[72; 75) "let" |
@@ -85,7 +85,7 @@ SOURCE_FILE@[0; 97) | |||
85 | COMMA@[79; 80) "," | 85 | COMMA@[79; 80) "," |
86 | WHITESPACE@[80; 81) " " | 86 | WHITESPACE@[80; 81) " " |
87 | DOT_DOT_PAT@[81; 83) | 87 | DOT_DOT_PAT@[81; 83) |
88 | DOTDOT@[81; 83) ".." | 88 | DOT2@[81; 83) ".." |
89 | WHITESPACE@[83; 84) " " | 89 | WHITESPACE@[83; 84) " " |
90 | COMMA@[84; 85) "," | 90 | COMMA@[84; 85) "," |
91 | WHITESPACE@[85; 86) " " | 91 | WHITESPACE@[85; 86) " " |
@@ -99,7 +99,7 @@ SOURCE_FILE@[0; 97) | |||
99 | TUPLE_EXPR@[91; 93) | 99 | TUPLE_EXPR@[91; 93) |
100 | L_PAREN@[91; 92) "(" | 100 | L_PAREN@[91; 92) "(" |
101 | R_PAREN@[92; 93) ")" | 101 | R_PAREN@[92; 93) ")" |
102 | SEMI@[93; 94) ";" | 102 | SEMICOLON@[93; 94) ";" |
103 | WHITESPACE@[94; 95) "\n" | 103 | WHITESPACE@[94; 95) "\n" |
104 | R_CURLY@[95; 96) "}" | 104 | R_CURLY@[95; 96) "}" |
105 | WHITESPACE@[96; 97) "\n" | 105 | WHITESPACE@[96; 97) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0027_ref_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0027_ref_pat.rast index 0f1a367f7..ac6ab31f2 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0027_ref_pat.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0027_ref_pat.rast | |||
@@ -26,7 +26,7 @@ SOURCE_FILE@[0; 52) | |||
26 | TUPLE_EXPR@[25; 27) | 26 | TUPLE_EXPR@[25; 27) |
27 | L_PAREN@[25; 26) "(" | 27 | L_PAREN@[25; 26) "(" |
28 | R_PAREN@[26; 27) ")" | 28 | R_PAREN@[26; 27) ")" |
29 | SEMI@[27; 28) ";" | 29 | SEMICOLON@[27; 28) ";" |
30 | WHITESPACE@[28; 33) "\n " | 30 | WHITESPACE@[28; 33) "\n " |
31 | LET_STMT@[33; 49) | 31 | LET_STMT@[33; 49) |
32 | LET_KW@[33; 36) "let" | 32 | LET_KW@[33; 36) "let" |
@@ -44,7 +44,7 @@ SOURCE_FILE@[0; 52) | |||
44 | TUPLE_EXPR@[46; 48) | 44 | TUPLE_EXPR@[46; 48) |
45 | L_PAREN@[46; 47) "(" | 45 | L_PAREN@[46; 47) "(" |
46 | R_PAREN@[47; 48) ")" | 46 | R_PAREN@[47; 48) ")" |
47 | SEMI@[48; 49) ";" | 47 | SEMICOLON@[48; 49) ";" |
48 | WHITESPACE@[49; 50) "\n" | 48 | WHITESPACE@[49; 50) "\n" |
49 | R_CURLY@[50; 51) "}" | 49 | R_CURLY@[50; 51) "}" |
50 | WHITESPACE@[51; 52) "\n" | 50 | WHITESPACE@[51; 52) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast index f07027fa7..3371cab82 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast | |||
@@ -39,5 +39,5 @@ SOURCE_FILE@[0; 43) | |||
39 | WHITESPACE@[38; 39) " " | 39 | WHITESPACE@[38; 39) " " |
40 | TYPE_BOUND@[39; 41) | 40 | TYPE_BOUND@[39; 41) |
41 | LIFETIME@[39; 41) "\'a" | 41 | LIFETIME@[39; 41) "\'a" |
42 | SEMI@[41; 42) ";" | 42 | SEMICOLON@[41; 42) ";" |
43 | WHITESPACE@[42; 43) "\n" | 43 | WHITESPACE@[42; 43) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0029_cast_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0029_cast_expr.rast index b17a2c257..e9ca214bb 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0029_cast_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0029_cast_expr.rast | |||
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 89) | |||
24 | PATH_SEGMENT@[21; 24) | 24 | PATH_SEGMENT@[21; 24) |
25 | NAME_REF@[21; 24) | 25 | NAME_REF@[21; 24) |
26 | IDENT@[21; 24) "i32" | 26 | IDENT@[21; 24) "i32" |
27 | SEMI@[24; 25) ";" | 27 | SEMICOLON@[24; 25) ";" |
28 | WHITESPACE@[25; 30) "\n " | 28 | WHITESPACE@[25; 30) "\n " |
29 | EXPR_STMT@[30; 43) | 29 | EXPR_STMT@[30; 43) |
30 | BIN_EXPR@[30; 42) | 30 | BIN_EXPR@[30; 42) |
@@ -44,7 +44,7 @@ SOURCE_FILE@[0; 89) | |||
44 | WHITESPACE@[40; 41) " " | 44 | WHITESPACE@[40; 41) " " |
45 | LITERAL@[41; 42) | 45 | LITERAL@[41; 42) |
46 | INT_NUMBER@[41; 42) "1" | 46 | INT_NUMBER@[41; 42) "1" |
47 | SEMI@[42; 43) ";" | 47 | SEMICOLON@[42; 43) ";" |
48 | WHITESPACE@[43; 48) "\n " | 48 | WHITESPACE@[43; 48) "\n " |
49 | EXPR_STMT@[48; 62) | 49 | EXPR_STMT@[48; 62) |
50 | BIN_EXPR@[48; 61) | 50 | BIN_EXPR@[48; 61) |
@@ -64,7 +64,7 @@ SOURCE_FILE@[0; 89) | |||
64 | WHITESPACE@[59; 60) " " | 64 | WHITESPACE@[59; 60) " " |
65 | LITERAL@[60; 61) | 65 | LITERAL@[60; 61) |
66 | INT_NUMBER@[60; 61) "1" | 66 | INT_NUMBER@[60; 61) "1" |
67 | SEMI@[61; 62) ";" | 67 | SEMICOLON@[61; 62) ";" |
68 | WHITESPACE@[62; 67) "\n " | 68 | WHITESPACE@[62; 67) "\n " |
69 | EXPR_STMT@[67; 86) | 69 | EXPR_STMT@[67; 86) |
70 | BIN_EXPR@[67; 85) | 70 | BIN_EXPR@[67; 85) |
@@ -84,7 +84,7 @@ SOURCE_FILE@[0; 89) | |||
84 | WHITESPACE@[80; 81) " " | 84 | WHITESPACE@[80; 81) " " |
85 | LITERAL@[81; 85) | 85 | LITERAL@[81; 85) |
86 | INT_NUMBER@[81; 85) "0x37" | 86 | INT_NUMBER@[81; 85) "0x37" |
87 | SEMI@[85; 86) ";" | 87 | SEMICOLON@[85; 86) ";" |
88 | WHITESPACE@[86; 87) "\n" | 88 | WHITESPACE@[86; 87) "\n" |
89 | R_CURLY@[87; 88) "}" | 89 | R_CURLY@[87; 88) "}" |
90 | WHITESPACE@[88; 89) "\n" | 90 | WHITESPACE@[88; 89) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.rast index a6e14a114..aaef408cc 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.rast | |||
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 93) | |||
24 | BLOCK@[26; 28) | 24 | BLOCK@[26; 28) |
25 | L_CURLY@[26; 27) "{" | 25 | L_CURLY@[26; 27) "{" |
26 | R_CURLY@[27; 28) "}" | 26 | R_CURLY@[27; 28) "}" |
27 | SEMI@[28; 29) ";" | 27 | SEMICOLON@[28; 29) ";" |
28 | WHITESPACE@[29; 34) "\n " | 28 | WHITESPACE@[29; 34) "\n " |
29 | EXPR_STMT@[34; 67) | 29 | EXPR_STMT@[34; 67) |
30 | WHILE_EXPR@[34; 66) | 30 | WHILE_EXPR@[34; 66) |
@@ -63,7 +63,7 @@ SOURCE_FILE@[0; 93) | |||
63 | BLOCK@[64; 66) | 63 | BLOCK@[64; 66) |
64 | L_CURLY@[64; 65) "{" | 64 | L_CURLY@[64; 65) "{" |
65 | R_CURLY@[65; 66) "}" | 65 | R_CURLY@[65; 66) "}" |
66 | SEMI@[66; 67) ";" | 66 | SEMICOLON@[66; 67) ";" |
67 | WHITESPACE@[67; 72) "\n " | 67 | WHITESPACE@[67; 72) "\n " |
68 | EXPR_STMT@[72; 90) | 68 | EXPR_STMT@[72; 90) |
69 | WHILE_EXPR@[72; 89) | 69 | WHILE_EXPR@[72; 89) |
@@ -83,7 +83,7 @@ SOURCE_FILE@[0; 93) | |||
83 | BLOCK@[87; 89) | 83 | BLOCK@[87; 89) |
84 | L_CURLY@[87; 88) "{" | 84 | L_CURLY@[87; 88) "{" |
85 | R_CURLY@[88; 89) "}" | 85 | R_CURLY@[88; 89) "}" |
86 | SEMI@[89; 90) ";" | 86 | SEMICOLON@[89; 90) ";" |
87 | WHITESPACE@[90; 91) "\n" | 87 | WHITESPACE@[90; 91) "\n" |
88 | R_CURLY@[91; 92) "}" | 88 | R_CURLY@[91; 92) "}" |
89 | WHITESPACE@[92; 93) "\n" | 89 | WHITESPACE@[92; 93) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast index 4c17f0db8..bad769850 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast | |||
@@ -12,7 +12,7 @@ SOURCE_FILE@[0; 113) | |||
12 | PARAM_LIST@[11; 13) | 12 | PARAM_LIST@[11; 13) |
13 | L_PAREN@[11; 12) "(" | 13 | L_PAREN@[11; 12) "(" |
14 | R_PAREN@[12; 13) ")" | 14 | R_PAREN@[12; 13) ")" |
15 | SEMI@[13; 14) ";" | 15 | SEMICOLON@[13; 14) ";" |
16 | WHITESPACE@[14; 15) "\n" | 16 | WHITESPACE@[14; 15) "\n" |
17 | TYPE_ALIAS_DEF@[15; 36) | 17 | TYPE_ALIAS_DEF@[15; 36) |
18 | TYPE_KW@[15; 19) "type" | 18 | TYPE_KW@[15; 19) "type" |
@@ -29,7 +29,7 @@ SOURCE_FILE@[0; 113) | |||
29 | PARAM_LIST@[33; 35) | 29 | PARAM_LIST@[33; 35) |
30 | L_PAREN@[33; 34) "(" | 30 | L_PAREN@[33; 34) "(" |
31 | R_PAREN@[34; 35) ")" | 31 | R_PAREN@[34; 35) ")" |
32 | SEMI@[35; 36) ";" | 32 | SEMICOLON@[35; 36) ";" |
33 | WHITESPACE@[36; 37) "\n" | 33 | WHITESPACE@[36; 37) "\n" |
34 | TYPE_ALIAS_DEF@[37; 69) | 34 | TYPE_ALIAS_DEF@[37; 69) |
35 | TYPE_KW@[37; 41) "type" | 35 | TYPE_KW@[37; 41) "type" |
@@ -51,7 +51,7 @@ SOURCE_FILE@[0; 113) | |||
51 | PARAM_LIST@[66; 68) | 51 | PARAM_LIST@[66; 68) |
52 | L_PAREN@[66; 67) "(" | 52 | L_PAREN@[66; 67) "(" |
53 | R_PAREN@[67; 68) ")" | 53 | R_PAREN@[67; 68) ")" |
54 | SEMI@[68; 69) ";" | 54 | SEMICOLON@[68; 69) ";" |
55 | WHITESPACE@[69; 70) "\n" | 55 | WHITESPACE@[69; 70) "\n" |
56 | TYPE_ALIAS_DEF@[70; 112) | 56 | TYPE_ALIAS_DEF@[70; 112) |
57 | TYPE_KW@[70; 74) "type" | 57 | TYPE_KW@[70; 74) "type" |
@@ -82,7 +82,7 @@ SOURCE_FILE@[0; 113) | |||
82 | COMMA@[98; 99) "," | 82 | COMMA@[98; 99) "," |
83 | WHITESPACE@[99; 100) " " | 83 | WHITESPACE@[99; 100) " " |
84 | PARAM@[100; 103) | 84 | PARAM@[100; 103) |
85 | DOTDOTDOT@[100; 103) "..." | 85 | DOT3@[100; 103) "..." |
86 | WHITESPACE@[103; 104) " " | 86 | WHITESPACE@[103; 104) " " |
87 | R_PAREN@[104; 105) ")" | 87 | R_PAREN@[104; 105) ")" |
88 | WHITESPACE@[105; 106) " " | 88 | WHITESPACE@[105; 106) " " |
@@ -94,5 +94,5 @@ SOURCE_FILE@[0; 113) | |||
94 | PATH_SEGMENT@[109; 111) | 94 | PATH_SEGMENT@[109; 111) |
95 | NAME_REF@[109; 111) | 95 | NAME_REF@[109; 111) |
96 | IDENT@[109; 111) "u8" | 96 | IDENT@[109; 111) "u8" |
97 | SEMI@[111; 112) ";" | 97 | SEMICOLON@[111; 112) ";" |
98 | WHITESPACE@[112; 113) "\n" | 98 | WHITESPACE@[112; 113) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0033_reference_type;.rast b/crates/ra_syntax/test_data/parser/inline/ok/0033_reference_type;.rast index 7642ea659..e6ee20b9a 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0033_reference_type;.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0033_reference_type;.rast | |||
@@ -12,7 +12,7 @@ SOURCE_FILE@[0; 54) | |||
12 | TUPLE_TYPE@[10; 12) | 12 | TUPLE_TYPE@[10; 12) |
13 | L_PAREN@[10; 11) "(" | 13 | L_PAREN@[10; 11) "(" |
14 | R_PAREN@[11; 12) ")" | 14 | R_PAREN@[11; 12) ")" |
15 | SEMI@[12; 13) ";" | 15 | SEMICOLON@[12; 13) ";" |
16 | WHITESPACE@[13; 14) "\n" | 16 | WHITESPACE@[13; 14) "\n" |
17 | TYPE_ALIAS_DEF@[14; 35) | 17 | TYPE_ALIAS_DEF@[14; 35) |
18 | TYPE_KW@[14; 18) "type" | 18 | TYPE_KW@[14; 18) "type" |
@@ -29,7 +29,7 @@ SOURCE_FILE@[0; 54) | |||
29 | TUPLE_TYPE@[32; 34) | 29 | TUPLE_TYPE@[32; 34) |
30 | L_PAREN@[32; 33) "(" | 30 | L_PAREN@[32; 33) "(" |
31 | R_PAREN@[33; 34) ")" | 31 | R_PAREN@[33; 34) ")" |
32 | SEMI@[34; 35) ";" | 32 | SEMICOLON@[34; 35) ";" |
33 | WHITESPACE@[35; 36) "\n" | 33 | WHITESPACE@[35; 36) "\n" |
34 | TYPE_ALIAS_DEF@[36; 53) | 34 | TYPE_ALIAS_DEF@[36; 53) |
35 | TYPE_KW@[36; 40) "type" | 35 | TYPE_KW@[36; 40) "type" |
@@ -46,5 +46,5 @@ SOURCE_FILE@[0; 54) | |||
46 | TUPLE_TYPE@[50; 52) | 46 | TUPLE_TYPE@[50; 52) |
47 | L_PAREN@[50; 51) "(" | 47 | L_PAREN@[50; 51) "(" |
48 | R_PAREN@[51; 52) ")" | 48 | R_PAREN@[51; 52) ")" |
49 | SEMI@[52; 53) ";" | 49 | SEMICOLON@[52; 53) ";" |
50 | WHITESPACE@[53; 54) "\n" | 50 | WHITESPACE@[53; 54) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0034_break_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0034_break_expr.rast index 67ffdfd67..4bb95314f 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0034_break_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0034_break_expr.rast | |||
@@ -22,14 +22,14 @@ SOURCE_FILE@[0; 102) | |||
22 | EXPR_STMT@[30; 36) | 22 | EXPR_STMT@[30; 36) |
23 | BREAK_EXPR@[30; 35) | 23 | BREAK_EXPR@[30; 35) |
24 | BREAK_KW@[30; 35) "break" | 24 | BREAK_KW@[30; 35) "break" |
25 | SEMI@[35; 36) ";" | 25 | SEMICOLON@[35; 36) ";" |
26 | WHITESPACE@[36; 45) "\n " | 26 | WHITESPACE@[36; 45) "\n " |
27 | EXPR_STMT@[45; 54) | 27 | EXPR_STMT@[45; 54) |
28 | BREAK_EXPR@[45; 53) | 28 | BREAK_EXPR@[45; 53) |
29 | BREAK_KW@[45; 50) "break" | 29 | BREAK_KW@[45; 50) "break" |
30 | WHITESPACE@[50; 51) " " | 30 | WHITESPACE@[50; 51) " " |
31 | LIFETIME@[51; 53) "\'l" | 31 | LIFETIME@[51; 53) "\'l" |
32 | SEMI@[53; 54) ";" | 32 | SEMICOLON@[53; 54) ";" |
33 | WHITESPACE@[54; 63) "\n " | 33 | WHITESPACE@[54; 63) "\n " |
34 | EXPR_STMT@[63; 72) | 34 | EXPR_STMT@[63; 72) |
35 | BREAK_EXPR@[63; 71) | 35 | BREAK_EXPR@[63; 71) |
@@ -37,7 +37,7 @@ SOURCE_FILE@[0; 102) | |||
37 | WHITESPACE@[68; 69) " " | 37 | WHITESPACE@[68; 69) " " |
38 | LITERAL@[69; 71) | 38 | LITERAL@[69; 71) |
39 | INT_NUMBER@[69; 71) "92" | 39 | INT_NUMBER@[69; 71) "92" |
40 | SEMI@[71; 72) ";" | 40 | SEMICOLON@[71; 72) ";" |
41 | WHITESPACE@[72; 81) "\n " | 41 | WHITESPACE@[72; 81) "\n " |
42 | EXPR_STMT@[81; 93) | 42 | EXPR_STMT@[81; 93) |
43 | BREAK_EXPR@[81; 92) | 43 | BREAK_EXPR@[81; 92) |
@@ -47,7 +47,7 @@ SOURCE_FILE@[0; 102) | |||
47 | WHITESPACE@[89; 90) " " | 47 | WHITESPACE@[89; 90) " " |
48 | LITERAL@[90; 92) | 48 | LITERAL@[90; 92) |
49 | INT_NUMBER@[90; 92) "92" | 49 | INT_NUMBER@[90; 92) "92" |
50 | SEMI@[92; 93) ";" | 50 | SEMICOLON@[92; 93) ";" |
51 | WHITESPACE@[93; 98) "\n " | 51 | WHITESPACE@[93; 98) "\n " |
52 | R_CURLY@[98; 99) "}" | 52 | R_CURLY@[98; 99) "}" |
53 | WHITESPACE@[99; 100) "\n" | 53 | WHITESPACE@[99; 100) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0037_qual_paths.rast b/crates/ra_syntax/test_data/parser/inline/ok/0037_qual_paths.rast index 6e226de4b..1cd7a443f 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0037_qual_paths.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0037_qual_paths.rast | |||
@@ -26,11 +26,11 @@ SOURCE_FILE@[0; 71) | |||
26 | NAME_REF@[15; 16) | 26 | NAME_REF@[15; 16) |
27 | IDENT@[15; 16) "B" | 27 | IDENT@[15; 16) "B" |
28 | R_ANGLE@[16; 17) ">" | 28 | R_ANGLE@[16; 17) ">" |
29 | COLONCOLON@[17; 19) "::" | 29 | COLON2@[17; 19) "::" |
30 | PATH_SEGMENT@[19; 25) | 30 | PATH_SEGMENT@[19; 25) |
31 | NAME_REF@[19; 25) | 31 | NAME_REF@[19; 25) |
32 | IDENT@[19; 25) "Output" | 32 | IDENT@[19; 25) "Output" |
33 | SEMI@[25; 26) ";" | 33 | SEMICOLON@[25; 26) ";" |
34 | WHITESPACE@[26; 27) "\n" | 34 | WHITESPACE@[26; 27) "\n" |
35 | FN_DEF@[27; 70) | 35 | FN_DEF@[27; 70) |
36 | FN_KW@[27; 29) "fn" | 36 | FN_KW@[27; 29) "fn" |
@@ -66,14 +66,14 @@ SOURCE_FILE@[0; 71) | |||
66 | NAME_REF@[48; 55) | 66 | NAME_REF@[48; 55) |
67 | IDENT@[48; 55) "Default" | 67 | IDENT@[48; 55) "Default" |
68 | R_ANGLE@[55; 56) ">" | 68 | R_ANGLE@[55; 56) ">" |
69 | COLONCOLON@[56; 58) "::" | 69 | COLON2@[56; 58) "::" |
70 | PATH_SEGMENT@[58; 65) | 70 | PATH_SEGMENT@[58; 65) |
71 | NAME_REF@[58; 65) | 71 | NAME_REF@[58; 65) |
72 | IDENT@[58; 65) "default" | 72 | IDENT@[58; 65) "default" |
73 | ARG_LIST@[65; 67) | 73 | ARG_LIST@[65; 67) |
74 | L_PAREN@[65; 66) "(" | 74 | L_PAREN@[65; 66) "(" |
75 | R_PAREN@[66; 67) ")" | 75 | R_PAREN@[66; 67) ")" |
76 | SEMI@[67; 68) ";" | 76 | SEMICOLON@[67; 68) ";" |
77 | WHITESPACE@[68; 69) " " | 77 | WHITESPACE@[68; 69) " " |
78 | R_CURLY@[69; 70) "}" | 78 | R_CURLY@[69; 70) "}" |
79 | WHITESPACE@[70; 71) "\n" | 79 | WHITESPACE@[70; 71) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0038_full_range_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0038_full_range_expr.rast index 042cee879..f5db5a9e6 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0038_full_range_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0038_full_range_expr.rast | |||
@@ -21,9 +21,9 @@ SOURCE_FILE@[0; 21) | |||
21 | IDENT@[11; 13) "xs" | 21 | IDENT@[11; 13) "xs" |
22 | L_BRACK@[13; 14) "[" | 22 | L_BRACK@[13; 14) "[" |
23 | RANGE_EXPR@[14; 16) | 23 | RANGE_EXPR@[14; 16) |
24 | DOTDOT@[14; 16) ".." | 24 | DOT2@[14; 16) ".." |
25 | R_BRACK@[16; 17) "]" | 25 | R_BRACK@[16; 17) "]" |
26 | SEMI@[17; 18) ";" | 26 | SEMICOLON@[17; 18) ";" |
27 | WHITESPACE@[18; 19) " " | 27 | WHITESPACE@[18; 19) " " |
28 | R_CURLY@[19; 20) "}" | 28 | R_CURLY@[19; 20) "}" |
29 | WHITESPACE@[20; 21) "\n" | 29 | WHITESPACE@[20; 21) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast b/crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast index 025faf5ca..2d9db61b3 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast | |||
@@ -51,5 +51,5 @@ SOURCE_FILE@[0; 46) | |||
51 | NAME_REF@[40; 43) | 51 | NAME_REF@[40; 43) |
52 | IDENT@[40; 43) "u64" | 52 | IDENT@[40; 43) "u64" |
53 | R_ANGLE@[43; 44) ">" | 53 | R_ANGLE@[43; 44) ">" |
54 | SEMI@[44; 45) ";" | 54 | SEMICOLON@[44; 45) ";" |
55 | WHITESPACE@[45; 46) "\n" | 55 | WHITESPACE@[45; 46) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast b/crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast index d180fcf20..4c175e210 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast | |||
@@ -59,5 +59,5 @@ SOURCE_FILE@[0; 71) | |||
59 | NAME_REF@[65; 68) | 59 | NAME_REF@[65; 68) |
60 | IDENT@[65; 68) "u32" | 60 | IDENT@[65; 68) "u32" |
61 | R_PAREN@[68; 69) ")" | 61 | R_PAREN@[68; 69) ")" |
62 | SEMI@[69; 70) ";" | 62 | SEMICOLON@[69; 70) ";" |
63 | WHITESPACE@[70; 71) "\n" | 63 | WHITESPACE@[70; 71) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0042_call_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0042_call_expr.rast index e8003bf91..f9e677a03 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0042_call_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0042_call_expr.rast | |||
@@ -29,7 +29,7 @@ SOURCE_FILE@[0; 118) | |||
29 | ARG_LIST@[24; 26) | 29 | ARG_LIST@[24; 26) |
30 | L_PAREN@[24; 25) "(" | 30 | L_PAREN@[24; 25) "(" |
31 | R_PAREN@[25; 26) ")" | 31 | R_PAREN@[25; 26) ")" |
32 | SEMI@[26; 27) ";" | 32 | SEMICOLON@[26; 27) ";" |
33 | WHITESPACE@[27; 32) "\n " | 33 | WHITESPACE@[27; 32) "\n " |
34 | LET_STMT@[32; 54) | 34 | LET_STMT@[32; 54) |
35 | LET_KW@[32; 35) "let" | 35 | LET_KW@[32; 35) "let" |
@@ -65,7 +65,7 @@ SOURCE_FILE@[0; 118) | |||
65 | INT_NUMBER@[50; 51) "2" | 65 | INT_NUMBER@[50; 51) "2" |
66 | COMMA@[51; 52) "," | 66 | COMMA@[51; 52) "," |
67 | R_PAREN@[52; 53) ")" | 67 | R_PAREN@[52; 53) ")" |
68 | SEMI@[53; 54) ";" | 68 | SEMICOLON@[53; 54) ";" |
69 | WHITESPACE@[54; 59) "\n " | 69 | WHITESPACE@[54; 59) "\n " |
70 | LET_STMT@[59; 84) | 70 | LET_STMT@[59; 84) |
71 | LET_KW@[59; 62) "let" | 71 | LET_KW@[59; 62) "let" |
@@ -95,7 +95,7 @@ SOURCE_FILE@[0; 118) | |||
95 | NAME_REF@[70; 73) | 95 | NAME_REF@[70; 73) |
96 | IDENT@[70; 73) "Foo" | 96 | IDENT@[70; 73) "Foo" |
97 | R_ANGLE@[73; 74) ">" | 97 | R_ANGLE@[73; 74) ">" |
98 | COLONCOLON@[74; 76) "::" | 98 | COLON2@[74; 76) "::" |
99 | PATH_SEGMENT@[76; 80) | 99 | PATH_SEGMENT@[76; 80) |
100 | NAME_REF@[76; 80) | 100 | NAME_REF@[76; 80) |
101 | IDENT@[76; 80) "func" | 101 | IDENT@[76; 80) "func" |
@@ -103,7 +103,7 @@ SOURCE_FILE@[0; 118) | |||
103 | L_PAREN@[80; 81) "(" | 103 | L_PAREN@[80; 81) "(" |
104 | R_PAREN@[81; 82) ")" | 104 | R_PAREN@[81; 82) ")" |
105 | R_PAREN@[82; 83) ")" | 105 | R_PAREN@[82; 83) ")" |
106 | SEMI@[83; 84) ";" | 106 | SEMICOLON@[83; 84) ";" |
107 | WHITESPACE@[84; 89) "\n " | 107 | WHITESPACE@[84; 89) "\n " |
108 | EXPR_STMT@[89; 115) | 108 | EXPR_STMT@[89; 115) |
109 | CALL_EXPR@[89; 114) | 109 | CALL_EXPR@[89; 114) |
@@ -134,7 +134,7 @@ SOURCE_FILE@[0; 118) | |||
134 | NAME_REF@[99; 104) | 134 | NAME_REF@[99; 104) |
135 | IDENT@[99; 104) "Trait" | 135 | IDENT@[99; 104) "Trait" |
136 | R_ANGLE@[104; 105) ">" | 136 | R_ANGLE@[104; 105) ">" |
137 | COLONCOLON@[105; 107) "::" | 137 | COLON2@[105; 107) "::" |
138 | PATH_SEGMENT@[107; 111) | 138 | PATH_SEGMENT@[107; 111) |
139 | NAME_REF@[107; 111) | 139 | NAME_REF@[107; 111) |
140 | IDENT@[107; 111) "func" | 140 | IDENT@[107; 111) "func" |
@@ -142,7 +142,7 @@ SOURCE_FILE@[0; 118) | |||
142 | L_PAREN@[111; 112) "(" | 142 | L_PAREN@[111; 112) "(" |
143 | R_PAREN@[112; 113) ")" | 143 | R_PAREN@[112; 113) ")" |
144 | R_PAREN@[113; 114) ")" | 144 | R_PAREN@[113; 114) ")" |
145 | SEMI@[114; 115) ";" | 145 | SEMICOLON@[114; 115) ";" |
146 | WHITESPACE@[115; 116) "\n" | 146 | WHITESPACE@[115; 116) "\n" |
147 | R_CURLY@[116; 117) "}" | 147 | R_CURLY@[116; 117) "}" |
148 | WHITESPACE@[117; 118) "\n" | 148 | WHITESPACE@[117; 118) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0043_use_alias.rast b/crates/ra_syntax/test_data/parser/inline/ok/0043_use_alias.rast index 18d8a151f..580f29cfb 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0043_use_alias.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0043_use_alias.rast | |||
@@ -8,7 +8,7 @@ SOURCE_FILE@[0; 198) | |||
8 | PATH_SEGMENT@[4; 8) | 8 | PATH_SEGMENT@[4; 8) |
9 | NAME_REF@[4; 8) | 9 | NAME_REF@[4; 8) |
10 | IDENT@[4; 8) "some" | 10 | IDENT@[4; 8) "some" |
11 | COLONCOLON@[8; 10) "::" | 11 | COLON2@[8; 10) "::" |
12 | PATH_SEGMENT@[10; 14) | 12 | PATH_SEGMENT@[10; 14) |
13 | NAME_REF@[10; 14) | 13 | NAME_REF@[10; 14) |
14 | IDENT@[10; 14) "path" | 14 | IDENT@[10; 14) "path" |
@@ -18,7 +18,7 @@ SOURCE_FILE@[0; 198) | |||
18 | WHITESPACE@[17; 18) " " | 18 | WHITESPACE@[17; 18) " " |
19 | NAME@[18; 27) | 19 | NAME@[18; 27) |
20 | IDENT@[18; 27) "some_name" | 20 | IDENT@[18; 27) "some_name" |
21 | SEMI@[27; 28) ";" | 21 | SEMICOLON@[27; 28) ";" |
22 | WHITESPACE@[28; 29) "\n" | 22 | WHITESPACE@[28; 29) "\n" |
23 | USE_ITEM@[29; 181) | 23 | USE_ITEM@[29; 181) |
24 | USE_KW@[29; 32) "use" | 24 | USE_KW@[29; 32) "use" |
@@ -28,7 +28,7 @@ SOURCE_FILE@[0; 198) | |||
28 | PATH_SEGMENT@[33; 37) | 28 | PATH_SEGMENT@[33; 37) |
29 | NAME_REF@[33; 37) | 29 | NAME_REF@[33; 37) |
30 | IDENT@[33; 37) "some" | 30 | IDENT@[33; 37) "some" |
31 | COLONCOLON@[37; 39) "::" | 31 | COLON2@[37; 39) "::" |
32 | USE_TREE_LIST@[39; 180) | 32 | USE_TREE_LIST@[39; 180) |
33 | L_CURLY@[39; 40) "{" | 33 | L_CURLY@[39; 40) "{" |
34 | WHITESPACE@[40; 42) "\n " | 34 | WHITESPACE@[40; 42) "\n " |
@@ -38,7 +38,7 @@ SOURCE_FILE@[0; 198) | |||
38 | PATH_SEGMENT@[42; 47) | 38 | PATH_SEGMENT@[42; 47) |
39 | NAME_REF@[42; 47) | 39 | NAME_REF@[42; 47) |
40 | IDENT@[42; 47) "other" | 40 | IDENT@[42; 47) "other" |
41 | COLONCOLON@[47; 49) "::" | 41 | COLON2@[47; 49) "::" |
42 | PATH_SEGMENT@[49; 53) | 42 | PATH_SEGMENT@[49; 53) |
43 | NAME_REF@[49; 53) | 43 | NAME_REF@[49; 53) |
44 | IDENT@[49; 53) "path" | 44 | IDENT@[49; 53) "path" |
@@ -56,7 +56,7 @@ SOURCE_FILE@[0; 198) | |||
56 | PATH_SEGMENT@[75; 84) | 56 | PATH_SEGMENT@[75; 84) |
57 | NAME_REF@[75; 84) | 57 | NAME_REF@[75; 84) |
58 | IDENT@[75; 84) "different" | 58 | IDENT@[75; 84) "different" |
59 | COLONCOLON@[84; 86) "::" | 59 | COLON2@[84; 86) "::" |
60 | PATH_SEGMENT@[86; 90) | 60 | PATH_SEGMENT@[86; 90) |
61 | NAME_REF@[86; 90) | 61 | NAME_REF@[86; 90) |
62 | IDENT@[86; 90) "path" | 62 | IDENT@[86; 90) "path" |
@@ -75,11 +75,11 @@ SOURCE_FILE@[0; 198) | |||
75 | PATH_SEGMENT@[111; 114) | 75 | PATH_SEGMENT@[111; 114) |
76 | NAME_REF@[111; 114) | 76 | NAME_REF@[111; 114) |
77 | IDENT@[111; 114) "yet" | 77 | IDENT@[111; 114) "yet" |
78 | COLONCOLON@[114; 116) "::" | 78 | COLON2@[114; 116) "::" |
79 | PATH_SEGMENT@[116; 123) | 79 | PATH_SEGMENT@[116; 123) |
80 | NAME_REF@[116; 123) | 80 | NAME_REF@[116; 123) |
81 | IDENT@[116; 123) "another" | 81 | IDENT@[116; 123) "another" |
82 | COLONCOLON@[123; 125) "::" | 82 | COLON2@[123; 125) "::" |
83 | PATH_SEGMENT@[125; 129) | 83 | PATH_SEGMENT@[125; 129) |
84 | NAME_REF@[125; 129) | 84 | NAME_REF@[125; 129) |
85 | IDENT@[125; 129) "path" | 85 | IDENT@[125; 129) "path" |
@@ -95,31 +95,31 @@ SOURCE_FILE@[0; 198) | |||
95 | PATH_SEGMENT@[132; 139) | 95 | PATH_SEGMENT@[132; 139) |
96 | NAME_REF@[132; 139) | 96 | NAME_REF@[132; 139) |
97 | IDENT@[132; 139) "running" | 97 | IDENT@[132; 139) "running" |
98 | COLONCOLON@[139; 141) "::" | 98 | COLON2@[139; 141) "::" |
99 | PATH_SEGMENT@[141; 144) | 99 | PATH_SEGMENT@[141; 144) |
100 | NAME_REF@[141; 144) | 100 | NAME_REF@[141; 144) |
101 | IDENT@[141; 144) "out" | 101 | IDENT@[141; 144) "out" |
102 | COLONCOLON@[144; 146) "::" | 102 | COLON2@[144; 146) "::" |
103 | PATH_SEGMENT@[146; 148) | 103 | PATH_SEGMENT@[146; 148) |
104 | NAME_REF@[146; 148) | 104 | NAME_REF@[146; 148) |
105 | IDENT@[146; 148) "of" | 105 | IDENT@[146; 148) "of" |
106 | COLONCOLON@[148; 150) "::" | 106 | COLON2@[148; 150) "::" |
107 | PATH_SEGMENT@[150; 158) | 107 | PATH_SEGMENT@[150; 158) |
108 | NAME_REF@[150; 158) | 108 | NAME_REF@[150; 158) |
109 | IDENT@[150; 158) "synonyms" | 109 | IDENT@[150; 158) "synonyms" |
110 | COLONCOLON@[158; 160) "::" | 110 | COLON2@[158; 160) "::" |
111 | PATH_SEGMENT@[160; 164) | 111 | PATH_SEGMENT@[160; 164) |
112 | NAME_REF@[160; 164) | 112 | NAME_REF@[160; 164) |
113 | IDENT@[160; 164) "for_" | 113 | IDENT@[160; 164) "for_" |
114 | COLONCOLON@[164; 166) "::" | 114 | COLON2@[164; 166) "::" |
115 | PATH_SEGMENT@[166; 175) | 115 | PATH_SEGMENT@[166; 175) |
116 | NAME_REF@[166; 175) | 116 | NAME_REF@[166; 175) |
117 | IDENT@[166; 175) "different" | 117 | IDENT@[166; 175) "different" |
118 | COLONCOLON@[175; 177) "::" | 118 | COLON2@[175; 177) "::" |
119 | STAR@[177; 178) "*" | 119 | STAR@[177; 178) "*" |
120 | WHITESPACE@[178; 179) "\n" | 120 | WHITESPACE@[178; 179) "\n" |
121 | R_CURLY@[179; 180) "}" | 121 | R_CURLY@[179; 180) "}" |
122 | SEMI@[180; 181) ";" | 122 | SEMICOLON@[180; 181) ";" |
123 | WHITESPACE@[181; 182) "\n" | 123 | WHITESPACE@[181; 182) "\n" |
124 | USE_ITEM@[182; 197) | 124 | USE_ITEM@[182; 197) |
125 | USE_KW@[182; 185) "use" | 125 | USE_KW@[182; 185) "use" |
@@ -134,5 +134,5 @@ SOURCE_FILE@[0; 198) | |||
134 | AS_KW@[192; 194) "as" | 134 | AS_KW@[192; 194) "as" |
135 | WHITESPACE@[194; 195) " " | 135 | WHITESPACE@[194; 195) " " |
136 | UNDERSCORE@[195; 196) "_" | 136 | UNDERSCORE@[195; 196) "_" |
137 | SEMI@[196; 197) ";" | 137 | SEMICOLON@[196; 197) ";" |
138 | WHITESPACE@[197; 198) "\n" | 138 | WHITESPACE@[197; 198) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast index c7b4e614d..988b58d82 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast | |||
@@ -16,5 +16,5 @@ SOURCE_FILE@[0; 17) | |||
16 | IDENT@[10; 13) "i32" | 16 | IDENT@[10; 13) "i32" |
17 | COMMA@[13; 14) "," | 17 | COMMA@[13; 14) "," |
18 | R_PAREN@[14; 15) ")" | 18 | R_PAREN@[14; 15) ")" |
19 | SEMI@[15; 16) ";" | 19 | SEMICOLON@[15; 16) ";" |
20 | WHITESPACE@[16; 17) "\n" | 20 | WHITESPACE@[16; 17) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0050_fn_decl.rast b/crates/ra_syntax/test_data/parser/inline/ok/0050_fn_decl.rast index 19f961e29..036035f6c 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0050_fn_decl.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0050_fn_decl.rast | |||
@@ -16,7 +16,7 @@ SOURCE_FILE@[0; 22) | |||
16 | PARAM_LIST@[16; 18) | 16 | PARAM_LIST@[16; 18) |
17 | L_PAREN@[16; 17) "(" | 17 | L_PAREN@[16; 17) "(" |
18 | R_PAREN@[17; 18) ")" | 18 | R_PAREN@[17; 18) ")" |
19 | SEMI@[18; 19) ";" | 19 | SEMICOLON@[18; 19) ";" |
20 | WHITESPACE@[19; 20) " " | 20 | WHITESPACE@[19; 20) " " |
21 | R_CURLY@[20; 21) "}" | 21 | R_CURLY@[20; 21) "}" |
22 | WHITESPACE@[21; 22) "\n" | 22 | WHITESPACE@[21; 22) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0051_unit_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0051_unit_type.rast index 6a469f8aa..d9fc5eb8a 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0051_unit_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0051_unit_type.rast | |||
@@ -10,5 +10,5 @@ SOURCE_FILE@[0; 13) | |||
10 | TUPLE_TYPE@[9; 11) | 10 | TUPLE_TYPE@[9; 11) |
11 | L_PAREN@[9; 10) "(" | 11 | L_PAREN@[9; 10) "(" |
12 | R_PAREN@[10; 11) ")" | 12 | R_PAREN@[10; 11) ")" |
13 | SEMI@[11; 12) ";" | 13 | SEMICOLON@[11; 12) ";" |
14 | WHITESPACE@[12; 13) "\n" | 14 | WHITESPACE@[12; 13) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0052_path_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0052_path_type.rast index ee55ee219..8647c23bf 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0052_path_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0052_path_type.rast | |||
@@ -12,7 +12,7 @@ SOURCE_FILE@[0; 71) | |||
12 | PATH_SEGMENT@[9; 12) | 12 | PATH_SEGMENT@[9; 12) |
13 | NAME_REF@[9; 12) | 13 | NAME_REF@[9; 12) |
14 | IDENT@[9; 12) "Foo" | 14 | IDENT@[9; 12) "Foo" |
15 | SEMI@[12; 13) ";" | 15 | SEMICOLON@[12; 13) ";" |
16 | WHITESPACE@[13; 14) "\n" | 16 | WHITESPACE@[13; 14) "\n" |
17 | TYPE_ALIAS_DEF@[14; 29) | 17 | TYPE_ALIAS_DEF@[14; 29) |
18 | TYPE_KW@[14; 18) "type" | 18 | TYPE_KW@[14; 18) "type" |
@@ -25,10 +25,10 @@ SOURCE_FILE@[0; 71) | |||
25 | PATH_TYPE@[23; 28) | 25 | PATH_TYPE@[23; 28) |
26 | PATH@[23; 28) | 26 | PATH@[23; 28) |
27 | PATH_SEGMENT@[23; 28) | 27 | PATH_SEGMENT@[23; 28) |
28 | COLONCOLON@[23; 25) "::" | 28 | COLON2@[23; 25) "::" |
29 | NAME_REF@[25; 28) | 29 | NAME_REF@[25; 28) |
30 | IDENT@[25; 28) "Foo" | 30 | IDENT@[25; 28) "Foo" |
31 | SEMI@[28; 29) ";" | 31 | SEMICOLON@[28; 29) ";" |
32 | WHITESPACE@[29; 30) "\n" | 32 | WHITESPACE@[29; 30) "\n" |
33 | TYPE_ALIAS_DEF@[30; 49) | 33 | TYPE_ALIAS_DEF@[30; 49) |
34 | TYPE_KW@[30; 34) "type" | 34 | TYPE_KW@[30; 34) "type" |
@@ -43,11 +43,11 @@ SOURCE_FILE@[0; 71) | |||
43 | PATH@[39; 43) | 43 | PATH@[39; 43) |
44 | PATH_SEGMENT@[39; 43) | 44 | PATH_SEGMENT@[39; 43) |
45 | SELF_KW@[39; 43) "self" | 45 | SELF_KW@[39; 43) "self" |
46 | COLONCOLON@[43; 45) "::" | 46 | COLON2@[43; 45) "::" |
47 | PATH_SEGMENT@[45; 48) | 47 | PATH_SEGMENT@[45; 48) |
48 | NAME_REF@[45; 48) | 48 | NAME_REF@[45; 48) |
49 | IDENT@[45; 48) "Foo" | 49 | IDENT@[45; 48) "Foo" |
50 | SEMI@[48; 49) ";" | 50 | SEMICOLON@[48; 49) ";" |
51 | WHITESPACE@[49; 50) "\n" | 51 | WHITESPACE@[49; 50) "\n" |
52 | TYPE_ALIAS_DEF@[50; 70) | 52 | TYPE_ALIAS_DEF@[50; 70) |
53 | TYPE_KW@[50; 54) "type" | 53 | TYPE_KW@[50; 54) "type" |
@@ -62,9 +62,9 @@ SOURCE_FILE@[0; 71) | |||
62 | PATH@[59; 64) | 62 | PATH@[59; 64) |
63 | PATH_SEGMENT@[59; 64) | 63 | PATH_SEGMENT@[59; 64) |
64 | SUPER_KW@[59; 64) "super" | 64 | SUPER_KW@[59; 64) "super" |
65 | COLONCOLON@[64; 66) "::" | 65 | COLON2@[64; 66) "::" |
66 | PATH_SEGMENT@[66; 69) | 66 | PATH_SEGMENT@[66; 69) |
67 | NAME_REF@[66; 69) | 67 | NAME_REF@[66; 69) |
68 | IDENT@[66; 69) "Foo" | 68 | IDENT@[66; 69) "Foo" |
69 | SEMI@[69; 70) ";" | 69 | SEMICOLON@[69; 70) ";" |
70 | WHITESPACE@[70; 71) "\n" | 70 | WHITESPACE@[70; 71) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast index f1018fcab..690d8504e 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast | |||
@@ -25,7 +25,7 @@ SOURCE_FILE@[0; 91) | |||
25 | PATH_SEGMENT@[23; 24) | 25 | PATH_SEGMENT@[23; 24) |
26 | NAME_REF@[23; 24) | 26 | NAME_REF@[23; 24) |
27 | IDENT@[23; 24) "a" | 27 | IDENT@[23; 24) "a" |
28 | SEMI@[24; 25) ";" | 28 | SEMICOLON@[24; 25) ";" |
29 | WHITESPACE@[25; 30) "\n " | 29 | WHITESPACE@[25; 30) "\n " |
30 | LET_STMT@[30; 43) | 30 | LET_STMT@[30; 43) |
31 | LET_KW@[30; 33) "let" | 31 | LET_KW@[30; 33) "let" |
@@ -41,11 +41,11 @@ SOURCE_FILE@[0; 91) | |||
41 | PATH_SEGMENT@[38; 39) | 41 | PATH_SEGMENT@[38; 39) |
42 | NAME_REF@[38; 39) | 42 | NAME_REF@[38; 39) |
43 | IDENT@[38; 39) "a" | 43 | IDENT@[38; 39) "a" |
44 | COLONCOLON@[39; 41) "::" | 44 | COLON2@[39; 41) "::" |
45 | PATH_SEGMENT@[41; 42) | 45 | PATH_SEGMENT@[41; 42) |
46 | NAME_REF@[41; 42) | 46 | NAME_REF@[41; 42) |
47 | IDENT@[41; 42) "b" | 47 | IDENT@[41; 42) "b" |
48 | SEMI@[42; 43) ";" | 48 | SEMICOLON@[42; 43) ";" |
49 | WHITESPACE@[43; 48) "\n " | 49 | WHITESPACE@[43; 48) "\n " |
50 | LET_STMT@[48; 65) | 50 | LET_STMT@[48; 65) |
51 | LET_KW@[48; 51) "let" | 51 | LET_KW@[48; 51) "let" |
@@ -58,11 +58,11 @@ SOURCE_FILE@[0; 91) | |||
58 | PATH_EXPR@[56; 64) | 58 | PATH_EXPR@[56; 64) |
59 | PATH@[56; 64) | 59 | PATH@[56; 64) |
60 | PATH_SEGMENT@[56; 64) | 60 | PATH_SEGMENT@[56; 64) |
61 | COLONCOLON@[56; 58) "::" | 61 | COLON2@[56; 58) "::" |
62 | NAME_REF@[58; 59) | 62 | NAME_REF@[58; 59) |
63 | IDENT@[58; 59) "a" | 63 | IDENT@[58; 59) "a" |
64 | TYPE_ARG_LIST@[59; 64) | 64 | TYPE_ARG_LIST@[59; 64) |
65 | COLONCOLON@[59; 61) "::" | 65 | COLON2@[59; 61) "::" |
66 | L_ANGLE@[61; 62) "<" | 66 | L_ANGLE@[61; 62) "<" |
67 | TYPE_ARG@[62; 63) | 67 | TYPE_ARG@[62; 63) |
68 | PATH_TYPE@[62; 63) | 68 | PATH_TYPE@[62; 63) |
@@ -71,7 +71,7 @@ SOURCE_FILE@[0; 91) | |||
71 | NAME_REF@[62; 63) | 71 | NAME_REF@[62; 63) |
72 | IDENT@[62; 63) "b" | 72 | IDENT@[62; 63) "b" |
73 | R_ANGLE@[63; 64) ">" | 73 | R_ANGLE@[63; 64) ">" |
74 | SEMI@[64; 65) ";" | 74 | SEMICOLON@[64; 65) ";" |
75 | WHITESPACE@[65; 70) "\n " | 75 | WHITESPACE@[65; 70) "\n " |
76 | LET_STMT@[70; 88) | 76 | LET_STMT@[70; 88) |
77 | LET_KW@[70; 73) "let" | 77 | LET_KW@[70; 73) "let" |
@@ -86,11 +86,11 @@ SOURCE_FILE@[0; 91) | |||
86 | PATH_SEGMENT@[78; 84) | 86 | PATH_SEGMENT@[78; 84) |
87 | NAME_REF@[78; 84) | 87 | NAME_REF@[78; 84) |
88 | IDENT@[78; 84) "format" | 88 | IDENT@[78; 84) "format" |
89 | EXCL@[84; 85) "!" | 89 | BANG@[84; 85) "!" |
90 | TOKEN_TREE@[85; 87) | 90 | TOKEN_TREE@[85; 87) |
91 | L_PAREN@[85; 86) "(" | 91 | L_PAREN@[85; 86) "(" |
92 | R_PAREN@[86; 87) ")" | 92 | R_PAREN@[86; 87) ")" |
93 | SEMI@[87; 88) ";" | 93 | SEMICOLON@[87; 88) ";" |
94 | WHITESPACE@[88; 89) "\n" | 94 | WHITESPACE@[88; 89) "\n" |
95 | R_CURLY@[89; 90) "}" | 95 | R_CURLY@[89; 90) "}" |
96 | WHITESPACE@[90; 91) "\n" | 96 | WHITESPACE@[90; 91) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0056_where_clause.rast b/crates/ra_syntax/test_data/parser/inline/ok/0056_where_clause.rast index 9a9a13370..c6082791a 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0056_where_clause.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0056_where_clause.rast | |||
@@ -63,7 +63,7 @@ SOURCE_FILE@[0; 116) | |||
63 | PATH_SEGMENT@[64; 72) | 63 | PATH_SEGMENT@[64; 72) |
64 | NAME_REF@[64; 72) | 64 | NAME_REF@[64; 72) |
65 | IDENT@[64; 72) "Iterator" | 65 | IDENT@[64; 72) "Iterator" |
66 | COLONCOLON@[72; 74) "::" | 66 | COLON2@[72; 74) "::" |
67 | PATH_SEGMENT@[74; 78) | 67 | PATH_SEGMENT@[74; 78) |
68 | NAME_REF@[74; 78) | 68 | NAME_REF@[74; 78) |
69 | IDENT@[74; 78) "Item" | 69 | IDENT@[74; 78) "Item" |
@@ -94,7 +94,7 @@ SOURCE_FILE@[0; 116) | |||
94 | NAME_REF@[93; 101) | 94 | NAME_REF@[93; 101) |
95 | IDENT@[93; 101) "Iterator" | 95 | IDENT@[93; 101) "Iterator" |
96 | R_ANGLE@[101; 102) ">" | 96 | R_ANGLE@[101; 102) ">" |
97 | COLONCOLON@[102; 104) "::" | 97 | COLON2@[102; 104) "::" |
98 | PATH_SEGMENT@[104; 108) | 98 | PATH_SEGMENT@[104; 108) |
99 | NAME_REF@[104; 108) | 99 | NAME_REF@[104; 108) |
100 | IDENT@[104; 108) "Item" | 100 | IDENT@[104; 108) "Item" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0058_range_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0058_range_pat.rast index 3d659ce10..8d7083e97 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0058_range_pat.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0058_range_pat.rast | |||
@@ -27,7 +27,7 @@ SOURCE_FILE@[0; 112) | |||
27 | LITERAL@[35; 36) | 27 | LITERAL@[35; 36) |
28 | INT_NUMBER@[35; 36) "0" | 28 | INT_NUMBER@[35; 36) "0" |
29 | WHITESPACE@[36; 37) " " | 29 | WHITESPACE@[36; 37) " " |
30 | DOTDOTDOT@[37; 40) "..." | 30 | DOT3@[37; 40) "..." |
31 | WHITESPACE@[40; 41) " " | 31 | WHITESPACE@[40; 41) " " |
32 | LITERAL_PAT@[41; 44) | 32 | LITERAL_PAT@[41; 44) |
33 | LITERAL@[41; 44) | 33 | LITERAL@[41; 44) |
@@ -46,7 +46,7 @@ SOURCE_FILE@[0; 112) | |||
46 | LITERAL@[60; 63) | 46 | LITERAL@[60; 63) |
47 | INT_NUMBER@[60; 63) "101" | 47 | INT_NUMBER@[60; 63) "101" |
48 | WHITESPACE@[63; 64) " " | 48 | WHITESPACE@[63; 64) " " |
49 | DOTDOTEQ@[64; 67) "..=" | 49 | DOT2EQ@[64; 67) "..=" |
50 | WHITESPACE@[67; 68) " " | 50 | WHITESPACE@[67; 68) " " |
51 | LITERAL_PAT@[68; 71) | 51 | LITERAL_PAT@[68; 71) |
52 | LITERAL@[68; 71) | 52 | LITERAL@[68; 71) |
@@ -65,7 +65,7 @@ SOURCE_FILE@[0; 112) | |||
65 | LITERAL@[87; 90) | 65 | LITERAL@[87; 90) |
66 | INT_NUMBER@[87; 90) "200" | 66 | INT_NUMBER@[87; 90) "200" |
67 | WHITESPACE@[90; 91) " " | 67 | WHITESPACE@[90; 91) " " |
68 | DOTDOT@[91; 93) ".." | 68 | DOT2@[91; 93) ".." |
69 | WHITESPACE@[93; 94) " " | 69 | WHITESPACE@[93; 94) " " |
70 | LITERAL_PAT@[94; 97) | 70 | LITERAL_PAT@[94; 97) |
71 | LITERAL@[94; 97) | 71 | LITERAL@[94; 97) |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0060_extern_crate.rast b/crates/ra_syntax/test_data/parser/inline/ok/0060_extern_crate.rast index 7667201ba..c6e4ee532 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0060_extern_crate.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0060_extern_crate.rast | |||
@@ -6,5 +6,5 @@ SOURCE_FILE@[0; 18) | |||
6 | WHITESPACE@[12; 13) " " | 6 | WHITESPACE@[12; 13) " " |
7 | NAME_REF@[13; 16) | 7 | NAME_REF@[13; 16) |
8 | IDENT@[13; 16) "foo" | 8 | IDENT@[13; 16) "foo" |
9 | SEMI@[16; 17) ";" | 9 | SEMICOLON@[16; 17) ";" |
10 | WHITESPACE@[17; 18) "\n" | 10 | WHITESPACE@[17; 18) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.rast b/crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.rast index dcf527639..89a611799 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.rast | |||
@@ -22,7 +22,7 @@ SOURCE_FILE@[0; 112) | |||
22 | RECORD_FIELD_LIST@[17; 19) | 22 | RECORD_FIELD_LIST@[17; 19) |
23 | L_CURLY@[17; 18) "{" | 23 | L_CURLY@[17; 18) "{" |
24 | R_CURLY@[18; 19) "}" | 24 | R_CURLY@[18; 19) "}" |
25 | SEMI@[19; 20) ";" | 25 | SEMICOLON@[19; 20) ";" |
26 | WHITESPACE@[20; 25) "\n " | 26 | WHITESPACE@[20; 25) "\n " |
27 | EXPR_STMT@[25; 41) | 27 | EXPR_STMT@[25; 41) |
28 | RECORD_LIT@[25; 40) | 28 | RECORD_LIT@[25; 40) |
@@ -35,8 +35,11 @@ SOURCE_FILE@[0; 112) | |||
35 | L_CURLY@[27; 28) "{" | 35 | L_CURLY@[27; 28) "{" |
36 | WHITESPACE@[28; 29) " " | 36 | WHITESPACE@[28; 29) " " |
37 | RECORD_FIELD@[29; 30) | 37 | RECORD_FIELD@[29; 30) |
38 | NAME_REF@[29; 30) | 38 | PATH_EXPR@[29; 30) |
39 | IDENT@[29; 30) "x" | 39 | PATH@[29; 30) |
40 | PATH_SEGMENT@[29; 30) | ||
41 | NAME_REF@[29; 30) | ||
42 | IDENT@[29; 30) "x" | ||
40 | COMMA@[30; 31) "," | 43 | COMMA@[30; 31) "," |
41 | WHITESPACE@[31; 32) " " | 44 | WHITESPACE@[31; 32) " " |
42 | RECORD_FIELD@[32; 37) | 45 | RECORD_FIELD@[32; 37) |
@@ -49,7 +52,7 @@ SOURCE_FILE@[0; 112) | |||
49 | COMMA@[37; 38) "," | 52 | COMMA@[37; 38) "," |
50 | WHITESPACE@[38; 39) " " | 53 | WHITESPACE@[38; 39) " " |
51 | R_CURLY@[39; 40) "}" | 54 | R_CURLY@[39; 40) "}" |
52 | SEMI@[40; 41) ";" | 55 | SEMICOLON@[40; 41) ";" |
53 | WHITESPACE@[41; 46) "\n " | 56 | WHITESPACE@[41; 46) "\n " |
54 | EXPR_STMT@[46; 83) | 57 | EXPR_STMT@[46; 83) |
55 | RECORD_LIT@[46; 82) | 58 | RECORD_LIT@[46; 82) |
@@ -62,8 +65,11 @@ SOURCE_FILE@[0; 112) | |||
62 | L_CURLY@[48; 49) "{" | 65 | L_CURLY@[48; 49) "{" |
63 | WHITESPACE@[49; 50) " " | 66 | WHITESPACE@[49; 50) " " |
64 | RECORD_FIELD@[50; 51) | 67 | RECORD_FIELD@[50; 51) |
65 | NAME_REF@[50; 51) | 68 | PATH_EXPR@[50; 51) |
66 | IDENT@[50; 51) "x" | 69 | PATH@[50; 51) |
70 | PATH_SEGMENT@[50; 51) | ||
71 | NAME_REF@[50; 51) | ||
72 | IDENT@[50; 51) "x" | ||
67 | COMMA@[51; 52) "," | 73 | COMMA@[51; 52) "," |
68 | WHITESPACE@[52; 53) " " | 74 | WHITESPACE@[52; 53) " " |
69 | RECORD_FIELD@[53; 58) | 75 | RECORD_FIELD@[53; 58) |
@@ -75,7 +81,7 @@ SOURCE_FILE@[0; 112) | |||
75 | INT_NUMBER@[56; 58) "32" | 81 | INT_NUMBER@[56; 58) "32" |
76 | COMMA@[58; 59) "," | 82 | COMMA@[58; 59) "," |
77 | WHITESPACE@[59; 60) " " | 83 | WHITESPACE@[59; 60) " " |
78 | DOTDOT@[60; 62) ".." | 84 | DOT2@[60; 62) ".." |
79 | CALL_EXPR@[62; 80) | 85 | CALL_EXPR@[62; 80) |
80 | PATH_EXPR@[62; 78) | 86 | PATH_EXPR@[62; 78) |
81 | PATH@[62; 78) | 87 | PATH@[62; 78) |
@@ -83,7 +89,7 @@ SOURCE_FILE@[0; 112) | |||
83 | PATH_SEGMENT@[62; 69) | 89 | PATH_SEGMENT@[62; 69) |
84 | NAME_REF@[62; 69) | 90 | NAME_REF@[62; 69) |
85 | IDENT@[62; 69) "Default" | 91 | IDENT@[62; 69) "Default" |
86 | COLONCOLON@[69; 71) "::" | 92 | COLON2@[69; 71) "::" |
87 | PATH_SEGMENT@[71; 78) | 93 | PATH_SEGMENT@[71; 78) |
88 | NAME_REF@[71; 78) | 94 | NAME_REF@[71; 78) |
89 | IDENT@[71; 78) "default" | 95 | IDENT@[71; 78) "default" |
@@ -92,7 +98,7 @@ SOURCE_FILE@[0; 112) | |||
92 | R_PAREN@[79; 80) ")" | 98 | R_PAREN@[79; 80) ")" |
93 | WHITESPACE@[80; 81) " " | 99 | WHITESPACE@[80; 81) " " |
94 | R_CURLY@[81; 82) "}" | 100 | R_CURLY@[81; 82) "}" |
95 | SEMI@[82; 83) ";" | 101 | SEMICOLON@[82; 83) ";" |
96 | WHITESPACE@[83; 88) "\n " | 102 | WHITESPACE@[83; 88) "\n " |
97 | EXPR_STMT@[88; 109) | 103 | EXPR_STMT@[88; 109) |
98 | RECORD_LIT@[88; 108) | 104 | RECORD_LIT@[88; 108) |
@@ -113,7 +119,7 @@ SOURCE_FILE@[0; 112) | |||
113 | INT_NUMBER@[105; 106) "1" | 119 | INT_NUMBER@[105; 106) "1" |
114 | WHITESPACE@[106; 107) " " | 120 | WHITESPACE@[106; 107) " " |
115 | R_CURLY@[107; 108) "}" | 121 | R_CURLY@[107; 108) "}" |
116 | SEMI@[108; 109) ";" | 122 | SEMICOLON@[108; 109) ";" |
117 | WHITESPACE@[109; 110) "\n" | 123 | WHITESPACE@[109; 110) "\n" |
118 | R_CURLY@[110; 111) "}" | 124 | R_CURLY@[110; 111) "}" |
119 | WHITESPACE@[111; 112) "\n" | 125 | WHITESPACE@[111; 112) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0062_mod_contents.rast b/crates/ra_syntax/test_data/parser/inline/ok/0062_mod_contents.rast index 6b528c252..99e0a0bec 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0062_mod_contents.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0062_mod_contents.rast | |||
@@ -18,7 +18,7 @@ SOURCE_FILE@[0; 70) | |||
18 | PATH_SEGMENT@[12; 23) | 18 | PATH_SEGMENT@[12; 23) |
19 | NAME_REF@[12; 23) | 19 | NAME_REF@[12; 23) |
20 | IDENT@[12; 23) "macro_rules" | 20 | IDENT@[12; 23) "macro_rules" |
21 | EXCL@[23; 24) "!" | 21 | BANG@[23; 24) "!" |
22 | WHITESPACE@[24; 25) " " | 22 | WHITESPACE@[24; 25) " " |
23 | NAME@[25; 28) | 23 | NAME@[25; 28) |
24 | IDENT@[25; 28) "foo" | 24 | IDENT@[25; 28) "foo" |
@@ -33,26 +33,26 @@ SOURCE_FILE@[0; 70) | |||
33 | PATH_SEGMENT@[32; 35) | 33 | PATH_SEGMENT@[32; 35) |
34 | NAME_REF@[32; 35) | 34 | NAME_REF@[32; 35) |
35 | IDENT@[32; 35) "foo" | 35 | IDENT@[32; 35) "foo" |
36 | COLONCOLON@[35; 37) "::" | 36 | COLON2@[35; 37) "::" |
37 | PATH_SEGMENT@[37; 40) | 37 | PATH_SEGMENT@[37; 40) |
38 | NAME_REF@[37; 40) | 38 | NAME_REF@[37; 40) |
39 | IDENT@[37; 40) "bar" | 39 | IDENT@[37; 40) "bar" |
40 | EXCL@[40; 41) "!" | 40 | BANG@[40; 41) "!" |
41 | TOKEN_TREE@[41; 43) | 41 | TOKEN_TREE@[41; 43) |
42 | L_PAREN@[41; 42) "(" | 42 | L_PAREN@[41; 42) "(" |
43 | R_PAREN@[42; 43) ")" | 43 | R_PAREN@[42; 43) ")" |
44 | SEMI@[43; 44) ";" | 44 | SEMICOLON@[43; 44) ";" |
45 | WHITESPACE@[44; 45) "\n" | 45 | WHITESPACE@[44; 45) "\n" |
46 | MACRO_CALL@[45; 59) | 46 | MACRO_CALL@[45; 59) |
47 | PATH@[45; 55) | 47 | PATH@[45; 55) |
48 | PATH@[45; 50) | 48 | PATH@[45; 50) |
49 | PATH_SEGMENT@[45; 50) | 49 | PATH_SEGMENT@[45; 50) |
50 | SUPER_KW@[45; 50) "super" | 50 | SUPER_KW@[45; 50) "super" |
51 | COLONCOLON@[50; 52) "::" | 51 | COLON2@[50; 52) "::" |
52 | PATH_SEGMENT@[52; 55) | 52 | PATH_SEGMENT@[52; 55) |
53 | NAME_REF@[52; 55) | 53 | NAME_REF@[52; 55) |
54 | IDENT@[52; 55) "baz" | 54 | IDENT@[52; 55) "baz" |
55 | EXCL@[55; 56) "!" | 55 | BANG@[55; 56) "!" |
56 | WHITESPACE@[56; 57) " " | 56 | WHITESPACE@[56; 57) " " |
57 | TOKEN_TREE@[57; 59) | 57 | TOKEN_TREE@[57; 59) |
58 | L_CURLY@[57; 58) "{" | 58 | L_CURLY@[57; 58) "{" |
@@ -63,5 +63,5 @@ SOURCE_FILE@[0; 70) | |||
63 | WHITESPACE@[66; 67) " " | 63 | WHITESPACE@[66; 67) " " |
64 | NAME@[67; 68) | 64 | NAME@[67; 68) |
65 | IDENT@[67; 68) "S" | 65 | IDENT@[67; 68) "S" |
66 | SEMI@[68; 69) ";" | 66 | SEMICOLON@[68; 69) ";" |
67 | WHITESPACE@[69; 70) "\n" | 67 | WHITESPACE@[69; 70) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast b/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast index 0cc3ac085..278549a46 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast | |||
@@ -2,7 +2,7 @@ SOURCE_FILE@[0; 20) | |||
2 | IMPL_DEF@[0; 19) | 2 | IMPL_DEF@[0; 19) |
3 | IMPL_KW@[0; 4) "impl" | 3 | IMPL_KW@[0; 4) "impl" |
4 | WHITESPACE@[4; 5) " " | 4 | WHITESPACE@[4; 5) " " |
5 | EXCL@[5; 6) "!" | 5 | BANG@[5; 6) "!" |
6 | PATH_TYPE@[6; 10) | 6 | PATH_TYPE@[6; 10) |
7 | PATH@[6; 10) | 7 | PATH@[6; 10) |
8 | PATH_SEGMENT@[6; 10) | 8 | PATH_SEGMENT@[6; 10) |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.rast index 2ace3c8ee..df24ae189 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.rast | |||
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 137) | |||
24 | BLOCK@[23; 25) | 24 | BLOCK@[23; 25) |
25 | L_CURLY@[23; 24) "{" | 25 | L_CURLY@[23; 24) "{" |
26 | R_CURLY@[24; 25) "}" | 26 | R_CURLY@[24; 25) "}" |
27 | SEMI@[25; 26) ";" | 27 | SEMICOLON@[25; 26) ";" |
28 | WHITESPACE@[26; 31) "\n " | 28 | WHITESPACE@[26; 31) "\n " |
29 | EXPR_STMT@[31; 50) | 29 | EXPR_STMT@[31; 50) |
30 | IF_EXPR@[31; 49) | 30 | IF_EXPR@[31; 49) |
@@ -45,7 +45,7 @@ SOURCE_FILE@[0; 137) | |||
45 | BLOCK@[47; 49) | 45 | BLOCK@[47; 49) |
46 | L_CURLY@[47; 48) "{" | 46 | L_CURLY@[47; 48) "{" |
47 | R_CURLY@[48; 49) "}" | 47 | R_CURLY@[48; 49) "}" |
48 | SEMI@[49; 50) ";" | 48 | SEMICOLON@[49; 50) ";" |
49 | WHITESPACE@[50; 55) "\n " | 49 | WHITESPACE@[50; 55) "\n " |
50 | EXPR_STMT@[55; 91) | 50 | EXPR_STMT@[55; 91) |
51 | IF_EXPR@[55; 90) | 51 | IF_EXPR@[55; 90) |
@@ -80,7 +80,7 @@ SOURCE_FILE@[0; 137) | |||
80 | BLOCK@[88; 90) | 80 | BLOCK@[88; 90) |
81 | L_CURLY@[88; 89) "{" | 81 | L_CURLY@[88; 89) "{" |
82 | R_CURLY@[89; 90) "}" | 82 | R_CURLY@[89; 90) "}" |
83 | SEMI@[90; 91) ";" | 83 | SEMICOLON@[90; 91) ";" |
84 | WHITESPACE@[91; 96) "\n " | 84 | WHITESPACE@[91; 96) "\n " |
85 | EXPR_STMT@[96; 104) | 85 | EXPR_STMT@[96; 104) |
86 | IF_EXPR@[96; 103) | 86 | IF_EXPR@[96; 103) |
@@ -97,7 +97,7 @@ SOURCE_FILE@[0; 137) | |||
97 | BLOCK@[101; 103) | 97 | BLOCK@[101; 103) |
98 | L_CURLY@[101; 102) "{" | 98 | L_CURLY@[101; 102) "{" |
99 | R_CURLY@[102; 103) "}" | 99 | R_CURLY@[102; 103) "}" |
100 | SEMI@[103; 104) ";" | 100 | SEMICOLON@[103; 104) ";" |
101 | WHITESPACE@[104; 109) "\n " | 101 | WHITESPACE@[104; 109) "\n " |
102 | EXPR_STMT@[109; 134) | 102 | EXPR_STMT@[109; 134) |
103 | IF_EXPR@[109; 133) | 103 | IF_EXPR@[109; 133) |
@@ -126,7 +126,7 @@ SOURCE_FILE@[0; 137) | |||
126 | L_CURLY@[130; 131) "{" | 126 | L_CURLY@[130; 131) "{" |
127 | WHITESPACE@[131; 132) " " | 127 | WHITESPACE@[131; 132) " " |
128 | R_CURLY@[132; 133) "}" | 128 | R_CURLY@[132; 133) "}" |
129 | SEMI@[133; 134) ";" | 129 | SEMICOLON@[133; 134) ";" |
130 | WHITESPACE@[134; 135) "\n" | 130 | WHITESPACE@[134; 135) "\n" |
131 | R_CURLY@[135; 136) "}" | 131 | R_CURLY@[135; 136) "}" |
132 | WHITESPACE@[136; 137) "\n" | 132 | WHITESPACE@[136; 137) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast index 2ee0dc199..bbf347580 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast | |||
@@ -39,5 +39,5 @@ SOURCE_FILE@[0; 42) | |||
39 | WHITESPACE@[37; 38) " " | 39 | WHITESPACE@[37; 38) " " |
40 | TYPE_BOUND@[38; 40) | 40 | TYPE_BOUND@[38; 40) |
41 | LIFETIME@[38; 40) "\'a" | 41 | LIFETIME@[38; 40) "\'a" |
42 | SEMI@[40; 41) ";" | 42 | SEMICOLON@[40; 41) ";" |
43 | WHITESPACE@[41; 42) "\n" | 43 | WHITESPACE@[41; 42) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rast b/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rast index 2f07af4e1..85edd0845 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rast | |||
@@ -146,7 +146,7 @@ SOURCE_FILE@[0; 167) | |||
146 | COMMA@[156; 157) "," | 146 | COMMA@[156; 157) "," |
147 | WHITESPACE@[157; 162) "\n " | 147 | WHITESPACE@[157; 162) "\n " |
148 | R_CURLY@[162; 163) "}" | 148 | R_CURLY@[162; 163) "}" |
149 | SEMI@[163; 164) ";" | 149 | SEMICOLON@[163; 164) ";" |
150 | WHITESPACE@[164; 165) "\n" | 150 | WHITESPACE@[164; 165) "\n" |
151 | R_CURLY@[165; 166) "}" | 151 | R_CURLY@[165; 166) "}" |
152 | WHITESPACE@[166; 167) "\n" | 152 | WHITESPACE@[166; 167) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0067_crate_path.rast b/crates/ra_syntax/test_data/parser/inline/ok/0067_crate_path.rast index f2ba4e909..35994e3fd 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0067_crate_path.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0067_crate_path.rast | |||
@@ -7,9 +7,9 @@ SOURCE_FILE@[0; 16) | |||
7 | PATH@[4; 9) | 7 | PATH@[4; 9) |
8 | PATH_SEGMENT@[4; 9) | 8 | PATH_SEGMENT@[4; 9) |
9 | CRATE_KW@[4; 9) "crate" | 9 | CRATE_KW@[4; 9) "crate" |
10 | COLONCOLON@[9; 11) "::" | 10 | COLON2@[9; 11) "::" |
11 | PATH_SEGMENT@[11; 14) | 11 | PATH_SEGMENT@[11; 14) |
12 | NAME_REF@[11; 14) | 12 | NAME_REF@[11; 14) |
13 | IDENT@[11; 14) "foo" | 13 | IDENT@[11; 14) "foo" |
14 | SEMI@[14; 15) ";" | 14 | SEMICOLON@[14; 15) ";" |
15 | WHITESPACE@[15; 16) "\n" | 15 | WHITESPACE@[15; 16) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rast b/crates/ra_syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rast index 86afc9362..e24247890 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0069_use_tree_list_after_path.rast | |||
@@ -6,7 +6,7 @@ SOURCE_FILE@[0; 37) | |||
6 | PATH@[4; 9) | 6 | PATH@[4; 9) |
7 | PATH_SEGMENT@[4; 9) | 7 | PATH_SEGMENT@[4; 9) |
8 | CRATE_KW@[4; 9) "crate" | 8 | CRATE_KW@[4; 9) "crate" |
9 | COLONCOLON@[9; 11) "::" | 9 | COLON2@[9; 11) "::" |
10 | USE_TREE_LIST@[11; 17) | 10 | USE_TREE_LIST@[11; 17) |
11 | L_CURLY@[11; 12) "{" | 11 | L_CURLY@[11; 12) "{" |
12 | USE_TREE@[12; 16) | 12 | USE_TREE@[12; 16) |
@@ -15,7 +15,7 @@ SOURCE_FILE@[0; 37) | |||
15 | NAME_REF@[12; 16) | 15 | NAME_REF@[12; 16) |
16 | IDENT@[12; 16) "Item" | 16 | IDENT@[12; 16) "Item" |
17 | R_CURLY@[16; 17) "}" | 17 | R_CURLY@[16; 17) "}" |
18 | SEMI@[17; 18) ";" | 18 | SEMICOLON@[17; 18) ";" |
19 | WHITESPACE@[18; 19) "\n" | 19 | WHITESPACE@[18; 19) "\n" |
20 | USE_ITEM@[19; 36) | 20 | USE_ITEM@[19; 36) |
21 | USE_KW@[19; 22) "use" | 21 | USE_KW@[19; 22) "use" |
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 37) | |||
24 | PATH@[23; 27) | 24 | PATH@[23; 27) |
25 | PATH_SEGMENT@[23; 27) | 25 | PATH_SEGMENT@[23; 27) |
26 | SELF_KW@[23; 27) "self" | 26 | SELF_KW@[23; 27) "self" |
27 | COLONCOLON@[27; 29) "::" | 27 | COLON2@[27; 29) "::" |
28 | USE_TREE_LIST@[29; 35) | 28 | USE_TREE_LIST@[29; 35) |
29 | L_CURLY@[29; 30) "{" | 29 | L_CURLY@[29; 30) "{" |
30 | USE_TREE@[30; 34) | 30 | USE_TREE@[30; 34) |
@@ -33,5 +33,5 @@ SOURCE_FILE@[0; 37) | |||
33 | NAME_REF@[30; 34) | 33 | NAME_REF@[30; 34) |
34 | IDENT@[30; 34) "Item" | 34 | IDENT@[30; 34) "Item" |
35 | R_CURLY@[34; 35) "}" | 35 | R_CURLY@[34; 35) "}" |
36 | SEMI@[35; 36) ";" | 36 | SEMICOLON@[35; 36) ";" |
37 | WHITESPACE@[36; 37) "\n" | 37 | WHITESPACE@[36; 37) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast b/crates/ra_syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast index cd63d10f7..4b075569a 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast | |||
@@ -32,7 +32,7 @@ SOURCE_FILE@[0; 46) | |||
32 | WHITESPACE@[28; 29) " " | 32 | WHITESPACE@[28; 29) " " |
33 | LITERAL@[29; 30) | 33 | LITERAL@[29; 30) |
34 | INT_NUMBER@[29; 30) "2" | 34 | INT_NUMBER@[29; 30) "2" |
35 | SEMI@[30; 31) ";" | 35 | SEMICOLON@[30; 31) ";" |
36 | WHITESPACE@[31; 36) "\n " | 36 | WHITESPACE@[31; 36) "\n " |
37 | EXPR_STMT@[36; 39) | 37 | EXPR_STMT@[36; 39) |
38 | BLOCK_EXPR@[36; 39) | 38 | BLOCK_EXPR@[36; 39) |
@@ -47,7 +47,7 @@ SOURCE_FILE@[0; 46) | |||
47 | AMP@[40; 41) "&" | 47 | AMP@[40; 41) "&" |
48 | LITERAL@[41; 42) | 48 | LITERAL@[41; 42) |
49 | INT_NUMBER@[41; 42) "2" | 49 | INT_NUMBER@[41; 42) "2" |
50 | SEMI@[42; 43) ";" | 50 | SEMICOLON@[42; 43) ";" |
51 | WHITESPACE@[43; 44) "\n" | 51 | WHITESPACE@[43; 44) "\n" |
52 | R_CURLY@[44; 45) "}" | 52 | R_CURLY@[44; 45) "}" |
53 | WHITESPACE@[45; 46) "\n" | 53 | WHITESPACE@[45; 46) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rast index 0af668056..559ffb578 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rast | |||
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 97) | |||
24 | L_CURLY@[24; 25) "{" | 24 | L_CURLY@[24; 25) "{" |
25 | WHITESPACE@[25; 26) " " | 25 | WHITESPACE@[25; 26) " " |
26 | R_CURLY@[26; 27) "}" | 26 | R_CURLY@[26; 27) "}" |
27 | SEMI@[27; 28) ";" | 27 | SEMICOLON@[27; 28) ";" |
28 | WHITESPACE@[28; 33) "\n " | 28 | WHITESPACE@[28; 33) "\n " |
29 | EXPR_STMT@[33; 44) | 29 | EXPR_STMT@[33; 44) |
30 | MATCH_EXPR@[33; 43) | 30 | MATCH_EXPR@[33; 43) |
@@ -39,7 +39,7 @@ SOURCE_FILE@[0; 97) | |||
39 | MATCH_ARM_LIST@[41; 43) | 39 | MATCH_ARM_LIST@[41; 43) |
40 | L_CURLY@[41; 42) "{" | 40 | L_CURLY@[41; 42) "{" |
41 | R_CURLY@[42; 43) "}" | 41 | R_CURLY@[42; 43) "}" |
42 | SEMI@[43; 44) ";" | 42 | SEMICOLON@[43; 44) ";" |
43 | WHITESPACE@[44; 49) "\n " | 43 | WHITESPACE@[44; 49) "\n " |
44 | EXPR_STMT@[49; 71) | 44 | EXPR_STMT@[49; 71) |
45 | MATCH_EXPR@[49; 70) | 45 | MATCH_EXPR@[49; 70) |
@@ -65,7 +65,7 @@ SOURCE_FILE@[0; 97) | |||
65 | R_PAREN@[67; 68) ")" | 65 | R_PAREN@[67; 68) ")" |
66 | WHITESPACE@[68; 69) " " | 66 | WHITESPACE@[68; 69) " " |
67 | R_CURLY@[69; 70) "}" | 67 | R_CURLY@[69; 70) "}" |
68 | SEMI@[70; 71) ";" | 68 | SEMICOLON@[70; 71) ";" |
69 | WHITESPACE@[71; 76) "\n " | 69 | WHITESPACE@[71; 76) "\n " |
70 | EXPR_STMT@[76; 94) | 70 | EXPR_STMT@[76; 94) |
71 | MATCH_EXPR@[76; 93) | 71 | MATCH_EXPR@[76; 93) |
@@ -90,7 +90,7 @@ SOURCE_FILE@[0; 97) | |||
90 | MATCH_ARM_LIST@[91; 93) | 90 | MATCH_ARM_LIST@[91; 93) |
91 | L_CURLY@[91; 92) "{" | 91 | L_CURLY@[91; 92) "{" |
92 | R_CURLY@[92; 93) "}" | 92 | R_CURLY@[92; 93) "}" |
93 | SEMI@[93; 94) ";" | 93 | SEMICOLON@[93; 94) ";" |
94 | WHITESPACE@[94; 95) "\n" | 94 | WHITESPACE@[94; 95) "\n" |
95 | R_CURLY@[95; 96) "}" | 95 | R_CURLY@[95; 96) "}" |
96 | WHITESPACE@[96; 97) "\n" | 96 | WHITESPACE@[96; 97) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0072_return_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0072_return_expr.rast index 4a83a7200..084efaee2 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0072_return_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0072_return_expr.rast | |||
@@ -15,7 +15,7 @@ SOURCE_FILE@[0; 40) | |||
15 | EXPR_STMT@[15; 22) | 15 | EXPR_STMT@[15; 22) |
16 | RETURN_EXPR@[15; 21) | 16 | RETURN_EXPR@[15; 21) |
17 | RETURN_KW@[15; 21) "return" | 17 | RETURN_KW@[15; 21) "return" |
18 | SEMI@[21; 22) ";" | 18 | SEMICOLON@[21; 22) ";" |
19 | WHITESPACE@[22; 27) "\n " | 19 | WHITESPACE@[22; 27) "\n " |
20 | EXPR_STMT@[27; 37) | 20 | EXPR_STMT@[27; 37) |
21 | RETURN_EXPR@[27; 36) | 21 | RETURN_EXPR@[27; 36) |
@@ -23,7 +23,7 @@ SOURCE_FILE@[0; 40) | |||
23 | WHITESPACE@[33; 34) " " | 23 | WHITESPACE@[33; 34) " " |
24 | LITERAL@[34; 36) | 24 | LITERAL@[34; 36) |
25 | INT_NUMBER@[34; 36) "92" | 25 | INT_NUMBER@[34; 36) "92" |
26 | SEMI@[36; 37) ";" | 26 | SEMICOLON@[36; 37) ";" |
27 | WHITESPACE@[37; 38) "\n" | 27 | WHITESPACE@[37; 38) "\n" |
28 | R_CURLY@[38; 39) "}" | 28 | R_CURLY@[38; 39) "}" |
29 | WHITESPACE@[39; 40) "\n" | 29 | WHITESPACE@[39; 40) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast b/crates/ra_syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast index 2dd6db28f..64150b774 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast | |||
@@ -16,5 +16,5 @@ SOURCE_FILE@[0; 21) | |||
16 | TUPLE_TYPE@[17; 19) | 16 | TUPLE_TYPE@[17; 19) |
17 | L_PAREN@[17; 18) "(" | 17 | L_PAREN@[17; 18) "(" |
18 | R_PAREN@[18; 19) ")" | 18 | R_PAREN@[18; 19) ")" |
19 | SEMI@[19; 20) ";" | 19 | SEMICOLON@[19; 20) ";" |
20 | WHITESPACE@[20; 21) "\n" | 20 | WHITESPACE@[20; 21) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0075_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0075_block.rast index 28d1bad97..5c7cb4a88 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0075_block.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0075_block.rast | |||
@@ -36,7 +36,7 @@ SOURCE_FILE@[0; 65) | |||
36 | WHITESPACE@[26; 27) " " | 36 | WHITESPACE@[26; 27) " " |
37 | LITERAL@[27; 28) | 37 | LITERAL@[27; 28) |
38 | INT_NUMBER@[27; 28) "1" | 38 | INT_NUMBER@[27; 28) "1" |
39 | SEMI@[28; 29) ";" | 39 | SEMICOLON@[28; 29) ";" |
40 | WHITESPACE@[29; 30) " " | 40 | WHITESPACE@[29; 30) " " |
41 | R_CURLY@[30; 31) "}" | 41 | R_CURLY@[30; 31) "}" |
42 | WHITESPACE@[31; 32) "\n" | 42 | WHITESPACE@[31; 32) "\n" |
@@ -56,12 +56,12 @@ SOURCE_FILE@[0; 65) | |||
56 | EXPR_STMT@[41; 43) | 56 | EXPR_STMT@[41; 43) |
57 | LITERAL@[41; 42) | 57 | LITERAL@[41; 42) |
58 | INT_NUMBER@[41; 42) "1" | 58 | INT_NUMBER@[41; 42) "1" |
59 | SEMI@[42; 43) ";" | 59 | SEMICOLON@[42; 43) ";" |
60 | WHITESPACE@[43; 44) " " | 60 | WHITESPACE@[43; 44) " " |
61 | EXPR_STMT@[44; 46) | 61 | EXPR_STMT@[44; 46) |
62 | LITERAL@[44; 45) | 62 | LITERAL@[44; 45) |
63 | INT_NUMBER@[44; 45) "2" | 63 | INT_NUMBER@[44; 45) "2" |
64 | SEMI@[45; 46) ";" | 64 | SEMICOLON@[45; 46) ";" |
65 | WHITESPACE@[46; 47) " " | 65 | WHITESPACE@[46; 47) " " |
66 | R_CURLY@[47; 48) "}" | 66 | R_CURLY@[47; 48) "}" |
67 | WHITESPACE@[48; 49) "\n" | 67 | WHITESPACE@[48; 49) "\n" |
@@ -81,7 +81,7 @@ SOURCE_FILE@[0; 65) | |||
81 | EXPR_STMT@[58; 60) | 81 | EXPR_STMT@[58; 60) |
82 | LITERAL@[58; 59) | 82 | LITERAL@[58; 59) |
83 | INT_NUMBER@[58; 59) "1" | 83 | INT_NUMBER@[58; 59) "1" |
84 | SEMI@[59; 60) ";" | 84 | SEMICOLON@[59; 60) ";" |
85 | WHITESPACE@[60; 61) " " | 85 | WHITESPACE@[60; 61) " " |
86 | LITERAL@[61; 62) | 86 | LITERAL@[61; 62) |
87 | INT_NUMBER@[61; 62) "2" | 87 | INT_NUMBER@[61; 62) "2" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0077_try_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0077_try_expr.rast index 18ccfe9ef..bb9f674e1 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0077_try_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0077_try_expr.rast | |||
@@ -20,7 +20,7 @@ SOURCE_FILE@[0; 21) | |||
20 | NAME_REF@[15; 16) | 20 | NAME_REF@[15; 16) |
21 | IDENT@[15; 16) "x" | 21 | IDENT@[15; 16) "x" |
22 | QUESTION@[16; 17) "?" | 22 | QUESTION@[16; 17) "?" |
23 | SEMI@[17; 18) ";" | 23 | SEMICOLON@[17; 18) ";" |
24 | WHITESPACE@[18; 19) "\n" | 24 | WHITESPACE@[18; 19) "\n" |
25 | R_CURLY@[19; 20) "}" | 25 | R_CURLY@[19; 20) "}" |
26 | WHITESPACE@[20; 21) "\n" | 26 | WHITESPACE@[20; 21) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0078_type_item.rast b/crates/ra_syntax/test_data/parser/inline/ok/0078_type_item.rast index 4bc0b1858..9a38192d9 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0078_type_item.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0078_type_item.rast | |||
@@ -12,5 +12,5 @@ SOURCE_FILE@[0; 16) | |||
12 | PATH_SEGMENT@[11; 14) | 12 | PATH_SEGMENT@[11; 14) |
13 | NAME_REF@[11; 14) | 13 | NAME_REF@[11; 14) |
14 | IDENT@[11; 14) "Bar" | 14 | IDENT@[11; 14) "Bar" |
15 | SEMI@[14; 15) ";" | 15 | SEMICOLON@[14; 15) ";" |
16 | WHITESPACE@[15; 16) "\n" | 16 | WHITESPACE@[15; 16) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.rast b/crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.rast index 9f8a6b0f6..b8bafc220 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.rast | |||
@@ -24,8 +24,8 @@ SOURCE_FILE@[0; 89) | |||
24 | RANGE_EXPR@[23; 26) | 24 | RANGE_EXPR@[23; 26) |
25 | LITERAL@[23; 24) | 25 | LITERAL@[23; 24) |
26 | INT_NUMBER@[23; 24) "1" | 26 | INT_NUMBER@[23; 24) "1" |
27 | DOTDOT@[24; 26) ".." | 27 | DOT2@[24; 26) ".." |
28 | SEMI@[26; 27) ";" | 28 | SEMICOLON@[26; 27) ";" |
29 | WHITESPACE@[27; 32) "\n " | 29 | WHITESPACE@[27; 32) "\n " |
30 | EXPR_STMT@[32; 54) | 30 | EXPR_STMT@[32; 54) |
31 | MATCH_EXPR@[32; 53) | 31 | MATCH_EXPR@[32; 53) |
@@ -34,7 +34,7 @@ SOURCE_FILE@[0; 89) | |||
34 | RANGE_EXPR@[38; 41) | 34 | RANGE_EXPR@[38; 41) |
35 | LITERAL@[38; 39) | 35 | LITERAL@[38; 39) |
36 | INT_NUMBER@[38; 39) "1" | 36 | INT_NUMBER@[38; 39) "1" |
37 | DOTDOT@[39; 41) ".." | 37 | DOT2@[39; 41) ".." |
38 | WHITESPACE@[41; 42) " " | 38 | WHITESPACE@[41; 42) " " |
39 | MATCH_ARM_LIST@[42; 53) | 39 | MATCH_ARM_LIST@[42; 53) |
40 | L_CURLY@[42; 43) "{" | 40 | L_CURLY@[42; 43) "{" |
@@ -50,7 +50,7 @@ SOURCE_FILE@[0; 89) | |||
50 | R_PAREN@[50; 51) ")" | 50 | R_PAREN@[50; 51) ")" |
51 | WHITESPACE@[51; 52) " " | 51 | WHITESPACE@[51; 52) " " |
52 | R_CURLY@[52; 53) "}" | 52 | R_CURLY@[52; 53) "}" |
53 | SEMI@[53; 54) ";" | 53 | SEMICOLON@[53; 54) ";" |
54 | WHITESPACE@[54; 59) "\n " | 54 | WHITESPACE@[54; 59) "\n " |
55 | EXPR_STMT@[59; 86) | 55 | EXPR_STMT@[59; 86) |
56 | MATCH_EXPR@[59; 85) | 56 | MATCH_EXPR@[59; 85) |
@@ -69,7 +69,7 @@ SOURCE_FILE@[0; 89) | |||
69 | ARG_LIST@[68; 70) | 69 | ARG_LIST@[68; 70) |
70 | L_PAREN@[68; 69) "(" | 70 | L_PAREN@[68; 69) "(" |
71 | R_PAREN@[69; 70) ")" | 71 | R_PAREN@[69; 70) ")" |
72 | DOTDOT@[70; 72) ".." | 72 | DOT2@[70; 72) ".." |
73 | PATH_EXPR@[72; 73) | 73 | PATH_EXPR@[72; 73) |
74 | PATH@[72; 73) | 74 | PATH@[72; 73) |
75 | PATH_SEGMENT@[72; 73) | 75 | PATH_SEGMENT@[72; 73) |
@@ -90,7 +90,7 @@ SOURCE_FILE@[0; 89) | |||
90 | R_PAREN@[82; 83) ")" | 90 | R_PAREN@[82; 83) ")" |
91 | WHITESPACE@[83; 84) " " | 91 | WHITESPACE@[83; 84) " " |
92 | R_CURLY@[84; 85) "}" | 92 | R_CURLY@[84; 85) "}" |
93 | SEMI@[85; 86) ";" | 93 | SEMICOLON@[85; 86) ";" |
94 | WHITESPACE@[86; 87) "\n" | 94 | WHITESPACE@[86; 87) "\n" |
95 | R_CURLY@[87; 88) "}" | 95 | R_CURLY@[87; 88) "}" |
96 | WHITESPACE@[88; 89) "\n" | 96 | WHITESPACE@[88; 89) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast index b1353c2c6..00c4e4220 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast | |||
@@ -27,7 +27,7 @@ SOURCE_FILE@[0; 200) | |||
27 | TUPLE_TYPE@[25; 27) | 27 | TUPLE_TYPE@[25; 27) |
28 | L_PAREN@[25; 26) "(" | 28 | L_PAREN@[25; 26) "(" |
29 | R_PAREN@[26; 27) ")" | 29 | R_PAREN@[26; 27) ")" |
30 | SEMI@[27; 28) ";" | 30 | SEMICOLON@[27; 28) ";" |
31 | WHITESPACE@[28; 29) "\n" | 31 | WHITESPACE@[28; 29) "\n" |
32 | FN_DEF@[29; 79) | 32 | FN_DEF@[29; 79) |
33 | FN_KW@[29; 31) "fn" | 33 | FN_KW@[29; 31) "fn" |
@@ -222,7 +222,7 @@ SOURCE_FILE@[0; 200) | |||
222 | NAME_REF@[177; 180) | 222 | NAME_REF@[177; 180) |
223 | IDENT@[177; 180) "Baz" | 223 | IDENT@[177; 180) "Baz" |
224 | R_ANGLE@[180; 181) ">" | 224 | R_ANGLE@[180; 181) ">" |
225 | COLONCOLON@[181; 183) "::" | 225 | COLON2@[181; 183) "::" |
226 | PATH_SEGMENT@[183; 186) | 226 | PATH_SEGMENT@[183; 186) |
227 | NAME_REF@[183; 186) | 227 | NAME_REF@[183; 186) |
228 | IDENT@[183; 186) "Foo" | 228 | IDENT@[183; 186) "Foo" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast index 8f34afe76..2999977fc 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast | |||
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 52) | |||
24 | AMP@[23; 24) "&" | 24 | AMP@[23; 24) "&" |
25 | LITERAL@[24; 25) | 25 | LITERAL@[24; 25) |
26 | INT_NUMBER@[24; 25) "1" | 26 | INT_NUMBER@[24; 25) "1" |
27 | SEMI@[25; 26) ";" | 27 | SEMICOLON@[25; 26) ";" |
28 | WHITESPACE@[26; 31) "\n " | 28 | WHITESPACE@[26; 31) "\n " |
29 | LET_STMT@[31; 49) | 29 | LET_STMT@[31; 49) |
30 | LET_KW@[31; 34) "let" | 30 | LET_KW@[31; 34) "let" |
@@ -49,7 +49,7 @@ SOURCE_FILE@[0; 52) | |||
49 | ARG_LIST@[46; 48) | 49 | ARG_LIST@[46; 48) |
50 | L_PAREN@[46; 47) "(" | 50 | L_PAREN@[46; 47) "(" |
51 | R_PAREN@[47; 48) ")" | 51 | R_PAREN@[47; 48) ")" |
52 | SEMI@[48; 49) ";" | 52 | SEMICOLON@[48; 49) ";" |
53 | WHITESPACE@[49; 50) "\n" | 53 | WHITESPACE@[49; 50) "\n" |
54 | R_CURLY@[50; 51) "}" | 54 | R_CURLY@[50; 51) "}" |
55 | WHITESPACE@[51; 52) "\n" | 55 | WHITESPACE@[51; 52) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.rast b/crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.rast index e909f2b78..13393e4b8 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.rast | |||
@@ -4,7 +4,7 @@ SOURCE_FILE@[0; 106) | |||
4 | WHITESPACE@[6; 7) " " | 4 | WHITESPACE@[6; 7) " " |
5 | NAME@[7; 10) | 5 | NAME@[7; 10) |
6 | IDENT@[7; 10) "Foo" | 6 | IDENT@[7; 10) "Foo" |
7 | SEMI@[10; 11) ";" | 7 | SEMICOLON@[10; 11) ";" |
8 | WHITESPACE@[11; 12) "\n" | 8 | WHITESPACE@[11; 12) "\n" |
9 | STRUCT_DEF@[12; 25) | 9 | STRUCT_DEF@[12; 25) |
10 | STRUCT_KW@[12; 18) "struct" | 10 | STRUCT_KW@[12; 18) "struct" |
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 106) | |||
24 | TUPLE_FIELD_DEF_LIST@[36; 38) | 24 | TUPLE_FIELD_DEF_LIST@[36; 38) |
25 | L_PAREN@[36; 37) "(" | 25 | L_PAREN@[36; 37) "(" |
26 | R_PAREN@[37; 38) ")" | 26 | R_PAREN@[37; 38) ")" |
27 | SEMI@[38; 39) ";" | 27 | SEMICOLON@[38; 39) ";" |
28 | WHITESPACE@[39; 40) "\n" | 28 | WHITESPACE@[39; 40) "\n" |
29 | STRUCT_DEF@[40; 66) | 29 | STRUCT_DEF@[40; 66) |
30 | STRUCT_KW@[40; 46) "struct" | 30 | STRUCT_KW@[40; 46) "struct" |
@@ -48,7 +48,7 @@ SOURCE_FILE@[0; 106) | |||
48 | NAME_REF@[59; 64) | 48 | NAME_REF@[59; 64) |
49 | IDENT@[59; 64) "usize" | 49 | IDENT@[59; 64) "usize" |
50 | R_PAREN@[64; 65) ")" | 50 | R_PAREN@[64; 65) ")" |
51 | SEMI@[65; 66) ";" | 51 | SEMICOLON@[65; 66) ";" |
52 | WHITESPACE@[66; 67) "\n" | 52 | WHITESPACE@[66; 67) "\n" |
53 | STRUCT_DEF@[67; 105) | 53 | STRUCT_DEF@[67; 105) |
54 | STRUCT_KW@[67; 73) "struct" | 54 | STRUCT_KW@[67; 73) "struct" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0084_paren_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0084_paren_type.rast index c0cf48af5..79d193616 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0084_paren_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0084_paren_type.rast | |||
@@ -15,5 +15,5 @@ SOURCE_FILE@[0; 16) | |||
15 | NAME_REF@[10; 13) | 15 | NAME_REF@[10; 13) |
16 | IDENT@[10; 13) "i32" | 16 | IDENT@[10; 13) "i32" |
17 | R_PAREN@[13; 14) ")" | 17 | R_PAREN@[13; 14) ")" |
18 | SEMI@[14; 15) ";" | 18 | SEMICOLON@[14; 15) ";" |
19 | WHITESPACE@[15; 16) "\n" | 19 | WHITESPACE@[15; 16) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0085_expr_literals.rast b/crates/ra_syntax/test_data/parser/inline/ok/0085_expr_literals.rast index 2903c6f9a..c2cec89b4 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0085_expr_literals.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0085_expr_literals.rast | |||
@@ -22,7 +22,7 @@ SOURCE_FILE@[0; 189) | |||
22 | WHITESPACE@[22; 23) " " | 22 | WHITESPACE@[22; 23) " " |
23 | LITERAL@[23; 27) | 23 | LITERAL@[23; 27) |
24 | TRUE_KW@[23; 27) "true" | 24 | TRUE_KW@[23; 27) "true" |
25 | SEMI@[27; 28) ";" | 25 | SEMICOLON@[27; 28) ";" |
26 | WHITESPACE@[28; 33) "\n " | 26 | WHITESPACE@[28; 33) "\n " |
27 | LET_STMT@[33; 47) | 27 | LET_STMT@[33; 47) |
28 | LET_KW@[33; 36) "let" | 28 | LET_KW@[33; 36) "let" |
@@ -34,7 +34,7 @@ SOURCE_FILE@[0; 189) | |||
34 | WHITESPACE@[40; 41) " " | 34 | WHITESPACE@[40; 41) " " |
35 | LITERAL@[41; 46) | 35 | LITERAL@[41; 46) |
36 | FALSE_KW@[41; 46) "false" | 36 | FALSE_KW@[41; 46) "false" |
37 | SEMI@[46; 47) ";" | 37 | SEMICOLON@[46; 47) ";" |
38 | WHITESPACE@[47; 52) "\n " | 38 | WHITESPACE@[47; 52) "\n " |
39 | LET_STMT@[52; 62) | 39 | LET_STMT@[52; 62) |
40 | LET_KW@[52; 55) "let" | 40 | LET_KW@[52; 55) "let" |
@@ -46,7 +46,7 @@ SOURCE_FILE@[0; 189) | |||
46 | WHITESPACE@[59; 60) " " | 46 | WHITESPACE@[59; 60) " " |
47 | LITERAL@[60; 61) | 47 | LITERAL@[60; 61) |
48 | INT_NUMBER@[60; 61) "1" | 48 | INT_NUMBER@[60; 61) "1" |
49 | SEMI@[61; 62) ";" | 49 | SEMICOLON@[61; 62) ";" |
50 | WHITESPACE@[62; 67) "\n " | 50 | WHITESPACE@[62; 67) "\n " |
51 | LET_STMT@[67; 79) | 51 | LET_STMT@[67; 79) |
52 | LET_KW@[67; 70) "let" | 52 | LET_KW@[67; 70) "let" |
@@ -58,7 +58,7 @@ SOURCE_FILE@[0; 189) | |||
58 | WHITESPACE@[74; 75) " " | 58 | WHITESPACE@[74; 75) " " |
59 | LITERAL@[75; 78) | 59 | LITERAL@[75; 78) |
60 | FLOAT_NUMBER@[75; 78) "2.0" | 60 | FLOAT_NUMBER@[75; 78) "2.0" |
61 | SEMI@[78; 79) ";" | 61 | SEMICOLON@[78; 79) ";" |
62 | WHITESPACE@[79; 84) "\n " | 62 | WHITESPACE@[79; 84) "\n " |
63 | LET_STMT@[84; 97) | 63 | LET_STMT@[84; 97) |
64 | LET_KW@[84; 87) "let" | 64 | LET_KW@[84; 87) "let" |
@@ -70,7 +70,7 @@ SOURCE_FILE@[0; 189) | |||
70 | WHITESPACE@[91; 92) " " | 70 | WHITESPACE@[91; 92) " " |
71 | LITERAL@[92; 96) | 71 | LITERAL@[92; 96) |
72 | BYTE@[92; 96) "b\'a\'" | 72 | BYTE@[92; 96) "b\'a\'" |
73 | SEMI@[96; 97) ";" | 73 | SEMICOLON@[96; 97) ";" |
74 | WHITESPACE@[97; 102) "\n " | 74 | WHITESPACE@[97; 102) "\n " |
75 | LET_STMT@[102; 114) | 75 | LET_STMT@[102; 114) |
76 | LET_KW@[102; 105) "let" | 76 | LET_KW@[102; 105) "let" |
@@ -82,7 +82,7 @@ SOURCE_FILE@[0; 189) | |||
82 | WHITESPACE@[109; 110) " " | 82 | WHITESPACE@[109; 110) " " |
83 | LITERAL@[110; 113) | 83 | LITERAL@[110; 113) |
84 | CHAR@[110; 113) "\'b\'" | 84 | CHAR@[110; 113) "\'b\'" |
85 | SEMI@[113; 114) ";" | 85 | SEMICOLON@[113; 114) ";" |
86 | WHITESPACE@[114; 119) "\n " | 86 | WHITESPACE@[114; 119) "\n " |
87 | LET_STMT@[119; 131) | 87 | LET_STMT@[119; 131) |
88 | LET_KW@[119; 122) "let" | 88 | LET_KW@[119; 122) "let" |
@@ -94,7 +94,7 @@ SOURCE_FILE@[0; 189) | |||
94 | WHITESPACE@[126; 127) " " | 94 | WHITESPACE@[126; 127) " " |
95 | LITERAL@[127; 130) | 95 | LITERAL@[127; 130) |
96 | STRING@[127; 130) "\"c\"" | 96 | STRING@[127; 130) "\"c\"" |
97 | SEMI@[130; 131) ";" | 97 | SEMICOLON@[130; 131) ";" |
98 | WHITESPACE@[131; 136) "\n " | 98 | WHITESPACE@[131; 136) "\n " |
99 | LET_STMT@[136; 149) | 99 | LET_STMT@[136; 149) |
100 | LET_KW@[136; 139) "let" | 100 | LET_KW@[136; 139) "let" |
@@ -106,7 +106,7 @@ SOURCE_FILE@[0; 189) | |||
106 | WHITESPACE@[143; 144) " " | 106 | WHITESPACE@[143; 144) " " |
107 | LITERAL@[144; 148) | 107 | LITERAL@[144; 148) |
108 | RAW_STRING@[144; 148) "r\"d\"" | 108 | RAW_STRING@[144; 148) "r\"d\"" |
109 | SEMI@[148; 149) ";" | 109 | SEMICOLON@[148; 149) ";" |
110 | WHITESPACE@[149; 154) "\n " | 110 | WHITESPACE@[149; 154) "\n " |
111 | LET_STMT@[154; 167) | 111 | LET_STMT@[154; 167) |
112 | LET_KW@[154; 157) "let" | 112 | LET_KW@[154; 157) "let" |
@@ -118,7 +118,7 @@ SOURCE_FILE@[0; 189) | |||
118 | WHITESPACE@[161; 162) " " | 118 | WHITESPACE@[161; 162) " " |
119 | LITERAL@[162; 166) | 119 | LITERAL@[162; 166) |
120 | BYTE_STRING@[162; 166) "b\"e\"" | 120 | BYTE_STRING@[162; 166) "b\"e\"" |
121 | SEMI@[166; 167) ";" | 121 | SEMICOLON@[166; 167) ";" |
122 | WHITESPACE@[167; 172) "\n " | 122 | WHITESPACE@[167; 172) "\n " |
123 | LET_STMT@[172; 186) | 123 | LET_STMT@[172; 186) |
124 | LET_KW@[172; 175) "let" | 124 | LET_KW@[172; 175) "let" |
@@ -130,7 +130,7 @@ SOURCE_FILE@[0; 189) | |||
130 | WHITESPACE@[179; 180) " " | 130 | WHITESPACE@[179; 180) " " |
131 | LITERAL@[180; 185) | 131 | LITERAL@[180; 185) |
132 | RAW_BYTE_STRING@[180; 185) "br\"f\"" | 132 | RAW_BYTE_STRING@[180; 185) "br\"f\"" |
133 | SEMI@[185; 186) ";" | 133 | SEMICOLON@[185; 186) ";" |
134 | WHITESPACE@[186; 187) "\n" | 134 | WHITESPACE@[186; 187) "\n" |
135 | R_CURLY@[187; 188) "}" | 135 | R_CURLY@[187; 188) "}" |
136 | WHITESPACE@[188; 189) "\n" | 136 | WHITESPACE@[188; 189) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast b/crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast index 8d2579cd6..1d7796449 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast | |||
@@ -18,5 +18,5 @@ SOURCE_FILE@[0; 19) | |||
18 | NAME_REF@[13; 16) | 18 | NAME_REF@[13; 16) |
19 | IDENT@[13; 16) "i32" | 19 | IDENT@[13; 16) "i32" |
20 | R_ANGLE@[16; 17) ">" | 20 | R_ANGLE@[16; 17) ">" |
21 | SEMI@[17; 18) ";" | 21 | SEMICOLON@[17; 18) ";" |
22 | WHITESPACE@[18; 19) "\n" | 22 | WHITESPACE@[18; 19) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast b/crates/ra_syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast index fae822367..db6013c6f 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast | |||
@@ -19,5 +19,5 @@ SOURCE_FILE@[0; 21) | |||
19 | TUPLE_TYPE@[17; 19) | 19 | TUPLE_TYPE@[17; 19) |
20 | L_PAREN@[17; 18) "(" | 20 | L_PAREN@[17; 18) "(" |
21 | R_PAREN@[18; 19) ")" | 21 | R_PAREN@[18; 19) ")" |
22 | SEMI@[19; 20) ";" | 22 | SEMICOLON@[19; 20) ";" |
23 | WHITESPACE@[20; 21) "\n" | 23 | WHITESPACE@[20; 21) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0093_index_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0093_index_expr.rast index 1a979e597..118cfc096 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0093_index_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0093_index_expr.rast | |||
@@ -28,7 +28,7 @@ SOURCE_FILE@[0; 26) | |||
28 | LITERAL@[20; 21) | 28 | LITERAL@[20; 21) |
29 | INT_NUMBER@[20; 21) "2" | 29 | INT_NUMBER@[20; 21) "2" |
30 | R_BRACK@[21; 22) "]" | 30 | R_BRACK@[21; 22) "]" |
31 | SEMI@[22; 23) ";" | 31 | SEMICOLON@[22; 23) ";" |
32 | WHITESPACE@[23; 24) "\n" | 32 | WHITESPACE@[23; 24) "\n" |
33 | R_CURLY@[24; 25) "}" | 33 | R_CURLY@[24; 25) "}" |
34 | WHITESPACE@[25; 26) "\n" | 34 | WHITESPACE@[25; 26) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0095_placeholder_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0095_placeholder_pat.rast index fe86894a9..ebe7816a4 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0095_placeholder_pat.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0095_placeholder_pat.rast | |||
@@ -23,7 +23,7 @@ SOURCE_FILE@[0; 26) | |||
23 | TUPLE_EXPR@[20; 22) | 23 | TUPLE_EXPR@[20; 22) |
24 | L_PAREN@[20; 21) "(" | 24 | L_PAREN@[20; 21) "(" |
25 | R_PAREN@[21; 22) ")" | 25 | R_PAREN@[21; 22) ")" |
26 | SEMI@[22; 23) ";" | 26 | SEMICOLON@[22; 23) ";" |
27 | WHITESPACE@[23; 24) " " | 27 | WHITESPACE@[23; 24) " " |
28 | R_CURLY@[24; 25) "}" | 28 | R_CURLY@[24; 25) "}" |
29 | WHITESPACE@[25; 26) "\n" | 29 | WHITESPACE@[25; 26) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rast index 157aa29f5..6bd6f5a6b 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rast | |||
@@ -95,7 +95,7 @@ SOURCE_FILE@[0; 167) | |||
95 | PATH_SEGMENT@[109; 120) | 95 | PATH_SEGMENT@[109; 120) |
96 | NAME_REF@[109; 120) | 96 | NAME_REF@[109; 120) |
97 | IDENT@[109; 120) "macro_rules" | 97 | IDENT@[109; 120) "macro_rules" |
98 | EXCL@[120; 121) "!" | 98 | BANG@[120; 121) "!" |
99 | WHITESPACE@[121; 122) " " | 99 | WHITESPACE@[121; 122) " " |
100 | NAME@[122; 126) | 100 | NAME@[122; 126) |
101 | IDENT@[122; 126) "test" | 101 | IDENT@[122; 126) "test" |
@@ -121,7 +121,7 @@ SOURCE_FILE@[0; 167) | |||
121 | PATH_SEGMENT@[157; 161) | 121 | PATH_SEGMENT@[157; 161) |
122 | NAME_REF@[157; 161) | 122 | NAME_REF@[157; 161) |
123 | IDENT@[157; 161) "test" | 123 | IDENT@[157; 161) "test" |
124 | EXCL@[161; 162) "!" | 124 | BANG@[161; 162) "!" |
125 | TOKEN_TREE@[162; 164) | 125 | TOKEN_TREE@[162; 164) |
126 | L_CURLY@[162; 163) "{" | 126 | L_CURLY@[162; 163) "{" |
127 | R_CURLY@[163; 164) "}" | 127 | R_CURLY@[163; 164) "}" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0100_for_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0100_for_expr.rast index 83c58d25f..d25f087a5 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0100_for_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0100_for_expr.rast | |||
@@ -30,7 +30,7 @@ SOURCE_FILE@[0; 33) | |||
30 | BLOCK@[27; 29) | 30 | BLOCK@[27; 29) |
31 | L_CURLY@[27; 28) "{" | 31 | L_CURLY@[27; 28) "{" |
32 | R_CURLY@[28; 29) "}" | 32 | R_CURLY@[28; 29) "}" |
33 | SEMI@[29; 30) ";" | 33 | SEMICOLON@[29; 30) ";" |
34 | WHITESPACE@[30; 31) "\n" | 34 | WHITESPACE@[30; 31) "\n" |
35 | R_CURLY@[31; 32) "}" | 35 | R_CURLY@[31; 32) "}" |
36 | WHITESPACE@[32; 33) "\n" | 36 | WHITESPACE@[32; 33) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast b/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast index d8e04bd90..c2614543c 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast | |||
@@ -30,7 +30,7 @@ SOURCE_FILE@[0; 119) | |||
30 | TUPLE_EXPR@[26; 28) | 30 | TUPLE_EXPR@[26; 28) |
31 | L_PAREN@[26; 27) "(" | 31 | L_PAREN@[26; 27) "(" |
32 | R_PAREN@[27; 28) ")" | 32 | R_PAREN@[27; 28) ")" |
33 | SEMI@[28; 29) ";" | 33 | SEMICOLON@[28; 29) ";" |
34 | WHITESPACE@[29; 34) "\n " | 34 | WHITESPACE@[29; 34) "\n " |
35 | LET_STMT@[34; 62) | 35 | LET_STMT@[34; 62) |
36 | LET_KW@[34; 37) "let" | 36 | LET_KW@[34; 37) "let" |
@@ -64,7 +64,7 @@ SOURCE_FILE@[0; 119) | |||
64 | TUPLE_EXPR@[59; 61) | 64 | TUPLE_EXPR@[59; 61) |
65 | L_PAREN@[59; 60) "(" | 65 | L_PAREN@[59; 60) "(" |
66 | R_PAREN@[60; 61) ")" | 66 | R_PAREN@[60; 61) ")" |
67 | SEMI@[61; 62) ";" | 67 | SEMICOLON@[61; 62) ";" |
68 | WHITESPACE@[62; 67) "\n " | 68 | WHITESPACE@[62; 67) "\n " |
69 | LET_STMT@[67; 90) | 69 | LET_STMT@[67; 90) |
70 | LET_KW@[67; 70) "let" | 70 | LET_KW@[67; 70) "let" |
@@ -87,7 +87,7 @@ SOURCE_FILE@[0; 119) | |||
87 | UNDERSCORE@[78; 79) "_" | 87 | UNDERSCORE@[78; 79) "_" |
88 | COMMA@[79; 80) "," | 88 | COMMA@[79; 80) "," |
89 | WHITESPACE@[80; 81) " " | 89 | WHITESPACE@[80; 81) " " |
90 | DOTDOT@[81; 83) ".." | 90 | DOT2@[81; 83) ".." |
91 | R_CURLY@[83; 84) "}" | 91 | R_CURLY@[83; 84) "}" |
92 | WHITESPACE@[84; 85) " " | 92 | WHITESPACE@[84; 85) " " |
93 | EQ@[85; 86) "=" | 93 | EQ@[85; 86) "=" |
@@ -95,7 +95,7 @@ SOURCE_FILE@[0; 119) | |||
95 | TUPLE_EXPR@[87; 89) | 95 | TUPLE_EXPR@[87; 89) |
96 | L_PAREN@[87; 88) "(" | 96 | L_PAREN@[87; 88) "(" |
97 | R_PAREN@[88; 89) ")" | 97 | R_PAREN@[88; 89) ")" |
98 | SEMI@[89; 90) ";" | 98 | SEMICOLON@[89; 90) ";" |
99 | WHITESPACE@[90; 95) "\n " | 99 | WHITESPACE@[90; 95) "\n " |
100 | LET_STMT@[95; 116) | 100 | LET_STMT@[95; 116) |
101 | LET_KW@[95; 98) "let" | 101 | LET_KW@[95; 98) "let" |
@@ -125,7 +125,7 @@ SOURCE_FILE@[0; 119) | |||
125 | TUPLE_EXPR@[113; 115) | 125 | TUPLE_EXPR@[113; 115) |
126 | L_PAREN@[113; 114) "(" | 126 | L_PAREN@[113; 114) "(" |
127 | R_PAREN@[114; 115) ")" | 127 | R_PAREN@[114; 115) ")" |
128 | SEMI@[115; 116) ";" | 128 | SEMICOLON@[115; 116) ";" |
129 | WHITESPACE@[116; 117) "\n" | 129 | WHITESPACE@[116; 117) "\n" |
130 | R_CURLY@[117; 118) "}" | 130 | R_CURLY@[117; 118) "}" |
131 | WHITESPACE@[118; 119) "\n" | 131 | WHITESPACE@[118; 119) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0103_array_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0103_array_expr.rast index 0db62a1f5..60fbf2771 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0103_array_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0103_array_expr.rast | |||
@@ -16,7 +16,7 @@ SOURCE_FILE@[0; 55) | |||
16 | ARRAY_EXPR@[15; 17) | 16 | ARRAY_EXPR@[15; 17) |
17 | L_BRACK@[15; 16) "[" | 17 | L_BRACK@[15; 16) "[" |
18 | R_BRACK@[16; 17) "]" | 18 | R_BRACK@[16; 17) "]" |
19 | SEMI@[17; 18) ";" | 19 | SEMICOLON@[17; 18) ";" |
20 | WHITESPACE@[18; 23) "\n " | 20 | WHITESPACE@[18; 23) "\n " |
21 | EXPR_STMT@[23; 27) | 21 | EXPR_STMT@[23; 27) |
22 | ARRAY_EXPR@[23; 26) | 22 | ARRAY_EXPR@[23; 26) |
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 55) | |||
24 | LITERAL@[24; 25) | 24 | LITERAL@[24; 25) |
25 | INT_NUMBER@[24; 25) "1" | 25 | INT_NUMBER@[24; 25) "1" |
26 | R_BRACK@[25; 26) "]" | 26 | R_BRACK@[25; 26) "]" |
27 | SEMI@[26; 27) ";" | 27 | SEMICOLON@[26; 27) ";" |
28 | WHITESPACE@[27; 32) "\n " | 28 | WHITESPACE@[27; 32) "\n " |
29 | EXPR_STMT@[32; 40) | 29 | EXPR_STMT@[32; 40) |
30 | ARRAY_EXPR@[32; 39) | 30 | ARRAY_EXPR@[32; 39) |
@@ -37,19 +37,19 @@ SOURCE_FILE@[0; 55) | |||
37 | INT_NUMBER@[36; 37) "2" | 37 | INT_NUMBER@[36; 37) "2" |
38 | COMMA@[37; 38) "," | 38 | COMMA@[37; 38) "," |
39 | R_BRACK@[38; 39) "]" | 39 | R_BRACK@[38; 39) "]" |
40 | SEMI@[39; 40) ";" | 40 | SEMICOLON@[39; 40) ";" |
41 | WHITESPACE@[40; 45) "\n " | 41 | WHITESPACE@[40; 45) "\n " |
42 | EXPR_STMT@[45; 52) | 42 | EXPR_STMT@[45; 52) |
43 | ARRAY_EXPR@[45; 51) | 43 | ARRAY_EXPR@[45; 51) |
44 | L_BRACK@[45; 46) "[" | 44 | L_BRACK@[45; 46) "[" |
45 | LITERAL@[46; 47) | 45 | LITERAL@[46; 47) |
46 | INT_NUMBER@[46; 47) "1" | 46 | INT_NUMBER@[46; 47) "1" |
47 | SEMI@[47; 48) ";" | 47 | SEMICOLON@[47; 48) ";" |
48 | WHITESPACE@[48; 49) " " | 48 | WHITESPACE@[48; 49) " " |
49 | LITERAL@[49; 50) | 49 | LITERAL@[49; 50) |
50 | INT_NUMBER@[49; 50) "2" | 50 | INT_NUMBER@[49; 50) "2" |
51 | R_BRACK@[50; 51) "]" | 51 | R_BRACK@[50; 51) "]" |
52 | SEMI@[51; 52) ";" | 52 | SEMICOLON@[51; 52) ";" |
53 | WHITESPACE@[52; 53) "\n" | 53 | WHITESPACE@[52; 53) "\n" |
54 | R_CURLY@[53; 54) "}" | 54 | R_CURLY@[53; 54) "}" |
55 | WHITESPACE@[54; 55) "\n" | 55 | WHITESPACE@[54; 55) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast b/crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast index a983d5954..d65c75c65 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast | |||
@@ -37,5 +37,5 @@ SOURCE_FILE@[0; 29) | |||
37 | L_PAREN@[24; 25) "(" | 37 | L_PAREN@[24; 25) "(" |
38 | R_PAREN@[25; 26) ")" | 38 | R_PAREN@[25; 26) ")" |
39 | R_ANGLE@[26; 27) ">" | 39 | R_ANGLE@[26; 27) ">" |
40 | SEMI@[27; 28) ";" | 40 | SEMICOLON@[27; 28) ";" |
41 | WHITESPACE@[28; 29) "\n" | 41 | WHITESPACE@[28; 29) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0105_block_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0105_block_expr.rast index 6bce37a4f..5635cba9b 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0105_block_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0105_block_expr.rast | |||
@@ -17,7 +17,7 @@ SOURCE_FILE@[0; 52) | |||
17 | BLOCK@[15; 17) | 17 | BLOCK@[15; 17) |
18 | L_CURLY@[15; 16) "{" | 18 | L_CURLY@[15; 16) "{" |
19 | R_CURLY@[16; 17) "}" | 19 | R_CURLY@[16; 17) "}" |
20 | SEMI@[17; 18) ";" | 20 | SEMICOLON@[17; 18) ";" |
21 | WHITESPACE@[18; 23) "\n " | 21 | WHITESPACE@[18; 23) "\n " |
22 | EXPR_STMT@[23; 33) | 22 | EXPR_STMT@[23; 33) |
23 | BLOCK_EXPR@[23; 32) | 23 | BLOCK_EXPR@[23; 32) |
@@ -26,7 +26,7 @@ SOURCE_FILE@[0; 52) | |||
26 | BLOCK@[30; 32) | 26 | BLOCK@[30; 32) |
27 | L_CURLY@[30; 31) "{" | 27 | L_CURLY@[30; 31) "{" |
28 | R_CURLY@[31; 32) "}" | 28 | R_CURLY@[31; 32) "}" |
29 | SEMI@[32; 33) ";" | 29 | SEMICOLON@[32; 33) ";" |
30 | WHITESPACE@[33; 38) "\n " | 30 | WHITESPACE@[33; 38) "\n " |
31 | EXPR_STMT@[38; 49) | 31 | EXPR_STMT@[38; 49) |
32 | BLOCK_EXPR@[38; 48) | 32 | BLOCK_EXPR@[38; 48) |
@@ -37,7 +37,7 @@ SOURCE_FILE@[0; 52) | |||
37 | BLOCK@[46; 48) | 37 | BLOCK@[46; 48) |
38 | L_CURLY@[46; 47) "{" | 38 | L_CURLY@[46; 47) "{" |
39 | R_CURLY@[47; 48) "}" | 39 | R_CURLY@[47; 48) "}" |
40 | SEMI@[48; 49) ";" | 40 | SEMICOLON@[48; 49) ";" |
41 | WHITESPACE@[49; 50) "\n" | 41 | WHITESPACE@[49; 50) "\n" |
42 | R_CURLY@[50; 51) "}" | 42 | R_CURLY@[50; 51) "}" |
43 | WHITESPACE@[51; 52) "\n" | 43 | WHITESPACE@[51; 52) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast index 0216123f0..157dfcdb8 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast | |||
@@ -21,7 +21,7 @@ SOURCE_FILE@[0; 134) | |||
21 | TUPLE_EXPR@[18; 20) | 21 | TUPLE_EXPR@[18; 20) |
22 | L_PAREN@[18; 19) "(" | 22 | L_PAREN@[18; 19) "(" |
23 | R_PAREN@[19; 20) ")" | 23 | R_PAREN@[19; 20) ")" |
24 | SEMI@[20; 21) ";" | 24 | SEMICOLON@[20; 21) ";" |
25 | WHITESPACE@[21; 26) "\n " | 25 | WHITESPACE@[21; 26) "\n " |
26 | EXPR_STMT@[26; 43) | 26 | EXPR_STMT@[26; 43) |
27 | LAMBDA_EXPR@[26; 42) | 27 | LAMBDA_EXPR@[26; 42) |
@@ -46,7 +46,7 @@ SOURCE_FILE@[0; 134) | |||
46 | INT_NUMBER@[38; 40) "92" | 46 | INT_NUMBER@[38; 40) "92" |
47 | WHITESPACE@[40; 41) " " | 47 | WHITESPACE@[40; 41) " " |
48 | R_CURLY@[41; 42) "}" | 48 | R_CURLY@[41; 42) "}" |
49 | SEMI@[42; 43) ";" | 49 | SEMICOLON@[42; 43) ";" |
50 | WHITESPACE@[43; 48) "\n " | 50 | WHITESPACE@[43; 48) "\n " |
51 | EXPR_STMT@[48; 54) | 51 | EXPR_STMT@[48; 54) |
52 | LAMBDA_EXPR@[48; 53) | 52 | LAMBDA_EXPR@[48; 53) |
@@ -63,7 +63,7 @@ SOURCE_FILE@[0; 134) | |||
63 | PATH_SEGMENT@[52; 53) | 63 | PATH_SEGMENT@[52; 53) |
64 | NAME_REF@[52; 53) | 64 | NAME_REF@[52; 53) |
65 | IDENT@[52; 53) "x" | 65 | IDENT@[52; 53) "x" |
66 | SEMI@[53; 54) ";" | 66 | SEMICOLON@[53; 54) ";" |
67 | WHITESPACE@[54; 59) "\n " | 67 | WHITESPACE@[54; 59) "\n " |
68 | EXPR_STMT@[59; 76) | 68 | EXPR_STMT@[59; 76) |
69 | LAMBDA_EXPR@[59; 75) | 69 | LAMBDA_EXPR@[59; 75) |
@@ -90,7 +90,7 @@ SOURCE_FILE@[0; 134) | |||
90 | PATH_SEGMENT@[74; 75) | 90 | PATH_SEGMENT@[74; 75) |
91 | NAME_REF@[74; 75) | 91 | NAME_REF@[74; 75) |
92 | IDENT@[74; 75) "x" | 92 | IDENT@[74; 75) "x" |
93 | SEMI@[75; 76) ";" | 93 | SEMICOLON@[75; 76) ";" |
94 | WHITESPACE@[76; 81) "\n " | 94 | WHITESPACE@[76; 81) "\n " |
95 | EXPR_STMT@[81; 93) | 95 | EXPR_STMT@[81; 93) |
96 | LAMBDA_EXPR@[81; 92) | 96 | LAMBDA_EXPR@[81; 92) |
@@ -104,7 +104,7 @@ SOURCE_FILE@[0; 134) | |||
104 | BLOCK@[90; 92) | 104 | BLOCK@[90; 92) |
105 | L_CURLY@[90; 91) "{" | 105 | L_CURLY@[90; 91) "{" |
106 | R_CURLY@[91; 92) "}" | 106 | R_CURLY@[91; 92) "}" |
107 | SEMI@[92; 93) ";" | 107 | SEMICOLON@[92; 93) ";" |
108 | WHITESPACE@[93; 98) "\n " | 108 | WHITESPACE@[93; 98) "\n " |
109 | EXPR_STMT@[98; 109) | 109 | EXPR_STMT@[98; 109) |
110 | LAMBDA_EXPR@[98; 108) | 110 | LAMBDA_EXPR@[98; 108) |
@@ -118,7 +118,7 @@ SOURCE_FILE@[0; 134) | |||
118 | BLOCK@[106; 108) | 118 | BLOCK@[106; 108) |
119 | L_CURLY@[106; 107) "{" | 119 | L_CURLY@[106; 107) "{" |
120 | R_CURLY@[107; 108) "}" | 120 | R_CURLY@[107; 108) "}" |
121 | SEMI@[108; 109) ";" | 121 | SEMICOLON@[108; 109) ";" |
122 | WHITESPACE@[109; 114) "\n " | 122 | WHITESPACE@[109; 114) "\n " |
123 | EXPR_STMT@[114; 131) | 123 | EXPR_STMT@[114; 131) |
124 | LAMBDA_EXPR@[114; 130) | 124 | LAMBDA_EXPR@[114; 130) |
@@ -134,7 +134,7 @@ SOURCE_FILE@[0; 134) | |||
134 | BLOCK@[128; 130) | 134 | BLOCK@[128; 130) |
135 | L_CURLY@[128; 129) "{" | 135 | L_CURLY@[128; 129) "{" |
136 | R_CURLY@[129; 130) "}" | 136 | R_CURLY@[129; 130) "}" |
137 | SEMI@[130; 131) ";" | 137 | SEMICOLON@[130; 131) ";" |
138 | WHITESPACE@[131; 132) "\n" | 138 | WHITESPACE@[131; 132) "\n" |
139 | R_CURLY@[132; 133) "}" | 139 | R_CURLY@[132; 133) "}" |
140 | WHITESPACE@[133; 134) "\n" | 140 | WHITESPACE@[133; 134) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast index ba478528c..cc813038c 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast | |||
@@ -25,7 +25,7 @@ SOURCE_FILE@[0; 49) | |||
25 | ARG_LIST@[20; 22) | 25 | ARG_LIST@[20; 22) |
26 | L_PAREN@[20; 21) "(" | 26 | L_PAREN@[20; 21) "(" |
27 | R_PAREN@[21; 22) ")" | 27 | R_PAREN@[21; 22) ")" |
28 | SEMI@[22; 23) ";" | 28 | SEMICOLON@[22; 23) ";" |
29 | WHITESPACE@[23; 28) "\n " | 29 | WHITESPACE@[23; 28) "\n " |
30 | EXPR_STMT@[28; 46) | 30 | EXPR_STMT@[28; 46) |
31 | METHOD_CALL_EXPR@[28; 45) | 31 | METHOD_CALL_EXPR@[28; 45) |
@@ -38,7 +38,7 @@ SOURCE_FILE@[0; 49) | |||
38 | NAME_REF@[30; 33) | 38 | NAME_REF@[30; 33) |
39 | IDENT@[30; 33) "bar" | 39 | IDENT@[30; 33) "bar" |
40 | TYPE_ARG_LIST@[33; 38) | 40 | TYPE_ARG_LIST@[33; 38) |
41 | COLONCOLON@[33; 35) "::" | 41 | COLON2@[33; 35) "::" |
42 | L_ANGLE@[35; 36) "<" | 42 | L_ANGLE@[35; 36) "<" |
43 | TYPE_ARG@[36; 37) | 43 | TYPE_ARG@[36; 37) |
44 | PATH_TYPE@[36; 37) | 44 | PATH_TYPE@[36; 37) |
@@ -57,7 +57,7 @@ SOURCE_FILE@[0; 49) | |||
57 | INT_NUMBER@[42; 43) "2" | 57 | INT_NUMBER@[42; 43) "2" |
58 | COMMA@[43; 44) "," | 58 | COMMA@[43; 44) "," |
59 | R_PAREN@[44; 45) ")" | 59 | R_PAREN@[44; 45) ")" |
60 | SEMI@[45; 46) ";" | 60 | SEMICOLON@[45; 46) ";" |
61 | WHITESPACE@[46; 47) "\n" | 61 | WHITESPACE@[46; 47) "\n" |
62 | R_CURLY@[47; 48) "}" | 62 | R_CURLY@[47; 48) "}" |
63 | WHITESPACE@[48; 49) "\n" | 63 | WHITESPACE@[48; 49) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0108_tuple_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0108_tuple_expr.rast index 6f685ca8d..27c3f398e 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0108_tuple_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0108_tuple_expr.rast | |||
@@ -16,7 +16,7 @@ SOURCE_FILE@[0; 40) | |||
16 | TUPLE_EXPR@[15; 17) | 16 | TUPLE_EXPR@[15; 17) |
17 | L_PAREN@[15; 16) "(" | 17 | L_PAREN@[15; 16) "(" |
18 | R_PAREN@[16; 17) ")" | 18 | R_PAREN@[16; 17) ")" |
19 | SEMI@[17; 18) ";" | 19 | SEMICOLON@[17; 18) ";" |
20 | WHITESPACE@[18; 23) "\n " | 20 | WHITESPACE@[18; 23) "\n " |
21 | EXPR_STMT@[23; 27) | 21 | EXPR_STMT@[23; 27) |
22 | PAREN_EXPR@[23; 26) | 22 | PAREN_EXPR@[23; 26) |
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 40) | |||
24 | LITERAL@[24; 25) | 24 | LITERAL@[24; 25) |
25 | INT_NUMBER@[24; 25) "1" | 25 | INT_NUMBER@[24; 25) "1" |
26 | R_PAREN@[25; 26) ")" | 26 | R_PAREN@[25; 26) ")" |
27 | SEMI@[26; 27) ";" | 27 | SEMICOLON@[26; 27) ";" |
28 | WHITESPACE@[27; 32) "\n " | 28 | WHITESPACE@[27; 32) "\n " |
29 | EXPR_STMT@[32; 37) | 29 | EXPR_STMT@[32; 37) |
30 | TUPLE_EXPR@[32; 36) | 30 | TUPLE_EXPR@[32; 36) |
@@ -33,7 +33,7 @@ SOURCE_FILE@[0; 40) | |||
33 | INT_NUMBER@[33; 34) "1" | 33 | INT_NUMBER@[33; 34) "1" |
34 | COMMA@[34; 35) "," | 34 | COMMA@[34; 35) "," |
35 | R_PAREN@[35; 36) ")" | 35 | R_PAREN@[35; 36) ")" |
36 | SEMI@[36; 37) ";" | 36 | SEMICOLON@[36; 37) ";" |
37 | WHITESPACE@[37; 38) "\n" | 37 | WHITESPACE@[37; 38) "\n" |
38 | R_CURLY@[38; 39) "}" | 38 | R_CURLY@[38; 39) "}" |
39 | WHITESPACE@[39; 40) "\n" | 39 | WHITESPACE@[39; 40) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0110_use_path.rast b/crates/ra_syntax/test_data/parser/inline/ok/0110_use_path.rast index 7dbcd3927..d4f5737d5 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0110_use_path.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0110_use_path.rast | |||
@@ -5,10 +5,10 @@ SOURCE_FILE@[0; 154) | |||
5 | USE_TREE@[4; 16) | 5 | USE_TREE@[4; 16) |
6 | PATH@[4; 16) | 6 | PATH@[4; 16) |
7 | PATH_SEGMENT@[4; 16) | 7 | PATH_SEGMENT@[4; 16) |
8 | COLONCOLON@[4; 6) "::" | 8 | COLON2@[4; 6) "::" |
9 | NAME_REF@[6; 16) | 9 | NAME_REF@[6; 16) |
10 | IDENT@[6; 16) "crate_name" | 10 | IDENT@[6; 16) "crate_name" |
11 | SEMI@[16; 17) ";" | 11 | SEMICOLON@[16; 17) ";" |
12 | WHITESPACE@[17; 18) " " | 12 | WHITESPACE@[17; 18) " " |
13 | COMMENT@[18; 45) "// Rust 2018 - All fl ..." | 13 | COMMENT@[18; 45) "// Rust 2018 - All fl ..." |
14 | WHITESPACE@[45; 46) "\n" | 14 | WHITESPACE@[45; 46) "\n" |
@@ -20,7 +20,7 @@ SOURCE_FILE@[0; 154) | |||
20 | PATH_SEGMENT@[50; 60) | 20 | PATH_SEGMENT@[50; 60) |
21 | NAME_REF@[50; 60) | 21 | NAME_REF@[50; 60) |
22 | IDENT@[50; 60) "crate_name" | 22 | IDENT@[50; 60) "crate_name" |
23 | SEMI@[60; 61) ";" | 23 | SEMICOLON@[60; 61) ";" |
24 | WHITESPACE@[61; 62) " " | 24 | WHITESPACE@[61; 62) " " |
25 | COMMENT@[62; 91) "// Rust 2018 - Anchor ..." | 25 | COMMENT@[62; 91) "// Rust 2018 - Anchor ..." |
26 | WHITESPACE@[91; 92) "\n" | 26 | WHITESPACE@[91; 92) "\n" |
@@ -32,7 +32,7 @@ SOURCE_FILE@[0; 154) | |||
32 | PATH_SEGMENT@[96; 123) | 32 | PATH_SEGMENT@[96; 123) |
33 | NAME_REF@[96; 123) | 33 | NAME_REF@[96; 123) |
34 | IDENT@[96; 123) "item_in_scope_or_crat ..." | 34 | IDENT@[96; 123) "item_in_scope_or_crat ..." |
35 | SEMI@[123; 124) ";" | 35 | SEMICOLON@[123; 124) ";" |
36 | WHITESPACE@[124; 125) " " | 36 | WHITESPACE@[124; 125) " " |
37 | COMMENT@[125; 153) "// Rust 2018 - Unifor ..." | 37 | COMMENT@[125; 153) "// Rust 2018 - Unifor ..." |
38 | WHITESPACE@[153; 154) "\n" | 38 | WHITESPACE@[153; 154) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0111_tuple_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0111_tuple_pat.rast index 4680c267e..88e72d057 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0111_tuple_pat.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0111_tuple_pat.rast | |||
@@ -28,7 +28,7 @@ SOURCE_FILE@[0; 94) | |||
28 | COMMA@[25; 26) "," | 28 | COMMA@[25; 26) "," |
29 | WHITESPACE@[26; 27) " " | 29 | WHITESPACE@[26; 27) " " |
30 | DOT_DOT_PAT@[27; 29) | 30 | DOT_DOT_PAT@[27; 29) |
31 | DOTDOT@[27; 29) ".." | 31 | DOT2@[27; 29) ".." |
32 | R_PAREN@[29; 30) ")" | 32 | R_PAREN@[29; 30) ")" |
33 | WHITESPACE@[30; 31) " " | 33 | WHITESPACE@[30; 31) " " |
34 | EQ@[31; 32) "=" | 34 | EQ@[31; 32) "=" |
@@ -36,7 +36,7 @@ SOURCE_FILE@[0; 94) | |||
36 | TUPLE_EXPR@[33; 35) | 36 | TUPLE_EXPR@[33; 35) |
37 | L_PAREN@[33; 34) "(" | 37 | L_PAREN@[33; 34) "(" |
38 | R_PAREN@[34; 35) ")" | 38 | R_PAREN@[34; 35) ")" |
39 | SEMI@[35; 36) ";" | 39 | SEMICOLON@[35; 36) ";" |
40 | WHITESPACE@[36; 41) "\n " | 40 | WHITESPACE@[36; 41) "\n " |
41 | LET_STMT@[41; 55) | 41 | LET_STMT@[41; 55) |
42 | LET_KW@[41; 44) "let" | 42 | LET_KW@[41; 44) "let" |
@@ -54,7 +54,7 @@ SOURCE_FILE@[0; 94) | |||
54 | TUPLE_EXPR@[52; 54) | 54 | TUPLE_EXPR@[52; 54) |
55 | L_PAREN@[52; 53) "(" | 55 | L_PAREN@[52; 53) "(" |
56 | R_PAREN@[53; 54) ")" | 56 | R_PAREN@[53; 54) ")" |
57 | SEMI@[54; 55) ";" | 57 | SEMICOLON@[54; 55) ";" |
58 | WHITESPACE@[55; 60) "\n " | 58 | WHITESPACE@[55; 60) "\n " |
59 | LET_STMT@[60; 74) | 59 | LET_STMT@[60; 74) |
60 | LET_KW@[60; 63) "let" | 60 | LET_KW@[60; 63) "let" |
@@ -62,7 +62,7 @@ SOURCE_FILE@[0; 94) | |||
62 | TUPLE_PAT@[64; 68) | 62 | TUPLE_PAT@[64; 68) |
63 | L_PAREN@[64; 65) "(" | 63 | L_PAREN@[64; 65) "(" |
64 | DOT_DOT_PAT@[65; 67) | 64 | DOT_DOT_PAT@[65; 67) |
65 | DOTDOT@[65; 67) ".." | 65 | DOT2@[65; 67) ".." |
66 | R_PAREN@[67; 68) ")" | 66 | R_PAREN@[67; 68) ")" |
67 | WHITESPACE@[68; 69) " " | 67 | WHITESPACE@[68; 69) " " |
68 | EQ@[69; 70) "=" | 68 | EQ@[69; 70) "=" |
@@ -70,7 +70,7 @@ SOURCE_FILE@[0; 94) | |||
70 | TUPLE_EXPR@[71; 73) | 70 | TUPLE_EXPR@[71; 73) |
71 | L_PAREN@[71; 72) "(" | 71 | L_PAREN@[71; 72) "(" |
72 | R_PAREN@[72; 73) ")" | 72 | R_PAREN@[72; 73) ")" |
73 | SEMI@[73; 74) ";" | 73 | SEMICOLON@[73; 74) ";" |
74 | WHITESPACE@[74; 79) "\n " | 74 | WHITESPACE@[74; 79) "\n " |
75 | LET_STMT@[79; 91) | 75 | LET_STMT@[79; 91) |
76 | LET_KW@[79; 82) "let" | 76 | LET_KW@[79; 82) "let" |
@@ -84,7 +84,7 @@ SOURCE_FILE@[0; 94) | |||
84 | TUPLE_EXPR@[88; 90) | 84 | TUPLE_EXPR@[88; 90) |
85 | L_PAREN@[88; 89) "(" | 85 | L_PAREN@[88; 89) "(" |
86 | R_PAREN@[89; 90) ")" | 86 | R_PAREN@[89; 90) ")" |
87 | SEMI@[90; 91) ";" | 87 | SEMICOLON@[90; 91) ";" |
88 | WHITESPACE@[91; 92) "\n" | 88 | WHITESPACE@[91; 92) "\n" |
89 | R_CURLY@[92; 93) "}" | 89 | R_CURLY@[92; 93) "}" |
90 | WHITESPACE@[93; 94) "\n" | 90 | WHITESPACE@[93; 94) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.rast index ad1d47b0e..5e8f625dc 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.rast | |||
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 146) | |||
24 | TUPLE_EXPR@[24; 26) | 24 | TUPLE_EXPR@[24; 26) |
25 | L_PAREN@[24; 25) "(" | 25 | L_PAREN@[24; 25) "(" |
26 | R_PAREN@[25; 26) ")" | 26 | R_PAREN@[25; 26) ")" |
27 | SEMI@[26; 27) ";" | 27 | SEMICOLON@[26; 27) ";" |
28 | WHITESPACE@[27; 32) "\n " | 28 | WHITESPACE@[27; 32) "\n " |
29 | LET_STMT@[32; 47) | 29 | LET_STMT@[32; 47) |
30 | LET_KW@[32; 35) "let" | 30 | LET_KW@[32; 35) "let" |
@@ -40,7 +40,7 @@ SOURCE_FILE@[0; 146) | |||
40 | TUPLE_EXPR@[44; 46) | 40 | TUPLE_EXPR@[44; 46) |
41 | L_PAREN@[44; 45) "(" | 41 | L_PAREN@[44; 45) "(" |
42 | R_PAREN@[45; 46) ")" | 42 | R_PAREN@[45; 46) ")" |
43 | SEMI@[46; 47) ";" | 43 | SEMICOLON@[46; 47) ";" |
44 | WHITESPACE@[47; 52) "\n " | 44 | WHITESPACE@[47; 52) "\n " |
45 | LET_STMT@[52; 67) | 45 | LET_STMT@[52; 67) |
46 | LET_KW@[52; 55) "let" | 46 | LET_KW@[52; 55) "let" |
@@ -56,7 +56,7 @@ SOURCE_FILE@[0; 146) | |||
56 | TUPLE_EXPR@[64; 66) | 56 | TUPLE_EXPR@[64; 66) |
57 | L_PAREN@[64; 65) "(" | 57 | L_PAREN@[64; 65) "(" |
58 | R_PAREN@[65; 66) ")" | 58 | R_PAREN@[65; 66) ")" |
59 | SEMI@[66; 67) ";" | 59 | SEMICOLON@[66; 67) ";" |
60 | WHITESPACE@[67; 72) "\n " | 60 | WHITESPACE@[67; 72) "\n " |
61 | LET_STMT@[72; 91) | 61 | LET_STMT@[72; 91) |
62 | LET_KW@[72; 75) "let" | 62 | LET_KW@[72; 75) "let" |
@@ -74,7 +74,7 @@ SOURCE_FILE@[0; 146) | |||
74 | TUPLE_EXPR@[88; 90) | 74 | TUPLE_EXPR@[88; 90) |
75 | L_PAREN@[88; 89) "(" | 75 | L_PAREN@[88; 89) "(" |
76 | R_PAREN@[89; 90) ")" | 76 | R_PAREN@[89; 90) ")" |
77 | SEMI@[90; 91) ";" | 77 | SEMICOLON@[90; 91) ";" |
78 | WHITESPACE@[91; 96) "\n " | 78 | WHITESPACE@[91; 96) "\n " |
79 | LET_STMT@[96; 111) | 79 | LET_STMT@[96; 111) |
80 | LET_KW@[96; 99) "let" | 80 | LET_KW@[96; 99) "let" |
@@ -93,7 +93,7 @@ SOURCE_FILE@[0; 146) | |||
93 | TUPLE_EXPR@[108; 110) | 93 | TUPLE_EXPR@[108; 110) |
94 | L_PAREN@[108; 109) "(" | 94 | L_PAREN@[108; 109) "(" |
95 | R_PAREN@[109; 110) ")" | 95 | R_PAREN@[109; 110) ")" |
96 | SEMI@[110; 111) ";" | 96 | SEMICOLON@[110; 111) ";" |
97 | WHITESPACE@[111; 116) "\n " | 97 | WHITESPACE@[111; 116) "\n " |
98 | LET_STMT@[116; 143) | 98 | LET_STMT@[116; 143) |
99 | LET_KW@[116; 119) "let" | 99 | LET_KW@[116; 119) "let" |
@@ -122,7 +122,7 @@ SOURCE_FILE@[0; 146) | |||
122 | TUPLE_EXPR@[140; 142) | 122 | TUPLE_EXPR@[140; 142) |
123 | L_PAREN@[140; 141) "(" | 123 | L_PAREN@[140; 141) "(" |
124 | R_PAREN@[141; 142) ")" | 124 | R_PAREN@[141; 142) ")" |
125 | SEMI@[142; 143) ";" | 125 | SEMICOLON@[142; 143) ";" |
126 | WHITESPACE@[143; 144) "\n" | 126 | WHITESPACE@[143; 144) "\n" |
127 | R_CURLY@[144; 145) "}" | 127 | R_CURLY@[144; 145) "}" |
128 | WHITESPACE@[145; 146) "\n" | 128 | WHITESPACE@[145; 146) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0113_nocontentexpr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0113_nocontentexpr.rast index 5db1ff2af..f2f649410 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0113_nocontentexpr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0113_nocontentexpr.rast | |||
@@ -11,9 +11,9 @@ SOURCE_FILE@[0; 50) | |||
11 | BLOCK@[8; 49) | 11 | BLOCK@[8; 49) |
12 | L_CURLY@[8; 9) "{" | 12 | L_CURLY@[8; 9) "{" |
13 | WHITESPACE@[9; 14) "\n " | 13 | WHITESPACE@[9; 14) "\n " |
14 | SEMI@[14; 15) ";" | 14 | SEMICOLON@[14; 15) ";" |
15 | SEMI@[15; 16) ";" | 15 | SEMICOLON@[15; 16) ";" |
16 | SEMI@[16; 17) ";" | 16 | SEMICOLON@[16; 17) ";" |
17 | EXPR_STMT@[17; 29) | 17 | EXPR_STMT@[17; 29) |
18 | CALL_EXPR@[17; 28) | 18 | CALL_EXPR@[17; 28) |
19 | PATH_EXPR@[17; 26) | 19 | PATH_EXPR@[17; 26) |
@@ -24,22 +24,22 @@ SOURCE_FILE@[0; 50) | |||
24 | ARG_LIST@[26; 28) | 24 | ARG_LIST@[26; 28) |
25 | L_PAREN@[26; 27) "(" | 25 | L_PAREN@[26; 27) "(" |
26 | R_PAREN@[27; 28) ")" | 26 | R_PAREN@[27; 28) ")" |
27 | SEMI@[28; 29) ";" | 27 | SEMICOLON@[28; 29) ";" |
28 | SEMI@[29; 30) ";" | 28 | SEMICOLON@[29; 30) ";" |
29 | SEMI@[30; 31) ";" | 29 | SEMICOLON@[30; 31) ";" |
30 | SEMI@[31; 32) ";" | 30 | SEMICOLON@[31; 32) ";" |
31 | EXPR_STMT@[32; 38) | 31 | EXPR_STMT@[32; 38) |
32 | BLOCK_EXPR@[32; 37) | 32 | BLOCK_EXPR@[32; 37) |
33 | BLOCK@[32; 37) | 33 | BLOCK@[32; 37) |
34 | L_CURLY@[32; 33) "{" | 34 | L_CURLY@[32; 33) "{" |
35 | SEMI@[33; 34) ";" | 35 | SEMICOLON@[33; 34) ";" |
36 | SEMI@[34; 35) ";" | 36 | SEMICOLON@[34; 35) ";" |
37 | SEMI@[35; 36) ";" | 37 | SEMICOLON@[35; 36) ";" |
38 | R_CURLY@[36; 37) "}" | 38 | R_CURLY@[36; 37) "}" |
39 | SEMI@[37; 38) ";" | 39 | SEMICOLON@[37; 38) ";" |
40 | SEMI@[38; 39) ";" | 40 | SEMICOLON@[38; 39) ";" |
41 | SEMI@[39; 40) ";" | 41 | SEMICOLON@[39; 40) ";" |
42 | SEMI@[40; 41) ";" | 42 | SEMICOLON@[40; 41) ";" |
43 | CALL_EXPR@[41; 47) | 43 | CALL_EXPR@[41; 47) |
44 | PATH_EXPR@[41; 43) | 44 | PATH_EXPR@[41; 43) |
45 | PATH@[41; 43) | 45 | PATH@[41; 43) |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast b/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast index f5de01405..457c82e74 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast | |||
@@ -38,7 +38,7 @@ SOURCE_FILE@[0; 53) | |||
38 | PATH_SEGMENT@[27; 32) | 38 | PATH_SEGMENT@[27; 32) |
39 | NAME_REF@[27; 32) | 39 | NAME_REF@[27; 32) |
40 | IDENT@[27; 32) "Clone" | 40 | IDENT@[27; 32) "Clone" |
41 | SEMI@[32; 33) ";" | 41 | SEMICOLON@[32; 33) ";" |
42 | WHITESPACE@[33; 34) "\n" | 42 | WHITESPACE@[33; 34) "\n" |
43 | STRUCT_DEF@[34; 52) | 43 | STRUCT_DEF@[34; 52) |
44 | STRUCT_KW@[34; 40) "struct" | 44 | STRUCT_KW@[34; 40) "struct" |
@@ -60,5 +60,5 @@ SOURCE_FILE@[0; 53) | |||
60 | NAME_REF@[49; 50) | 60 | NAME_REF@[49; 50) |
61 | IDENT@[49; 50) "T" | 61 | IDENT@[49; 50) "T" |
62 | R_PAREN@[50; 51) ")" | 62 | R_PAREN@[50; 51) ")" |
63 | SEMI@[51; 52) ";" | 63 | SEMICOLON@[51; 52) ";" |
64 | WHITESPACE@[52; 53) "\n" | 64 | WHITESPACE@[52; 53) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast b/crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast index 8fe15d8e2..0b1552a9d 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast | |||
@@ -37,5 +37,5 @@ SOURCE_FILE@[0; 60) | |||
37 | COMMA@[55; 56) "," | 37 | COMMA@[55; 56) "," |
38 | WHITESPACE@[56; 57) "\n" | 38 | WHITESPACE@[56; 57) "\n" |
39 | R_PAREN@[57; 58) ")" | 39 | R_PAREN@[57; 58) ")" |
40 | SEMI@[58; 59) ";" | 40 | SEMICOLON@[58; 59) ";" |
41 | WHITESPACE@[59; 60) "\n" | 41 | WHITESPACE@[59; 60) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0117_macro_call_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0117_macro_call_type.rast index 892dc813a..4f9e80e2e 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0117_macro_call_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0117_macro_call_type.rast | |||
@@ -12,11 +12,11 @@ SOURCE_FILE@[0; 41) | |||
12 | PATH_SEGMENT@[9; 12) | 12 | PATH_SEGMENT@[9; 12) |
13 | NAME_REF@[9; 12) | 13 | NAME_REF@[9; 12) |
14 | IDENT@[9; 12) "foo" | 14 | IDENT@[9; 12) "foo" |
15 | EXCL@[12; 13) "!" | 15 | BANG@[12; 13) "!" |
16 | TOKEN_TREE@[13; 15) | 16 | TOKEN_TREE@[13; 15) |
17 | L_PAREN@[13; 14) "(" | 17 | L_PAREN@[13; 14) "(" |
18 | R_PAREN@[14; 15) ")" | 18 | R_PAREN@[14; 15) ")" |
19 | SEMI@[15; 16) ";" | 19 | SEMICOLON@[15; 16) ";" |
20 | WHITESPACE@[16; 17) "\n" | 20 | WHITESPACE@[16; 17) "\n" |
21 | TYPE_ALIAS_DEF@[17; 40) | 21 | TYPE_ALIAS_DEF@[17; 40) |
22 | TYPE_KW@[17; 21) "type" | 22 | TYPE_KW@[17; 21) "type" |
@@ -31,13 +31,13 @@ SOURCE_FILE@[0; 41) | |||
31 | PATH@[26; 31) | 31 | PATH@[26; 31) |
32 | PATH_SEGMENT@[26; 31) | 32 | PATH_SEGMENT@[26; 31) |
33 | CRATE_KW@[26; 31) "crate" | 33 | CRATE_KW@[26; 31) "crate" |
34 | COLONCOLON@[31; 33) "::" | 34 | COLON2@[31; 33) "::" |
35 | PATH_SEGMENT@[33; 36) | 35 | PATH_SEGMENT@[33; 36) |
36 | NAME_REF@[33; 36) | 36 | NAME_REF@[33; 36) |
37 | IDENT@[33; 36) "foo" | 37 | IDENT@[33; 36) "foo" |
38 | EXCL@[36; 37) "!" | 38 | BANG@[36; 37) "!" |
39 | TOKEN_TREE@[37; 39) | 39 | TOKEN_TREE@[37; 39) |
40 | L_PAREN@[37; 38) "(" | 40 | L_PAREN@[37; 38) "(" |
41 | R_PAREN@[38; 39) ")" | 41 | R_PAREN@[38; 39) ")" |
42 | SEMI@[39; 40) ";" | 42 | SEMICOLON@[39; 40) ";" |
43 | WHITESPACE@[40; 41) "\n" | 43 | WHITESPACE@[40; 41) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast b/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast index 5053ebde7..f9a4bc81b 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast | |||
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 94) | |||
24 | WHITESPACE@[48; 54) "\n " | 24 | WHITESPACE@[48; 54) "\n " |
25 | ATTR@[54; 91) | 25 | ATTR@[54; 91) |
26 | POUND@[54; 55) "#" | 26 | POUND@[54; 55) "#" |
27 | EXCL@[55; 56) "!" | 27 | BANG@[55; 56) "!" |
28 | L_BRACK@[56; 57) "[" | 28 | L_BRACK@[56; 57) "[" |
29 | PATH@[57; 60) | 29 | PATH@[57; 60) |
30 | PATH_SEGMENT@[57; 60) | 30 | PATH_SEGMENT@[57; 60) |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast b/crates/ra_syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast index 640e0640f..7eec92e1b 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast | |||
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 139) | |||
24 | WHITESPACE@[25; 34) "\n " | 24 | WHITESPACE@[25; 34) "\n " |
25 | ATTR@[34; 60) | 25 | ATTR@[34; 60) |
26 | POUND@[34; 35) "#" | 26 | POUND@[34; 35) "#" |
27 | EXCL@[35; 36) "!" | 27 | BANG@[35; 36) "!" |
28 | L_BRACK@[36; 37) "[" | 28 | L_BRACK@[36; 37) "[" |
29 | PATH@[37; 40) | 29 | PATH@[37; 40) |
30 | PATH_SEGMENT@[37; 40) | 30 | PATH_SEGMENT@[37; 40) |
@@ -38,7 +38,7 @@ SOURCE_FILE@[0; 139) | |||
38 | WHITESPACE@[60; 69) "\n " | 38 | WHITESPACE@[60; 69) "\n " |
39 | ATTR@[69; 86) | 39 | ATTR@[69; 86) |
40 | POUND@[69; 70) "#" | 40 | POUND@[69; 70) "#" |
41 | EXCL@[70; 71) "!" | 41 | BANG@[70; 71) "!" |
42 | L_BRACK@[71; 72) "[" | 42 | L_BRACK@[71; 72) "[" |
43 | PATH@[72; 75) | 43 | PATH@[72; 75) |
44 | PATH_SEGMENT@[72; 75) | 44 | PATH_SEGMENT@[72; 75) |
@@ -52,7 +52,7 @@ SOURCE_FILE@[0; 139) | |||
52 | WHITESPACE@[86; 95) "\n " | 52 | WHITESPACE@[86; 95) "\n " |
53 | ATTR@[95; 113) | 53 | ATTR@[95; 113) |
54 | POUND@[95; 96) "#" | 54 | POUND@[95; 96) "#" |
55 | EXCL@[96; 97) "!" | 55 | BANG@[96; 97) "!" |
56 | L_BRACK@[97; 98) "[" | 56 | L_BRACK@[97; 98) "[" |
57 | PATH@[98; 101) | 57 | PATH@[98; 101) |
58 | PATH_SEGMENT@[98; 101) | 58 | PATH_SEGMENT@[98; 101) |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.rast b/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.rast index 6c3b17868..af8067b12 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.rast | |||
@@ -33,7 +33,7 @@ SOURCE_FILE@[0; 57) | |||
33 | COMMA@[40; 41) "," | 33 | COMMA@[40; 41) "," |
34 | WHITESPACE@[41; 42) " " | 34 | WHITESPACE@[41; 42) " " |
35 | PARAM@[42; 45) | 35 | PARAM@[42; 45) |
36 | DOTDOTDOT@[42; 45) "..." | 36 | DOT3@[42; 45) "..." |
37 | R_PAREN@[45; 46) ")" | 37 | R_PAREN@[45; 46) ")" |
38 | WHITESPACE@[46; 47) " " | 38 | WHITESPACE@[46; 47) " " |
39 | RET_TYPE@[47; 53) | 39 | RET_TYPE@[47; 53) |
@@ -44,7 +44,7 @@ SOURCE_FILE@[0; 57) | |||
44 | PATH_SEGMENT@[50; 53) | 44 | PATH_SEGMENT@[50; 53) |
45 | NAME_REF@[50; 53) | 45 | NAME_REF@[50; 53) |
46 | IDENT@[50; 53) "i32" | 46 | IDENT@[50; 53) "i32" |
47 | SEMI@[53; 54) ";" | 47 | SEMICOLON@[53; 54) ";" |
48 | WHITESPACE@[54; 55) " " | 48 | WHITESPACE@[54; 55) " " |
49 | R_CURLY@[55; 56) "}" | 49 | R_CURLY@[55; 56) "}" |
50 | WHITESPACE@[56; 57) "\n" | 50 | WHITESPACE@[56; 57) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast b/crates/ra_syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast index 6a9f3bf72..f1f4de976 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast | |||
@@ -19,14 +19,14 @@ SOURCE_FILE@[0; 27) | |||
19 | PATH@[11; 16) | 19 | PATH@[11; 16) |
20 | PATH_SEGMENT@[11; 16) | 20 | PATH_SEGMENT@[11; 16) |
21 | CRATE_KW@[11; 16) "crate" | 21 | CRATE_KW@[11; 16) "crate" |
22 | COLONCOLON@[16; 18) "::" | 22 | COLON2@[16; 18) "::" |
23 | PATH_SEGMENT@[18; 21) | 23 | PATH_SEGMENT@[18; 21) |
24 | NAME_REF@[18; 21) | 24 | NAME_REF@[18; 21) |
25 | IDENT@[18; 21) "foo" | 25 | IDENT@[18; 21) "foo" |
26 | ARG_LIST@[21; 23) | 26 | ARG_LIST@[21; 23) |
27 | L_PAREN@[21; 22) "(" | 27 | L_PAREN@[21; 22) "(" |
28 | R_PAREN@[22; 23) ")" | 28 | R_PAREN@[22; 23) ")" |
29 | SEMI@[23; 24) ";" | 29 | SEMICOLON@[23; 24) ";" |
30 | WHITESPACE@[24; 25) " " | 30 | WHITESPACE@[24; 25) " " |
31 | R_CURLY@[25; 26) "}" | 31 | R_CURLY@[25; 26) "}" |
32 | WHITESPACE@[26; 27) "\n" | 32 | WHITESPACE@[26; 27) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast b/crates/ra_syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast index 5c311d18a..3b462871a 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast | |||
@@ -31,7 +31,7 @@ SOURCE_FILE@[0; 82) | |||
31 | ARG_LIST@[23; 25) | 31 | ARG_LIST@[23; 25) |
32 | L_PAREN@[23; 24) "(" | 32 | L_PAREN@[23; 24) "(" |
33 | R_PAREN@[24; 25) ")" | 33 | R_PAREN@[24; 25) ")" |
34 | SEMI@[25; 26) ";" | 34 | SEMICOLON@[25; 26) ";" |
35 | WHITESPACE@[26; 31) "\n " | 35 | WHITESPACE@[26; 31) "\n " |
36 | EXPR_STMT@[31; 42) | 36 | EXPR_STMT@[31; 42) |
37 | ATTR@[31; 35) | 37 | ATTR@[31; 35) |
@@ -48,7 +48,7 @@ SOURCE_FILE@[0; 82) | |||
48 | PATH_SEGMENT@[36; 39) | 48 | PATH_SEGMENT@[36; 39) |
49 | NAME_REF@[36; 39) | 49 | NAME_REF@[36; 39) |
50 | IDENT@[36; 39) "bar" | 50 | IDENT@[36; 39) "bar" |
51 | EXCL@[39; 40) "!" | 51 | BANG@[39; 40) "!" |
52 | TOKEN_TREE@[40; 42) | 52 | TOKEN_TREE@[40; 42) |
53 | L_CURLY@[40; 41) "{" | 53 | L_CURLY@[40; 41) "{" |
54 | R_CURLY@[41; 42) "}" | 54 | R_CURLY@[41; 42) "}" |
@@ -93,7 +93,7 @@ SOURCE_FILE@[0; 82) | |||
93 | TUPLE_EXPR@[76; 78) | 93 | TUPLE_EXPR@[76; 78) |
94 | L_PAREN@[76; 77) "(" | 94 | L_PAREN@[76; 77) "(" |
95 | R_PAREN@[77; 78) ")" | 95 | R_PAREN@[77; 78) ")" |
96 | SEMI@[78; 79) ";" | 96 | SEMICOLON@[78; 79) ";" |
97 | WHITESPACE@[79; 80) "\n" | 97 | WHITESPACE@[79; 80) "\n" |
98 | R_CURLY@[80; 81) "}" | 98 | R_CURLY@[80; 81) "}" |
99 | WHITESPACE@[81; 82) "\n" | 99 | WHITESPACE@[81; 82) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast index 21f49690a..9bc6be62d 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast | |||
@@ -32,7 +32,7 @@ SOURCE_FILE@[0; 47) | |||
32 | PATH_SEGMENT@[22; 25) | 32 | PATH_SEGMENT@[22; 25) |
33 | NAME_REF@[22; 25) | 33 | NAME_REF@[22; 25) |
34 | IDENT@[22; 25) "bar" | 34 | IDENT@[22; 25) "bar" |
35 | EXCL@[25; 26) "!" | 35 | BANG@[25; 26) "!" |
36 | TOKEN_TREE@[26; 28) | 36 | TOKEN_TREE@[26; 28) |
37 | L_PAREN@[26; 27) "(" | 37 | L_PAREN@[26; 27) "(" |
38 | R_PAREN@[27; 28) ")" | 38 | R_PAREN@[27; 28) ")" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.rast index 36d8f4a5f..31481d2f9 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.rast | |||
@@ -21,7 +21,7 @@ SOURCE_FILE@[0; 33) | |||
21 | PATH_SEGMENT@[20; 21) | 21 | PATH_SEGMENT@[20; 21) |
22 | NAME_REF@[20; 21) | 22 | NAME_REF@[20; 21) |
23 | IDENT@[20; 21) "m" | 23 | IDENT@[20; 21) "m" |
24 | EXCL@[21; 22) "!" | 24 | BANG@[21; 22) "!" |
25 | TOKEN_TREE@[22; 25) | 25 | TOKEN_TREE@[22; 25) |
26 | L_PAREN@[22; 23) "(" | 26 | L_PAREN@[22; 23) "(" |
27 | IDENT@[23; 24) "x" | 27 | IDENT@[23; 24) "x" |
@@ -31,7 +31,7 @@ SOURCE_FILE@[0; 33) | |||
31 | WHITESPACE@[27; 28) " " | 31 | WHITESPACE@[27; 28) " " |
32 | LITERAL@[28; 29) | 32 | LITERAL@[28; 29) |
33 | INT_NUMBER@[28; 29) "0" | 33 | INT_NUMBER@[28; 29) "0" |
34 | SEMI@[29; 30) ";" | 34 | SEMICOLON@[29; 30) ";" |
35 | WHITESPACE@[30; 31) "\n" | 35 | WHITESPACE@[30; 31) "\n" |
36 | R_CURLY@[31; 32) "}" | 36 | R_CURLY@[31; 32) "}" |
37 | WHITESPACE@[32; 33) "\n" | 37 | WHITESPACE@[32; 33) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast b/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast index 17739dfbd..1f2690c00 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast | |||
@@ -18,7 +18,7 @@ SOURCE_FILE@[0; 135) | |||
18 | BIND_PAT@[19; 20) | 18 | BIND_PAT@[19; 20) |
19 | NAME@[19; 20) | 19 | NAME@[19; 20) |
20 | IDENT@[19; 20) "a" | 20 | IDENT@[19; 20) "a" |
21 | SEMI@[20; 21) ";" | 21 | SEMICOLON@[20; 21) ";" |
22 | WHITESPACE@[21; 26) "\n " | 22 | WHITESPACE@[21; 26) "\n " |
23 | LET_STMT@[26; 37) | 23 | LET_STMT@[26; 37) |
24 | LET_KW@[26; 29) "let" | 24 | LET_KW@[26; 29) "let" |
@@ -33,7 +33,7 @@ SOURCE_FILE@[0; 135) | |||
33 | PATH_SEGMENT@[33; 36) | 33 | PATH_SEGMENT@[33; 36) |
34 | NAME_REF@[33; 36) | 34 | NAME_REF@[33; 36) |
35 | IDENT@[33; 36) "i32" | 35 | IDENT@[33; 36) "i32" |
36 | SEMI@[36; 37) ";" | 36 | SEMICOLON@[36; 37) ";" |
37 | WHITESPACE@[37; 42) "\n " | 37 | WHITESPACE@[37; 42) "\n " |
38 | LET_STMT@[42; 53) | 38 | LET_STMT@[42; 53) |
39 | LET_KW@[42; 45) "let" | 39 | LET_KW@[42; 45) "let" |
@@ -46,7 +46,7 @@ SOURCE_FILE@[0; 135) | |||
46 | WHITESPACE@[49; 50) " " | 46 | WHITESPACE@[49; 50) " " |
47 | LITERAL@[50; 52) | 47 | LITERAL@[50; 52) |
48 | INT_NUMBER@[50; 52) "92" | 48 | INT_NUMBER@[50; 52) "92" |
49 | SEMI@[52; 53) ";" | 49 | SEMICOLON@[52; 53) ";" |
50 | WHITESPACE@[53; 58) "\n " | 50 | WHITESPACE@[53; 58) "\n " |
51 | LET_STMT@[58; 74) | 51 | LET_STMT@[58; 74) |
52 | LET_KW@[58; 61) "let" | 52 | LET_KW@[58; 61) "let" |
@@ -66,7 +66,7 @@ SOURCE_FILE@[0; 135) | |||
66 | WHITESPACE@[70; 71) " " | 66 | WHITESPACE@[70; 71) " " |
67 | LITERAL@[71; 73) | 67 | LITERAL@[71; 73) |
68 | INT_NUMBER@[71; 73) "92" | 68 | INT_NUMBER@[71; 73) "92" |
69 | SEMI@[73; 74) ";" | 69 | SEMICOLON@[73; 74) ";" |
70 | WHITESPACE@[74; 79) "\n " | 70 | WHITESPACE@[74; 79) "\n " |
71 | LET_STMT@[79; 88) | 71 | LET_STMT@[79; 88) |
72 | LET_KW@[79; 82) "let" | 72 | LET_KW@[79; 82) "let" |
@@ -77,8 +77,8 @@ SOURCE_FILE@[0; 135) | |||
77 | COLON@[84; 85) ":" | 77 | COLON@[84; 85) ":" |
78 | WHITESPACE@[85; 86) " " | 78 | WHITESPACE@[85; 86) " " |
79 | NEVER_TYPE@[86; 87) | 79 | NEVER_TYPE@[86; 87) |
80 | EXCL@[86; 87) "!" | 80 | BANG@[86; 87) "!" |
81 | SEMI@[87; 88) ";" | 81 | SEMICOLON@[87; 88) ";" |
82 | WHITESPACE@[88; 93) "\n " | 82 | WHITESPACE@[88; 93) "\n " |
83 | LET_STMT@[93; 107) | 83 | LET_STMT@[93; 107) |
84 | LET_KW@[93; 96) "let" | 84 | LET_KW@[93; 96) "let" |
@@ -88,7 +88,7 @@ SOURCE_FILE@[0; 135) | |||
88 | COLON@[98; 99) ":" | 88 | COLON@[98; 99) ":" |
89 | WHITESPACE@[99; 100) " " | 89 | WHITESPACE@[99; 100) " " |
90 | NEVER_TYPE@[100; 101) | 90 | NEVER_TYPE@[100; 101) |
91 | EXCL@[100; 101) "!" | 91 | BANG@[100; 101) "!" |
92 | WHITESPACE@[101; 102) " " | 92 | WHITESPACE@[101; 102) " " |
93 | EQ@[102; 103) "=" | 93 | EQ@[102; 103) "=" |
94 | WHITESPACE@[103; 104) " " | 94 | WHITESPACE@[103; 104) " " |
@@ -96,7 +96,7 @@ SOURCE_FILE@[0; 135) | |||
96 | BLOCK@[104; 106) | 96 | BLOCK@[104; 106) |
97 | L_CURLY@[104; 105) "{" | 97 | L_CURLY@[104; 105) "{" |
98 | R_CURLY@[105; 106) "}" | 98 | R_CURLY@[105; 106) "}" |
99 | SEMI@[106; 107) ";" | 99 | SEMICOLON@[106; 107) ";" |
100 | WHITESPACE@[107; 112) "\n " | 100 | WHITESPACE@[107; 112) "\n " |
101 | LET_STMT@[112; 132) | 101 | LET_STMT@[112; 132) |
102 | LET_KW@[112; 115) "let" | 102 | LET_KW@[112; 115) "let" |
@@ -123,7 +123,7 @@ SOURCE_FILE@[0; 135) | |||
123 | BLOCK@[129; 131) | 123 | BLOCK@[129; 131) |
124 | L_CURLY@[129; 130) "{" | 124 | L_CURLY@[129; 130) "{" |
125 | R_CURLY@[130; 131) "}" | 125 | R_CURLY@[130; 131) "}" |
126 | SEMI@[131; 132) ";" | 126 | SEMICOLON@[131; 132) ";" |
127 | WHITESPACE@[132; 133) "\n" | 127 | WHITESPACE@[132; 133) "\n" |
128 | R_CURLY@[133; 134) "}" | 128 | R_CURLY@[133; 134) "}" |
129 | WHITESPACE@[134; 135) "\n" | 129 | WHITESPACE@[134; 135) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0130_try_block_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0130_try_block_expr.rast index d6df1aba2..b96991035 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0130_try_block_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0130_try_block_expr.rast | |||
@@ -27,7 +27,7 @@ SOURCE_FILE@[0; 33) | |||
27 | BLOCK@[27; 29) | 27 | BLOCK@[27; 29) |
28 | L_CURLY@[27; 28) "{" | 28 | L_CURLY@[27; 28) "{" |
29 | R_CURLY@[28; 29) "}" | 29 | R_CURLY@[28; 29) "}" |
30 | SEMI@[29; 30) ";" | 30 | SEMICOLON@[29; 30) ";" |
31 | WHITESPACE@[30; 31) "\n" | 31 | WHITESPACE@[30; 31) "\n" |
32 | R_CURLY@[31; 32) "}" | 32 | R_CURLY@[31; 32) "}" |
33 | WHITESPACE@[32; 33) "\n" | 33 | WHITESPACE@[32; 33) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0131_existential_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0131_existential_type.rast index 6bfac985a..ed3d8fb0b 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0131_existential_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0131_existential_type.rast | |||
@@ -27,5 +27,5 @@ SOURCE_FILE@[0; 37) | |||
27 | PATH_SEGMENT@[30; 35) | 27 | PATH_SEGMENT@[30; 35) |
28 | NAME_REF@[30; 35) | 28 | NAME_REF@[30; 35) |
29 | IDENT@[30; 35) "usize" | 29 | IDENT@[30; 35) "usize" |
30 | SEMI@[35; 36) ";" | 30 | SEMICOLON@[35; 36) ";" |
31 | WHITESPACE@[36; 37) "\n" | 31 | WHITESPACE@[36; 37) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0132_box_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0132_box_expr.rast index 12294210e..c392a7d84 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0132_box_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0132_box_expr.rast | |||
@@ -26,7 +26,7 @@ SOURCE_FILE@[0; 106) | |||
26 | WHITESPACE@[26; 27) " " | 26 | WHITESPACE@[26; 27) " " |
27 | LITERAL@[27; 31) | 27 | LITERAL@[27; 31) |
28 | INT_NUMBER@[27; 31) "1i32" | 28 | INT_NUMBER@[27; 31) "1i32" |
29 | SEMI@[31; 32) ";" | 29 | SEMICOLON@[31; 32) ";" |
30 | WHITESPACE@[32; 37) "\n " | 30 | WHITESPACE@[32; 37) "\n " |
31 | LET_STMT@[37; 66) | 31 | LET_STMT@[37; 66) |
32 | LET_KW@[37; 40) "let" | 32 | LET_KW@[37; 40) "let" |
@@ -52,7 +52,7 @@ SOURCE_FILE@[0; 106) | |||
52 | LITERAL@[60; 64) | 52 | LITERAL@[60; 64) |
53 | INT_NUMBER@[60; 64) "2i32" | 53 | INT_NUMBER@[60; 64) "2i32" |
54 | R_PAREN@[64; 65) ")" | 54 | R_PAREN@[64; 65) ")" |
55 | SEMI@[65; 66) ";" | 55 | SEMICOLON@[65; 66) ";" |
56 | WHITESPACE@[66; 71) "\n " | 56 | WHITESPACE@[66; 71) "\n " |
57 | LET_STMT@[71; 103) | 57 | LET_STMT@[71; 103) |
58 | LET_KW@[71; 74) "let" | 58 | LET_KW@[71; 74) "let" |
@@ -84,7 +84,7 @@ SOURCE_FILE@[0; 106) | |||
84 | LITERAL@[97; 101) | 84 | LITERAL@[97; 101) |
85 | INT_NUMBER@[97; 101) "2i32" | 85 | INT_NUMBER@[97; 101) "2i32" |
86 | R_PAREN@[101; 102) ")" | 86 | R_PAREN@[101; 102) ")" |
87 | SEMI@[102; 103) ";" | 87 | SEMICOLON@[102; 103) ";" |
88 | WHITESPACE@[103; 104) "\n" | 88 | WHITESPACE@[103; 104) "\n" |
89 | R_CURLY@[104; 105) "}" | 89 | R_CURLY@[104; 105) "}" |
90 | WHITESPACE@[105; 106) "\n" | 90 | WHITESPACE@[105; 106) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast index e1734224b..cff03fcf3 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast | |||
@@ -34,7 +34,7 @@ SOURCE_FILE@[0; 69) | |||
34 | PATH_SEGMENT@[38; 41) | 34 | PATH_SEGMENT@[38; 41) |
35 | NAME_REF@[38; 41) | 35 | NAME_REF@[38; 41) |
36 | IDENT@[38; 41) "Bar" | 36 | IDENT@[38; 41) "Bar" |
37 | SEMI@[41; 42) ";" | 37 | SEMICOLON@[41; 42) ";" |
38 | WHITESPACE@[42; 47) "\n " | 38 | WHITESPACE@[42; 47) "\n " |
39 | FN_DEF@[47; 66) | 39 | FN_DEF@[47; 66) |
40 | DEFAULT_KW@[47; 54) "default" | 40 | DEFAULT_KW@[47; 54) "default" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast b/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast index 14655d332..f66f32370 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast | |||
@@ -32,7 +32,7 @@ SOURCE_FILE@[0; 111) | |||
32 | COMMA@[68; 69) "," | 32 | COMMA@[68; 69) "," |
33 | WHITESPACE@[69; 74) "\n " | 33 | WHITESPACE@[69; 74) "\n " |
34 | R_CURLY@[74; 75) "}" | 34 | R_CURLY@[74; 75) "}" |
35 | SEMI@[75; 76) ";" | 35 | SEMICOLON@[75; 76) ";" |
36 | WHITESPACE@[76; 81) "\n " | 36 | WHITESPACE@[76; 81) "\n " |
37 | FN_DEF@[81; 90) | 37 | FN_DEF@[81; 90) |
38 | FN_KW@[81; 83) "fn" | 38 | FN_KW@[81; 83) "fn" |
@@ -47,7 +47,7 @@ SOURCE_FILE@[0; 111) | |||
47 | BLOCK@[88; 90) | 47 | BLOCK@[88; 90) |
48 | L_CURLY@[88; 89) "{" | 48 | L_CURLY@[88; 89) "{" |
49 | R_CURLY@[89; 90) "}" | 49 | R_CURLY@[89; 90) "}" |
50 | SEMI@[90; 91) ";" | 50 | SEMICOLON@[90; 91) ";" |
51 | WHITESPACE@[91; 96) "\n " | 51 | WHITESPACE@[91; 96) "\n " |
52 | STRUCT_DEF@[96; 107) | 52 | STRUCT_DEF@[96; 107) |
53 | STRUCT_KW@[96; 102) "struct" | 53 | STRUCT_KW@[96; 102) "struct" |
@@ -58,7 +58,7 @@ SOURCE_FILE@[0; 111) | |||
58 | RECORD_FIELD_DEF_LIST@[105; 107) | 58 | RECORD_FIELD_DEF_LIST@[105; 107) |
59 | L_CURLY@[105; 106) "{" | 59 | L_CURLY@[105; 106) "{" |
60 | R_CURLY@[106; 107) "}" | 60 | R_CURLY@[106; 107) "}" |
61 | SEMI@[107; 108) ";" | 61 | SEMICOLON@[107; 108) ";" |
62 | WHITESPACE@[108; 109) "\n" | 62 | WHITESPACE@[108; 109) "\n" |
63 | R_CURLY@[109; 110) "}" | 63 | R_CURLY@[109; 110) "}" |
64 | WHITESPACE@[110; 111) "\n" | 64 | WHITESPACE@[110; 111) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0137_await_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0137_await_expr.rast index a6ac0dbd8..4946e6325 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0137_await_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0137_await_expr.rast | |||
@@ -21,7 +21,7 @@ SOURCE_FILE@[0; 67) | |||
21 | IDENT@[15; 16) "x" | 21 | IDENT@[15; 16) "x" |
22 | DOT@[16; 17) "." | 22 | DOT@[16; 17) "." |
23 | AWAIT_KW@[17; 22) "await" | 23 | AWAIT_KW@[17; 22) "await" |
24 | SEMI@[22; 23) ";" | 24 | SEMICOLON@[22; 23) ";" |
25 | WHITESPACE@[23; 28) "\n " | 25 | WHITESPACE@[23; 28) "\n " |
26 | EXPR_STMT@[28; 38) | 26 | EXPR_STMT@[28; 38) |
27 | AWAIT_EXPR@[28; 37) | 27 | AWAIT_EXPR@[28; 37) |
@@ -36,7 +36,7 @@ SOURCE_FILE@[0; 67) | |||
36 | INT_NUMBER@[30; 31) "0" | 36 | INT_NUMBER@[30; 31) "0" |
37 | DOT@[31; 32) "." | 37 | DOT@[31; 32) "." |
38 | AWAIT_KW@[32; 37) "await" | 38 | AWAIT_KW@[32; 37) "await" |
39 | SEMI@[37; 38) ";" | 39 | SEMICOLON@[37; 38) ";" |
40 | WHITESPACE@[38; 43) "\n " | 40 | WHITESPACE@[38; 43) "\n " |
41 | EXPR_STMT@[43; 64) | 41 | EXPR_STMT@[43; 64) |
42 | METHOD_CALL_EXPR@[43; 63) | 42 | METHOD_CALL_EXPR@[43; 63) |
@@ -64,7 +64,7 @@ SOURCE_FILE@[0; 67) | |||
64 | ARG_LIST@[61; 63) | 64 | ARG_LIST@[61; 63) |
65 | L_PAREN@[61; 62) "(" | 65 | L_PAREN@[61; 62) "(" |
66 | R_PAREN@[62; 63) ")" | 66 | R_PAREN@[62; 63) ")" |
67 | SEMI@[63; 64) ";" | 67 | SEMICOLON@[63; 64) ";" |
68 | WHITESPACE@[64; 65) "\n" | 68 | WHITESPACE@[64; 65) "\n" |
69 | R_CURLY@[65; 66) "}" | 69 | R_CURLY@[65; 66) "}" |
70 | WHITESPACE@[66; 67) "\n" | 70 | WHITESPACE@[66; 67) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.rast index df4c04149..ca1d69f64 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.rast | |||
@@ -38,7 +38,7 @@ SOURCE_FILE@[0; 52) | |||
38 | LITERAL@[31; 32) | 38 | LITERAL@[31; 32) |
39 | INT_NUMBER@[31; 32) "5" | 39 | INT_NUMBER@[31; 32) "5" |
40 | R_CURLY@[32; 33) "}" | 40 | R_CURLY@[32; 33) "}" |
41 | SEMI@[33; 34) ";" | 41 | SEMICOLON@[33; 34) ";" |
42 | WHITESPACE@[34; 38) "\n " | 42 | WHITESPACE@[34; 38) "\n " |
43 | EXPR_STMT@[38; 49) | 43 | EXPR_STMT@[38; 49) |
44 | BIN_EXPR@[38; 48) | 44 | BIN_EXPR@[38; 48) |
@@ -60,7 +60,7 @@ SOURCE_FILE@[0; 52) | |||
60 | WHITESPACE@[45; 46) " " | 60 | WHITESPACE@[45; 46) " " |
61 | LITERAL@[46; 48) | 61 | LITERAL@[46; 48) |
62 | INT_NUMBER@[46; 48) "10" | 62 | INT_NUMBER@[46; 48) "10" |
63 | SEMI@[48; 49) ";" | 63 | SEMICOLON@[48; 49) ";" |
64 | WHITESPACE@[49; 50) "\n" | 64 | WHITESPACE@[49; 50) "\n" |
65 | R_CURLY@[50; 51) "}" | 65 | R_CURLY@[50; 51) "}" |
66 | WHITESPACE@[51; 52) "\n" | 66 | WHITESPACE@[51; 52) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.rast b/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.rast index eec1cba1e..6d01140d2 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.rast | |||
@@ -25,7 +25,7 @@ SOURCE_FILE@[0; 51) | |||
25 | LITERAL@[23; 24) | 25 | LITERAL@[23; 24) |
26 | INT_NUMBER@[23; 24) "0" | 26 | INT_NUMBER@[23; 24) "0" |
27 | WHITESPACE@[24; 25) " " | 27 | WHITESPACE@[24; 25) " " |
28 | DOTDOT@[25; 27) ".." | 28 | DOT2@[25; 27) ".." |
29 | WHITESPACE@[27; 28) " " | 29 | WHITESPACE@[27; 28) " " |
30 | BLOCK_EXPR@[28; 48) | 30 | BLOCK_EXPR@[28; 48) |
31 | BLOCK@[28; 48) | 31 | BLOCK@[28; 48) |
@@ -34,7 +34,7 @@ SOURCE_FILE@[0; 51) | |||
34 | EXPR_STMT@[37; 43) | 34 | EXPR_STMT@[37; 43) |
35 | BREAK_EXPR@[37; 42) | 35 | BREAK_EXPR@[37; 42) |
36 | BREAK_KW@[37; 42) "break" | 36 | BREAK_KW@[37; 42) "break" |
37 | SEMI@[42; 43) ";" | 37 | SEMICOLON@[42; 43) ";" |
38 | WHITESPACE@[43; 47) "\n " | 38 | WHITESPACE@[43; 47) "\n " |
39 | R_CURLY@[47; 48) "}" | 39 | R_CURLY@[47; 48) "}" |
40 | WHITESPACE@[48; 49) "\n" | 40 | WHITESPACE@[48; 49) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast index 4d2048711..f75673070 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast | |||
@@ -27,7 +27,7 @@ SOURCE_FILE@[0; 118) | |||
27 | TUPLE_EXPR@[28; 30) | 27 | TUPLE_EXPR@[28; 30) |
28 | L_PAREN@[28; 29) "(" | 28 | L_PAREN@[28; 29) "(" |
29 | R_PAREN@[29; 30) ")" | 29 | R_PAREN@[29; 30) ")" |
30 | SEMI@[30; 31) ";" | 30 | SEMICOLON@[30; 31) ";" |
31 | WHITESPACE@[31; 36) "\n " | 31 | WHITESPACE@[31; 36) "\n " |
32 | LET_STMT@[36; 87) | 32 | LET_STMT@[36; 87) |
33 | LET_KW@[36; 39) "let" | 33 | LET_KW@[36; 39) "let" |
@@ -83,7 +83,7 @@ SOURCE_FILE@[0; 118) | |||
83 | TUPLE_EXPR@[84; 86) | 83 | TUPLE_EXPR@[84; 86) |
84 | L_PAREN@[84; 85) "(" | 84 | L_PAREN@[84; 85) "(" |
85 | R_PAREN@[85; 86) ")" | 85 | R_PAREN@[85; 86) ")" |
86 | SEMI@[86; 87) ";" | 86 | SEMICOLON@[86; 87) ";" |
87 | WHITESPACE@[87; 92) "\n " | 87 | WHITESPACE@[87; 92) "\n " |
88 | LET_STMT@[92; 115) | 88 | LET_STMT@[92; 115) |
89 | LET_KW@[92; 95) "let" | 89 | LET_KW@[92; 95) "let" |
@@ -104,7 +104,7 @@ SOURCE_FILE@[0; 118) | |||
104 | TUPLE_EXPR@[112; 114) | 104 | TUPLE_EXPR@[112; 114) |
105 | L_PAREN@[112; 113) "(" | 105 | L_PAREN@[112; 113) "(" |
106 | R_PAREN@[113; 114) ")" | 106 | R_PAREN@[113; 114) ")" |
107 | SEMI@[114; 115) ";" | 107 | SEMICOLON@[114; 115) ";" |
108 | WHITESPACE@[115; 116) "\n" | 108 | WHITESPACE@[115; 116) "\n" |
109 | R_CURLY@[116; 117) "}" | 109 | R_CURLY@[116; 117) "}" |
110 | WHITESPACE@[117; 118) "\n" | 110 | WHITESPACE@[117; 118) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rast index 325b1bd08..60186a992 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rast | |||
@@ -16,14 +16,14 @@ SOURCE_FILE@[0; 555) | |||
16 | LET_KW@[16; 19) "let" | 16 | LET_KW@[16; 19) "let" |
17 | WHITESPACE@[19; 20) " " | 17 | WHITESPACE@[19; 20) " " |
18 | DOT_DOT_PAT@[20; 22) | 18 | DOT_DOT_PAT@[20; 22) |
19 | DOTDOT@[20; 22) ".." | 19 | DOT2@[20; 22) ".." |
20 | WHITESPACE@[22; 23) " " | 20 | WHITESPACE@[22; 23) " " |
21 | EQ@[23; 24) "=" | 21 | EQ@[23; 24) "=" |
22 | WHITESPACE@[24; 25) " " | 22 | WHITESPACE@[24; 25) " " |
23 | TUPLE_EXPR@[25; 27) | 23 | TUPLE_EXPR@[25; 27) |
24 | L_PAREN@[25; 26) "(" | 24 | L_PAREN@[25; 26) "(" |
25 | R_PAREN@[26; 27) ")" | 25 | R_PAREN@[26; 27) ")" |
26 | SEMI@[27; 28) ";" | 26 | SEMICOLON@[27; 28) ";" |
27 | WHITESPACE@[28; 33) "\n " | 27 | WHITESPACE@[28; 33) "\n " |
28 | COMMENT@[33; 35) "//" | 28 | COMMENT@[33; 35) "//" |
29 | WHITESPACE@[35; 40) "\n " | 29 | WHITESPACE@[35; 40) "\n " |
@@ -42,7 +42,7 @@ SOURCE_FILE@[0; 555) | |||
42 | COMMA@[67; 68) "," | 42 | COMMA@[67; 68) "," |
43 | WHITESPACE@[68; 69) " " | 43 | WHITESPACE@[68; 69) " " |
44 | DOT_DOT_PAT@[69; 71) | 44 | DOT_DOT_PAT@[69; 71) |
45 | DOTDOT@[69; 71) ".." | 45 | DOT2@[69; 71) ".." |
46 | R_PAREN@[71; 72) ")" | 46 | R_PAREN@[71; 72) ")" |
47 | WHITESPACE@[72; 73) " " | 47 | WHITESPACE@[72; 73) " " |
48 | EQ@[73; 74) "=" | 48 | EQ@[73; 74) "=" |
@@ -50,7 +50,7 @@ SOURCE_FILE@[0; 555) | |||
50 | TUPLE_EXPR@[75; 77) | 50 | TUPLE_EXPR@[75; 77) |
51 | L_PAREN@[75; 76) "(" | 51 | L_PAREN@[75; 76) "(" |
52 | R_PAREN@[76; 77) ")" | 52 | R_PAREN@[76; 77) ")" |
53 | SEMI@[77; 78) ";" | 53 | SEMICOLON@[77; 78) ";" |
54 | WHITESPACE@[78; 83) "\n " | 54 | WHITESPACE@[78; 83) "\n " |
55 | LET_STMT@[83; 101) | 55 | LET_STMT@[83; 101) |
56 | LET_KW@[83; 86) "let" | 56 | LET_KW@[83; 86) "let" |
@@ -63,7 +63,7 @@ SOURCE_FILE@[0; 555) | |||
63 | COMMA@[89; 90) "," | 63 | COMMA@[89; 90) "," |
64 | WHITESPACE@[90; 91) " " | 64 | WHITESPACE@[90; 91) " " |
65 | DOT_DOT_PAT@[91; 93) | 65 | DOT_DOT_PAT@[91; 93) |
66 | DOTDOT@[91; 93) ".." | 66 | DOT2@[91; 93) ".." |
67 | COMMA@[93; 94) "," | 67 | COMMA@[93; 94) "," |
68 | R_PAREN@[94; 95) ")" | 68 | R_PAREN@[94; 95) ")" |
69 | WHITESPACE@[95; 96) " " | 69 | WHITESPACE@[95; 96) " " |
@@ -72,7 +72,7 @@ SOURCE_FILE@[0; 555) | |||
72 | TUPLE_EXPR@[98; 100) | 72 | TUPLE_EXPR@[98; 100) |
73 | L_PAREN@[98; 99) "(" | 73 | L_PAREN@[98; 99) "(" |
74 | R_PAREN@[99; 100) ")" | 74 | R_PAREN@[99; 100) ")" |
75 | SEMI@[100; 101) ";" | 75 | SEMICOLON@[100; 101) ";" |
76 | WHITESPACE@[101; 106) "\n " | 76 | WHITESPACE@[101; 106) "\n " |
77 | LET_STMT@[106; 128) | 77 | LET_STMT@[106; 128) |
78 | LET_KW@[106; 109) "let" | 78 | LET_KW@[106; 109) "let" |
@@ -89,7 +89,7 @@ SOURCE_FILE@[0; 555) | |||
89 | COMMA@[117; 118) "," | 89 | COMMA@[117; 118) "," |
90 | WHITESPACE@[118; 119) " " | 90 | WHITESPACE@[118; 119) " " |
91 | DOT_DOT_PAT@[119; 121) | 91 | DOT_DOT_PAT@[119; 121) |
92 | DOTDOT@[119; 121) ".." | 92 | DOT2@[119; 121) ".." |
93 | R_PAREN@[121; 122) ")" | 93 | R_PAREN@[121; 122) ")" |
94 | WHITESPACE@[122; 123) " " | 94 | WHITESPACE@[122; 123) " " |
95 | EQ@[123; 124) "=" | 95 | EQ@[123; 124) "=" |
@@ -97,7 +97,7 @@ SOURCE_FILE@[0; 555) | |||
97 | TUPLE_EXPR@[125; 127) | 97 | TUPLE_EXPR@[125; 127) |
98 | L_PAREN@[125; 126) "(" | 98 | L_PAREN@[125; 126) "(" |
99 | R_PAREN@[126; 127) ")" | 99 | R_PAREN@[126; 127) ")" |
100 | SEMI@[127; 128) ";" | 100 | SEMICOLON@[127; 128) ";" |
101 | WHITESPACE@[128; 133) "\n " | 101 | WHITESPACE@[128; 133) "\n " |
102 | LET_STMT@[133; 156) | 102 | LET_STMT@[133; 156) |
103 | LET_KW@[133; 136) "let" | 103 | LET_KW@[133; 136) "let" |
@@ -114,7 +114,7 @@ SOURCE_FILE@[0; 555) | |||
114 | COMMA@[144; 145) "," | 114 | COMMA@[144; 145) "," |
115 | WHITESPACE@[145; 146) " " | 115 | WHITESPACE@[145; 146) " " |
116 | DOT_DOT_PAT@[146; 148) | 116 | DOT_DOT_PAT@[146; 148) |
117 | DOTDOT@[146; 148) ".." | 117 | DOT2@[146; 148) ".." |
118 | COMMA@[148; 149) "," | 118 | COMMA@[148; 149) "," |
119 | R_PAREN@[149; 150) ")" | 119 | R_PAREN@[149; 150) ")" |
120 | WHITESPACE@[150; 151) " " | 120 | WHITESPACE@[150; 151) " " |
@@ -123,7 +123,7 @@ SOURCE_FILE@[0; 555) | |||
123 | TUPLE_EXPR@[153; 155) | 123 | TUPLE_EXPR@[153; 155) |
124 | L_PAREN@[153; 154) "(" | 124 | L_PAREN@[153; 154) "(" |
125 | R_PAREN@[154; 155) ")" | 125 | R_PAREN@[154; 155) ")" |
126 | SEMI@[155; 156) ";" | 126 | SEMICOLON@[155; 156) ";" |
127 | WHITESPACE@[156; 161) "\n " | 127 | WHITESPACE@[156; 161) "\n " |
128 | LET_STMT@[161; 179) | 128 | LET_STMT@[161; 179) |
129 | LET_KW@[161; 164) "let" | 129 | LET_KW@[161; 164) "let" |
@@ -131,11 +131,11 @@ SOURCE_FILE@[0; 555) | |||
131 | TUPLE_PAT@[165; 173) | 131 | TUPLE_PAT@[165; 173) |
132 | L_PAREN@[165; 166) "(" | 132 | L_PAREN@[165; 166) "(" |
133 | DOT_DOT_PAT@[166; 168) | 133 | DOT_DOT_PAT@[166; 168) |
134 | DOTDOT@[166; 168) ".." | 134 | DOT2@[166; 168) ".." |
135 | COMMA@[168; 169) "," | 135 | COMMA@[168; 169) "," |
136 | WHITESPACE@[169; 170) " " | 136 | WHITESPACE@[169; 170) " " |
137 | DOT_DOT_PAT@[170; 172) | 137 | DOT_DOT_PAT@[170; 172) |
138 | DOTDOT@[170; 172) ".." | 138 | DOT2@[170; 172) ".." |
139 | R_PAREN@[172; 173) ")" | 139 | R_PAREN@[172; 173) ")" |
140 | WHITESPACE@[173; 174) " " | 140 | WHITESPACE@[173; 174) " " |
141 | EQ@[174; 175) "=" | 141 | EQ@[174; 175) "=" |
@@ -143,7 +143,7 @@ SOURCE_FILE@[0; 555) | |||
143 | TUPLE_EXPR@[176; 178) | 143 | TUPLE_EXPR@[176; 178) |
144 | L_PAREN@[176; 177) "(" | 144 | L_PAREN@[176; 177) "(" |
145 | R_PAREN@[177; 178) ")" | 145 | R_PAREN@[177; 178) ")" |
146 | SEMI@[178; 179) ";" | 146 | SEMICOLON@[178; 179) ";" |
147 | WHITESPACE@[179; 184) "\n " | 147 | WHITESPACE@[179; 184) "\n " |
148 | LET_STMT@[184; 207) | 148 | LET_STMT@[184; 207) |
149 | LET_KW@[184; 187) "let" | 149 | LET_KW@[184; 187) "let" |
@@ -155,11 +155,11 @@ SOURCE_FILE@[0; 555) | |||
155 | IDENT@[188; 193) "Tuple" | 155 | IDENT@[188; 193) "Tuple" |
156 | L_PAREN@[193; 194) "(" | 156 | L_PAREN@[193; 194) "(" |
157 | DOT_DOT_PAT@[194; 196) | 157 | DOT_DOT_PAT@[194; 196) |
158 | DOTDOT@[194; 196) ".." | 158 | DOT2@[194; 196) ".." |
159 | COMMA@[196; 197) "," | 159 | COMMA@[196; 197) "," |
160 | WHITESPACE@[197; 198) " " | 160 | WHITESPACE@[197; 198) " " |
161 | DOT_DOT_PAT@[198; 200) | 161 | DOT_DOT_PAT@[198; 200) |
162 | DOTDOT@[198; 200) ".." | 162 | DOT2@[198; 200) ".." |
163 | R_PAREN@[200; 201) ")" | 163 | R_PAREN@[200; 201) ")" |
164 | WHITESPACE@[201; 202) " " | 164 | WHITESPACE@[201; 202) " " |
165 | EQ@[202; 203) "=" | 165 | EQ@[202; 203) "=" |
@@ -167,7 +167,7 @@ SOURCE_FILE@[0; 555) | |||
167 | TUPLE_EXPR@[204; 206) | 167 | TUPLE_EXPR@[204; 206) |
168 | L_PAREN@[204; 205) "(" | 168 | L_PAREN@[204; 205) "(" |
169 | R_PAREN@[205; 206) ")" | 169 | R_PAREN@[205; 206) ")" |
170 | SEMI@[206; 207) ";" | 170 | SEMICOLON@[206; 207) ";" |
171 | WHITESPACE@[207; 212) "\n " | 171 | WHITESPACE@[207; 212) "\n " |
172 | LET_STMT@[212; 233) | 172 | LET_STMT@[212; 233) |
173 | LET_KW@[212; 215) "let" | 173 | LET_KW@[212; 215) "let" |
@@ -175,7 +175,7 @@ SOURCE_FILE@[0; 555) | |||
175 | TUPLE_PAT@[216; 227) | 175 | TUPLE_PAT@[216; 227) |
176 | L_PAREN@[216; 217) "(" | 176 | L_PAREN@[216; 217) "(" |
177 | DOT_DOT_PAT@[217; 219) | 177 | DOT_DOT_PAT@[217; 219) |
178 | DOTDOT@[217; 219) ".." | 178 | DOT2@[217; 219) ".." |
179 | COMMA@[219; 220) "," | 179 | COMMA@[219; 220) "," |
180 | WHITESPACE@[220; 221) " " | 180 | WHITESPACE@[220; 221) " " |
181 | BIND_PAT@[221; 222) | 181 | BIND_PAT@[221; 222) |
@@ -184,7 +184,7 @@ SOURCE_FILE@[0; 555) | |||
184 | COMMA@[222; 223) "," | 184 | COMMA@[222; 223) "," |
185 | WHITESPACE@[223; 224) " " | 185 | WHITESPACE@[223; 224) " " |
186 | DOT_DOT_PAT@[224; 226) | 186 | DOT_DOT_PAT@[224; 226) |
187 | DOTDOT@[224; 226) ".." | 187 | DOT2@[224; 226) ".." |
188 | R_PAREN@[226; 227) ")" | 188 | R_PAREN@[226; 227) ")" |
189 | WHITESPACE@[227; 228) " " | 189 | WHITESPACE@[227; 228) " " |
190 | EQ@[228; 229) "=" | 190 | EQ@[228; 229) "=" |
@@ -192,7 +192,7 @@ SOURCE_FILE@[0; 555) | |||
192 | TUPLE_EXPR@[230; 232) | 192 | TUPLE_EXPR@[230; 232) |
193 | L_PAREN@[230; 231) "(" | 193 | L_PAREN@[230; 231) "(" |
194 | R_PAREN@[231; 232) ")" | 194 | R_PAREN@[231; 232) ")" |
195 | SEMI@[232; 233) ";" | 195 | SEMICOLON@[232; 233) ";" |
196 | WHITESPACE@[233; 238) "\n " | 196 | WHITESPACE@[233; 238) "\n " |
197 | LET_STMT@[238; 264) | 197 | LET_STMT@[238; 264) |
198 | LET_KW@[238; 241) "let" | 198 | LET_KW@[238; 241) "let" |
@@ -204,7 +204,7 @@ SOURCE_FILE@[0; 555) | |||
204 | IDENT@[242; 247) "Tuple" | 204 | IDENT@[242; 247) "Tuple" |
205 | L_PAREN@[247; 248) "(" | 205 | L_PAREN@[247; 248) "(" |
206 | DOT_DOT_PAT@[248; 250) | 206 | DOT_DOT_PAT@[248; 250) |
207 | DOTDOT@[248; 250) ".." | 207 | DOT2@[248; 250) ".." |
208 | COMMA@[250; 251) "," | 208 | COMMA@[250; 251) "," |
209 | WHITESPACE@[251; 252) " " | 209 | WHITESPACE@[251; 252) " " |
210 | BIND_PAT@[252; 253) | 210 | BIND_PAT@[252; 253) |
@@ -213,7 +213,7 @@ SOURCE_FILE@[0; 555) | |||
213 | COMMA@[253; 254) "," | 213 | COMMA@[253; 254) "," |
214 | WHITESPACE@[254; 255) " " | 214 | WHITESPACE@[254; 255) " " |
215 | DOT_DOT_PAT@[255; 257) | 215 | DOT_DOT_PAT@[255; 257) |
216 | DOTDOT@[255; 257) ".." | 216 | DOT2@[255; 257) ".." |
217 | R_PAREN@[257; 258) ")" | 217 | R_PAREN@[257; 258) ")" |
218 | WHITESPACE@[258; 259) " " | 218 | WHITESPACE@[258; 259) " " |
219 | EQ@[259; 260) "=" | 219 | EQ@[259; 260) "=" |
@@ -221,7 +221,7 @@ SOURCE_FILE@[0; 555) | |||
221 | TUPLE_EXPR@[261; 263) | 221 | TUPLE_EXPR@[261; 263) |
222 | L_PAREN@[261; 262) "(" | 222 | L_PAREN@[261; 262) "(" |
223 | R_PAREN@[262; 263) ")" | 223 | R_PAREN@[262; 263) ")" |
224 | SEMI@[263; 264) ";" | 224 | SEMICOLON@[263; 264) ";" |
225 | WHITESPACE@[264; 269) "\n " | 225 | WHITESPACE@[264; 269) "\n " |
226 | COMMENT@[269; 271) "//" | 226 | COMMENT@[269; 271) "//" |
227 | WHITESPACE@[271; 276) "\n " | 227 | WHITESPACE@[271; 276) "\n " |
@@ -235,7 +235,7 @@ SOURCE_FILE@[0; 555) | |||
235 | SLICE_PAT@[301; 305) | 235 | SLICE_PAT@[301; 305) |
236 | L_BRACK@[301; 302) "[" | 236 | L_BRACK@[301; 302) "[" |
237 | DOT_DOT_PAT@[302; 304) | 237 | DOT_DOT_PAT@[302; 304) |
238 | DOTDOT@[302; 304) ".." | 238 | DOT2@[302; 304) ".." |
239 | R_BRACK@[304; 305) "]" | 239 | R_BRACK@[304; 305) "]" |
240 | WHITESPACE@[305; 306) " " | 240 | WHITESPACE@[305; 306) " " |
241 | EQ@[306; 307) "=" | 241 | EQ@[306; 307) "=" |
@@ -243,7 +243,7 @@ SOURCE_FILE@[0; 555) | |||
243 | TUPLE_EXPR@[308; 310) | 243 | TUPLE_EXPR@[308; 310) |
244 | L_PAREN@[308; 309) "(" | 244 | L_PAREN@[308; 309) "(" |
245 | R_PAREN@[309; 310) ")" | 245 | R_PAREN@[309; 310) ")" |
246 | SEMI@[310; 311) ";" | 246 | SEMICOLON@[310; 311) ";" |
247 | WHITESPACE@[311; 316) "\n " | 247 | WHITESPACE@[311; 316) "\n " |
248 | LET_STMT@[316; 336) | 248 | LET_STMT@[316; 336) |
249 | LET_KW@[316; 319) "let" | 249 | LET_KW@[316; 319) "let" |
@@ -256,7 +256,7 @@ SOURCE_FILE@[0; 555) | |||
256 | COMMA@[325; 326) "," | 256 | COMMA@[325; 326) "," |
257 | WHITESPACE@[326; 327) " " | 257 | WHITESPACE@[326; 327) " " |
258 | DOT_DOT_PAT@[327; 329) | 258 | DOT_DOT_PAT@[327; 329) |
259 | DOTDOT@[327; 329) ".." | 259 | DOT2@[327; 329) ".." |
260 | R_BRACK@[329; 330) "]" | 260 | R_BRACK@[329; 330) "]" |
261 | WHITESPACE@[330; 331) " " | 261 | WHITESPACE@[330; 331) " " |
262 | EQ@[331; 332) "=" | 262 | EQ@[331; 332) "=" |
@@ -264,7 +264,7 @@ SOURCE_FILE@[0; 555) | |||
264 | TUPLE_EXPR@[333; 335) | 264 | TUPLE_EXPR@[333; 335) |
265 | L_PAREN@[333; 334) "(" | 265 | L_PAREN@[333; 334) "(" |
266 | R_PAREN@[334; 335) ")" | 266 | R_PAREN@[334; 335) ")" |
267 | SEMI@[335; 336) ";" | 267 | SEMICOLON@[335; 336) ";" |
268 | WHITESPACE@[336; 341) "\n " | 268 | WHITESPACE@[336; 341) "\n " |
269 | LET_STMT@[341; 368) | 269 | LET_STMT@[341; 368) |
270 | LET_KW@[341; 344) "let" | 270 | LET_KW@[341; 344) "let" |
@@ -283,7 +283,7 @@ SOURCE_FILE@[0; 555) | |||
283 | AT@[357; 358) "@" | 283 | AT@[357; 358) "@" |
284 | WHITESPACE@[358; 359) " " | 284 | WHITESPACE@[358; 359) " " |
285 | DOT_DOT_PAT@[359; 361) | 285 | DOT_DOT_PAT@[359; 361) |
286 | DOTDOT@[359; 361) ".." | 286 | DOT2@[359; 361) ".." |
287 | R_BRACK@[361; 362) "]" | 287 | R_BRACK@[361; 362) "]" |
288 | WHITESPACE@[362; 363) " " | 288 | WHITESPACE@[362; 363) " " |
289 | EQ@[363; 364) "=" | 289 | EQ@[363; 364) "=" |
@@ -291,7 +291,7 @@ SOURCE_FILE@[0; 555) | |||
291 | TUPLE_EXPR@[365; 367) | 291 | TUPLE_EXPR@[365; 367) |
292 | L_PAREN@[365; 366) "(" | 292 | L_PAREN@[365; 366) "(" |
293 | R_PAREN@[366; 367) ")" | 293 | R_PAREN@[366; 367) ")" |
294 | SEMI@[367; 368) ";" | 294 | SEMICOLON@[367; 368) ";" |
295 | WHITESPACE@[368; 373) "\n " | 295 | WHITESPACE@[368; 373) "\n " |
296 | LET_STMT@[373; 399) | 296 | LET_STMT@[373; 399) |
297 | LET_KW@[373; 376) "let" | 297 | LET_KW@[373; 376) "let" |
@@ -304,7 +304,7 @@ SOURCE_FILE@[0; 555) | |||
304 | COMMA@[382; 383) "," | 304 | COMMA@[382; 383) "," |
305 | WHITESPACE@[383; 384) " " | 305 | WHITESPACE@[383; 384) " " |
306 | DOT_DOT_PAT@[384; 386) | 306 | DOT_DOT_PAT@[384; 386) |
307 | DOTDOT@[384; 386) ".." | 307 | DOT2@[384; 386) ".." |
308 | COMMA@[386; 387) "," | 308 | COMMA@[386; 387) "," |
309 | WHITESPACE@[387; 388) " " | 309 | WHITESPACE@[387; 388) " " |
310 | BIND_PAT@[388; 392) | 310 | BIND_PAT@[388; 392) |
@@ -317,7 +317,7 @@ SOURCE_FILE@[0; 555) | |||
317 | TUPLE_EXPR@[396; 398) | 317 | TUPLE_EXPR@[396; 398) |
318 | L_PAREN@[396; 397) "(" | 318 | L_PAREN@[396; 397) "(" |
319 | R_PAREN@[397; 398) ")" | 319 | R_PAREN@[397; 398) ")" |
320 | SEMI@[398; 399) ";" | 320 | SEMICOLON@[398; 399) ";" |
321 | WHITESPACE@[399; 404) "\n " | 321 | WHITESPACE@[399; 404) "\n " |
322 | LET_STMT@[404; 436) | 322 | LET_STMT@[404; 436) |
323 | LET_KW@[404; 407) "let" | 323 | LET_KW@[404; 407) "let" |
@@ -336,7 +336,7 @@ SOURCE_FILE@[0; 555) | |||
336 | AT@[419; 420) "@" | 336 | AT@[419; 420) "@" |
337 | WHITESPACE@[420; 421) " " | 337 | WHITESPACE@[420; 421) " " |
338 | DOT_DOT_PAT@[421; 423) | 338 | DOT_DOT_PAT@[421; 423) |
339 | DOTDOT@[421; 423) ".." | 339 | DOT2@[421; 423) ".." |
340 | COMMA@[423; 424) "," | 340 | COMMA@[423; 424) "," |
341 | WHITESPACE@[424; 425) " " | 341 | WHITESPACE@[424; 425) " " |
342 | BIND_PAT@[425; 429) | 342 | BIND_PAT@[425; 429) |
@@ -349,7 +349,7 @@ SOURCE_FILE@[0; 555) | |||
349 | TUPLE_EXPR@[433; 435) | 349 | TUPLE_EXPR@[433; 435) |
350 | L_PAREN@[433; 434) "(" | 350 | L_PAREN@[433; 434) "(" |
351 | R_PAREN@[434; 435) ")" | 351 | R_PAREN@[434; 435) ")" |
352 | SEMI@[435; 436) ";" | 352 | SEMICOLON@[435; 436) ";" |
353 | WHITESPACE@[436; 441) "\n " | 353 | WHITESPACE@[436; 441) "\n " |
354 | LET_STMT@[441; 471) | 354 | LET_STMT@[441; 471) |
355 | LET_KW@[441; 444) "let" | 355 | LET_KW@[441; 444) "let" |
@@ -362,11 +362,11 @@ SOURCE_FILE@[0; 555) | |||
362 | COMMA@[450; 451) "," | 362 | COMMA@[450; 451) "," |
363 | WHITESPACE@[451; 452) " " | 363 | WHITESPACE@[451; 452) " " |
364 | DOT_DOT_PAT@[452; 454) | 364 | DOT_DOT_PAT@[452; 454) |
365 | DOTDOT@[452; 454) ".." | 365 | DOT2@[452; 454) ".." |
366 | COMMA@[454; 455) "," | 366 | COMMA@[454; 455) "," |
367 | WHITESPACE@[455; 456) " " | 367 | WHITESPACE@[455; 456) " " |
368 | DOT_DOT_PAT@[456; 458) | 368 | DOT_DOT_PAT@[456; 458) |
369 | DOTDOT@[456; 458) ".." | 369 | DOT2@[456; 458) ".." |
370 | COMMA@[458; 459) "," | 370 | COMMA@[458; 459) "," |
371 | WHITESPACE@[459; 460) " " | 371 | WHITESPACE@[459; 460) " " |
372 | BIND_PAT@[460; 464) | 372 | BIND_PAT@[460; 464) |
@@ -379,7 +379,7 @@ SOURCE_FILE@[0; 555) | |||
379 | TUPLE_EXPR@[468; 470) | 379 | TUPLE_EXPR@[468; 470) |
380 | L_PAREN@[468; 469) "(" | 380 | L_PAREN@[468; 469) "(" |
381 | R_PAREN@[469; 470) ")" | 381 | R_PAREN@[469; 470) ")" |
382 | SEMI@[470; 471) ";" | 382 | SEMICOLON@[470; 471) ";" |
383 | WHITESPACE@[471; 476) "\n " | 383 | WHITESPACE@[471; 476) "\n " |
384 | LET_STMT@[476; 512) | 384 | LET_STMT@[476; 512) |
385 | LET_KW@[476; 479) "let" | 385 | LET_KW@[476; 479) "let" |
@@ -392,7 +392,7 @@ SOURCE_FILE@[0; 555) | |||
392 | COMMA@[485; 486) "," | 392 | COMMA@[485; 486) "," |
393 | WHITESPACE@[486; 487) " " | 393 | WHITESPACE@[486; 487) " " |
394 | DOT_DOT_PAT@[487; 489) | 394 | DOT_DOT_PAT@[487; 489) |
395 | DOTDOT@[487; 489) ".." | 395 | DOT2@[487; 489) ".." |
396 | COMMA@[489; 490) "," | 396 | COMMA@[489; 490) "," |
397 | WHITESPACE@[490; 491) " " | 397 | WHITESPACE@[490; 491) " " |
398 | BIND_PAT@[491; 494) | 398 | BIND_PAT@[491; 494) |
@@ -407,7 +407,7 @@ SOURCE_FILE@[0; 555) | |||
407 | AT@[501; 502) "@" | 407 | AT@[501; 502) "@" |
408 | WHITESPACE@[502; 503) " " | 408 | WHITESPACE@[502; 503) " " |
409 | DOT_DOT_PAT@[503; 505) | 409 | DOT_DOT_PAT@[503; 505) |
410 | DOTDOT@[503; 505) ".." | 410 | DOT2@[503; 505) ".." |
411 | R_BRACK@[505; 506) "]" | 411 | R_BRACK@[505; 506) "]" |
412 | WHITESPACE@[506; 507) " " | 412 | WHITESPACE@[506; 507) " " |
413 | EQ@[507; 508) "=" | 413 | EQ@[507; 508) "=" |
@@ -415,7 +415,7 @@ SOURCE_FILE@[0; 555) | |||
415 | TUPLE_EXPR@[509; 511) | 415 | TUPLE_EXPR@[509; 511) |
416 | L_PAREN@[509; 510) "(" | 416 | L_PAREN@[509; 510) "(" |
417 | R_PAREN@[510; 511) ")" | 417 | R_PAREN@[510; 511) ")" |
418 | SEMI@[511; 512) ";" | 418 | SEMICOLON@[511; 512) ";" |
419 | WHITESPACE@[512; 517) "\n " | 419 | WHITESPACE@[512; 517) "\n " |
420 | LET_STMT@[517; 552) | 420 | LET_STMT@[517; 552) |
421 | LET_KW@[517; 520) "let" | 421 | LET_KW@[517; 520) "let" |
@@ -428,7 +428,7 @@ SOURCE_FILE@[0; 555) | |||
428 | COMMA@[526; 527) "," | 428 | COMMA@[526; 527) "," |
429 | WHITESPACE@[527; 528) " " | 429 | WHITESPACE@[527; 528) " " |
430 | DOT_DOT_PAT@[528; 530) | 430 | DOT_DOT_PAT@[528; 530) |
431 | DOTDOT@[528; 530) ".." | 431 | DOT2@[528; 530) ".." |
432 | COMMA@[530; 531) "," | 432 | COMMA@[530; 531) "," |
433 | WHITESPACE@[531; 532) " " | 433 | WHITESPACE@[531; 532) " " |
434 | BIND_PAT@[532; 535) | 434 | BIND_PAT@[532; 535) |
@@ -437,7 +437,7 @@ SOURCE_FILE@[0; 555) | |||
437 | COMMA@[535; 536) "," | 437 | COMMA@[535; 536) "," |
438 | WHITESPACE@[536; 537) " " | 438 | WHITESPACE@[536; 537) " " |
439 | DOT_DOT_PAT@[537; 539) | 439 | DOT_DOT_PAT@[537; 539) |
440 | DOTDOT@[537; 539) ".." | 440 | DOT2@[537; 539) ".." |
441 | COMMA@[539; 540) "," | 441 | COMMA@[539; 540) "," |
442 | WHITESPACE@[540; 541) " " | 442 | WHITESPACE@[540; 541) " " |
443 | BIND_PAT@[541; 545) | 443 | BIND_PAT@[541; 545) |
@@ -450,7 +450,7 @@ SOURCE_FILE@[0; 555) | |||
450 | TUPLE_EXPR@[549; 551) | 450 | TUPLE_EXPR@[549; 551) |
451 | L_PAREN@[549; 550) "(" | 451 | L_PAREN@[549; 550) "(" |
452 | R_PAREN@[550; 551) ")" | 452 | R_PAREN@[550; 551) ")" |
453 | SEMI@[551; 552) ";" | 453 | SEMICOLON@[551; 552) ";" |
454 | WHITESPACE@[552; 553) "\n" | 454 | WHITESPACE@[552; 553) "\n" |
455 | R_CURLY@[553; 554) "}" | 455 | R_CURLY@[553; 554) "}" |
456 | WHITESPACE@[554; 555) "\n" | 456 | WHITESPACE@[554; 555) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast index 06fbdfabf..0d786f597 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast | |||
@@ -39,7 +39,7 @@ SOURCE_FILE@[0; 63) | |||
39 | TUPLE_EXPR@[32; 34) | 39 | TUPLE_EXPR@[32; 34) |
40 | L_PAREN@[32; 33) "(" | 40 | L_PAREN@[32; 33) "(" |
41 | R_PAREN@[33; 34) ")" | 41 | R_PAREN@[33; 34) ")" |
42 | SEMI@[34; 35) ";" | 42 | SEMICOLON@[34; 35) ";" |
43 | WHITESPACE@[35; 40) "\n " | 43 | WHITESPACE@[35; 40) "\n " |
44 | LET_STMT@[40; 60) | 44 | LET_STMT@[40; 60) |
45 | LET_KW@[40; 43) "let" | 45 | LET_KW@[40; 43) "let" |
@@ -69,7 +69,7 @@ SOURCE_FILE@[0; 63) | |||
69 | TUPLE_EXPR@[57; 59) | 69 | TUPLE_EXPR@[57; 59) |
70 | L_PAREN@[57; 58) "(" | 70 | L_PAREN@[57; 58) "(" |
71 | R_PAREN@[58; 59) ")" | 71 | R_PAREN@[58; 59) ")" |
72 | SEMI@[59; 60) ";" | 72 | SEMICOLON@[59; 60) ";" |
73 | WHITESPACE@[60; 61) "\n" | 73 | WHITESPACE@[60; 61) "\n" |
74 | R_CURLY@[61; 62) "}" | 74 | R_CURLY@[61; 62) "}" |
75 | WHITESPACE@[62; 63) "\n" | 75 | WHITESPACE@[62; 63) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0146_as_precedence.rast b/crates/ra_syntax/test_data/parser/inline/ok/0146_as_precedence.rast index 9e3767fb7..d2f6d8fde 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0146_as_precedence.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0146_as_precedence.rast | |||
@@ -37,7 +37,7 @@ SOURCE_FILE@[0; 43) | |||
37 | PATH_SEGMENT@[36; 39) | 37 | PATH_SEGMENT@[36; 39) |
38 | NAME_REF@[36; 39) | 38 | NAME_REF@[36; 39) |
39 | IDENT@[36; 39) "i32" | 39 | IDENT@[36; 39) "i32" |
40 | SEMI@[39; 40) ";" | 40 | SEMICOLON@[39; 40) ";" |
41 | WHITESPACE@[40; 41) "\n" | 41 | WHITESPACE@[40; 41) "\n" |
42 | R_CURLY@[41; 42) "}" | 42 | R_CURLY@[41; 42) "}" |
43 | WHITESPACE@[42; 43) "\n" | 43 | WHITESPACE@[42; 43) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast b/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast index f81de7bac..21161f7bf 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast | |||
@@ -19,5 +19,5 @@ SOURCE_FILE@[0; 24) | |||
19 | NAME_REF@[18; 21) | 19 | NAME_REF@[18; 21) |
20 | IDENT@[18; 21) "u32" | 20 | IDENT@[18; 21) "u32" |
21 | R_ANGLE@[21; 22) ">" | 21 | R_ANGLE@[21; 22) ">" |
22 | SEMI@[22; 23) ";" | 22 | SEMICOLON@[22; 23) ";" |
23 | WHITESPACE@[23; 24) "\n" | 23 | WHITESPACE@[23; 24) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rast b/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rast index 78e296f88..1f297e479 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rast | |||
@@ -43,5 +43,5 @@ SOURCE_FILE@[0; 40) | |||
43 | WHITESPACE@[35; 36) " " | 43 | WHITESPACE@[35; 36) " " |
44 | INT_NUMBER@[36; 37) "2" | 44 | INT_NUMBER@[36; 37) "2" |
45 | R_BRACK@[37; 38) "]" | 45 | R_BRACK@[37; 38) "]" |
46 | SEMI@[38; 39) ";" | 46 | SEMICOLON@[38; 39) ";" |
47 | WHITESPACE@[39; 40) "\n" | 47 | WHITESPACE@[39; 40) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast b/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast index de1536ef0..167c0fffa 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast | |||
@@ -29,7 +29,7 @@ SOURCE_FILE@[0; 83) | |||
29 | NAME_REF@[15; 16) | 29 | NAME_REF@[15; 16) |
30 | IDENT@[15; 16) "U" | 30 | IDENT@[15; 16) "U" |
31 | R_ANGLE@[16; 17) ">" | 31 | R_ANGLE@[16; 17) ">" |
32 | SEMI@[17; 18) ";" | 32 | SEMICOLON@[17; 18) ";" |
33 | WHITESPACE@[18; 19) "\n" | 33 | WHITESPACE@[18; 19) "\n" |
34 | TRAIT_DEF@[19; 51) | 34 | TRAIT_DEF@[19; 51) |
35 | TRAIT_KW@[19; 24) "trait" | 35 | TRAIT_KW@[19; 24) "trait" |
@@ -80,7 +80,7 @@ SOURCE_FILE@[0; 83) | |||
80 | PATH_SEGMENT@[46; 50) | 80 | PATH_SEGMENT@[46; 50) |
81 | NAME_REF@[46; 50) | 81 | NAME_REF@[46; 50) |
82 | IDENT@[46; 50) "Copy" | 82 | IDENT@[46; 50) "Copy" |
83 | SEMI@[50; 51) ";" | 83 | SEMICOLON@[50; 51) ";" |
84 | WHITESPACE@[51; 52) "\n" | 84 | WHITESPACE@[51; 52) "\n" |
85 | TRAIT_DEF@[52; 82) | 85 | TRAIT_DEF@[52; 82) |
86 | TRAIT_KW@[52; 57) "trait" | 86 | TRAIT_KW@[52; 57) "trait" |
@@ -124,5 +124,5 @@ SOURCE_FILE@[0; 83) | |||
124 | NAME_REF@[79; 80) | 124 | NAME_REF@[79; 80) |
125 | IDENT@[79; 80) "U" | 125 | IDENT@[79; 80) "U" |
126 | R_ANGLE@[80; 81) ">" | 126 | R_ANGLE@[80; 81) ">" |
127 | SEMI@[81; 82) ";" | 127 | SEMICOLON@[81; 82) ";" |
128 | WHITESPACE@[82; 83) "\n" | 128 | WHITESPACE@[82; 83) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast b/crates/ra_syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast index cb686854a..ee1bd361d 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast | |||
@@ -18,12 +18,12 @@ SOURCE_FILE@[0; 55) | |||
18 | PATH_SEGMENT@[14; 17) | 18 | PATH_SEGMENT@[14; 17) |
19 | NAME_REF@[14; 17) | 19 | NAME_REF@[14; 17) |
20 | IDENT@[14; 17) "Bar" | 20 | IDENT@[14; 17) "Bar" |
21 | COLONCOLON@[17; 19) "::" | 21 | COLON2@[17; 19) "::" |
22 | PATH_SEGMENT@[19; 22) | 22 | PATH_SEGMENT@[19; 22) |
23 | NAME_REF@[19; 22) | 23 | NAME_REF@[19; 22) |
24 | IDENT@[19; 22) "Baz" | 24 | IDENT@[19; 22) "Baz" |
25 | R_PAREN@[22; 23) ")" | 25 | R_PAREN@[22; 23) ")" |
26 | SEMI@[23; 24) ";" | 26 | SEMICOLON@[23; 24) ";" |
27 | WHITESPACE@[24; 25) "\n" | 27 | WHITESPACE@[24; 25) "\n" |
28 | TYPE_ALIAS_DEF@[25; 54) | 28 | TYPE_ALIAS_DEF@[25; 54) |
29 | TYPE_KW@[25; 29) "type" | 29 | TYPE_KW@[25; 29) "type" |
@@ -49,10 +49,10 @@ SOURCE_FILE@[0; 55) | |||
49 | PATH_SEGMENT@[44; 47) | 49 | PATH_SEGMENT@[44; 47) |
50 | NAME_REF@[44; 47) | 50 | NAME_REF@[44; 47) |
51 | IDENT@[44; 47) "Bar" | 51 | IDENT@[44; 47) "Bar" |
52 | COLONCOLON@[47; 49) "::" | 52 | COLON2@[47; 49) "::" |
53 | PATH_SEGMENT@[49; 52) | 53 | PATH_SEGMENT@[49; 52) |
54 | NAME_REF@[49; 52) | 54 | NAME_REF@[49; 52) |
55 | IDENT@[49; 52) "Baz" | 55 | IDENT@[49; 52) "Baz" |
56 | R_PAREN@[52; 53) ")" | 56 | R_PAREN@[52; 53) ")" |
57 | SEMI@[53; 54) ";" | 57 | SEMICOLON@[53; 54) ";" |
58 | WHITESPACE@[54; 55) "\n" | 58 | WHITESPACE@[54; 55) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast b/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast index 98727ae98..a5f8b6480 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast | |||
@@ -55,7 +55,7 @@ SOURCE_FILE@[0; 63) | |||
55 | PATH_SEGMENT@[46; 49) | 55 | PATH_SEGMENT@[46; 49) |
56 | NAME_REF@[46; 49) | 56 | NAME_REF@[46; 49) |
57 | IDENT@[46; 49) "Qux" | 57 | IDENT@[46; 49) "Qux" |
58 | COLONCOLON@[49; 51) "::" | 58 | COLON2@[49; 51) "::" |
59 | PATH_SEGMENT@[51; 55) | 59 | PATH_SEGMENT@[51; 55) |
60 | NAME_REF@[51; 55) | 60 | NAME_REF@[51; 55) |
61 | IDENT@[51; 55) "Quux" | 61 | IDENT@[51; 55) "Quux" |
@@ -64,7 +64,7 @@ SOURCE_FILE@[0; 63) | |||
64 | TUPLE_EXPR@[57; 59) | 64 | TUPLE_EXPR@[57; 59) |
65 | L_PAREN@[57; 58) "(" | 65 | L_PAREN@[57; 58) "(" |
66 | R_PAREN@[58; 59) ")" | 66 | R_PAREN@[58; 59) ")" |
67 | SEMI@[59; 60) ";" | 67 | SEMICOLON@[59; 60) ";" |
68 | WHITESPACE@[60; 61) "\n" | 68 | WHITESPACE@[60; 61) "\n" |
69 | R_CURLY@[61; 62) "}" | 69 | R_CURLY@[61; 62) "}" |
70 | WHITESPACE@[62; 63) "\n" | 70 | WHITESPACE@[62; 63) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast b/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast index 52d8f21a4..e0081a9f2 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast | |||
@@ -22,5 +22,5 @@ SOURCE_FILE@[0; 23) | |||
22 | NAME_REF@[17; 20) | 22 | NAME_REF@[17; 20) |
23 | IDENT@[17; 20) "bar" | 23 | IDENT@[17; 20) "bar" |
24 | R_PAREN@[20; 21) ")" | 24 | R_PAREN@[20; 21) ")" |
25 | SEMI@[21; 22) ";" | 25 | SEMICOLON@[21; 22) ";" |
26 | WHITESPACE@[22; 23) "\n" | 26 | WHITESPACE@[22; 23) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rast b/crates/ra_syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rast index d568a1d45..548be2698 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rast | |||
@@ -32,7 +32,7 @@ SOURCE_FILE@[0; 28) | |||
32 | AMP@[22; 23) "&" | 32 | AMP@[22; 23) "&" |
33 | LITERAL@[23; 24) | 33 | LITERAL@[23; 24) |
34 | INT_NUMBER@[23; 24) "2" | 34 | INT_NUMBER@[23; 24) "2" |
35 | SEMI@[24; 25) ";" | 35 | SEMICOLON@[24; 25) ";" |
36 | WHITESPACE@[25; 26) "\n" | 36 | WHITESPACE@[25; 26) "\n" |
37 | R_CURLY@[26; 27) "}" | 37 | R_CURLY@[26; 27) "}" |
38 | WHITESPACE@[27; 28) "\n" | 38 | WHITESPACE@[27; 28) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast index ba8779094..a7a547fce 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast | |||
@@ -39,7 +39,7 @@ SOURCE_FILE@[0; 34) | |||
39 | ARG_LIST@[28; 30) | 39 | ARG_LIST@[28; 30) |
40 | L_PAREN@[28; 29) "(" | 40 | L_PAREN@[28; 29) "(" |
41 | R_PAREN@[29; 30) ")" | 41 | R_PAREN@[29; 30) ")" |
42 | SEMI@[30; 31) ";" | 42 | SEMICOLON@[30; 31) ";" |
43 | WHITESPACE@[31; 32) " " | 43 | WHITESPACE@[31; 32) " " |
44 | R_CURLY@[32; 33) "}" | 44 | R_CURLY@[32; 33) "}" |
45 | WHITESPACE@[33; 34) "\n" | 45 | WHITESPACE@[33; 34) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0006_inner_attributes.rast b/crates/ra_syntax/test_data/parser/ok/0006_inner_attributes.rast index d72b72561..308b5680f 100644 --- a/crates/ra_syntax/test_data/parser/ok/0006_inner_attributes.rast +++ b/crates/ra_syntax/test_data/parser/ok/0006_inner_attributes.rast | |||
@@ -1,7 +1,7 @@ | |||
1 | SOURCE_FILE@[0; 236) | 1 | SOURCE_FILE@[0; 236) |
2 | ATTR@[0; 8) | 2 | ATTR@[0; 8) |
3 | POUND@[0; 1) "#" | 3 | POUND@[0; 1) "#" |
4 | EXCL@[1; 2) "!" | 4 | BANG@[1; 2) "!" |
5 | L_BRACK@[2; 3) "[" | 5 | L_BRACK@[2; 3) "[" |
6 | PATH@[3; 7) | 6 | PATH@[3; 7) |
7 | PATH_SEGMENT@[3; 7) | 7 | PATH_SEGMENT@[3; 7) |
@@ -11,7 +11,7 @@ SOURCE_FILE@[0; 236) | |||
11 | WHITESPACE@[8; 9) "\n" | 11 | WHITESPACE@[8; 9) "\n" |
12 | ATTR@[9; 23) | 12 | ATTR@[9; 23) |
13 | POUND@[9; 10) "#" | 13 | POUND@[9; 10) "#" |
14 | EXCL@[10; 11) "!" | 14 | BANG@[10; 11) "!" |
15 | L_BRACK@[11; 12) "[" | 15 | L_BRACK@[11; 12) "[" |
16 | PATH@[12; 16) | 16 | PATH@[12; 16) |
17 | PATH_SEGMENT@[12; 16) | 17 | PATH_SEGMENT@[12; 16) |
@@ -25,7 +25,7 @@ SOURCE_FILE@[0; 236) | |||
25 | WHITESPACE@[23; 24) "\n" | 25 | WHITESPACE@[23; 24) "\n" |
26 | ATTR@[24; 39) | 26 | ATTR@[24; 39) |
27 | POUND@[24; 25) "#" | 27 | POUND@[24; 25) "#" |
28 | EXCL@[25; 26) "!" | 28 | BANG@[25; 26) "!" |
29 | L_BRACK@[26; 27) "[" | 29 | L_BRACK@[26; 27) "[" |
30 | PATH@[27; 31) | 30 | PATH@[27; 31) |
31 | PATH_SEGMENT@[27; 31) | 31 | PATH_SEGMENT@[27; 31) |
@@ -39,7 +39,7 @@ SOURCE_FILE@[0; 236) | |||
39 | WHITESPACE@[39; 40) "\n" | 39 | WHITESPACE@[39; 40) "\n" |
40 | ATTR@[40; 116) | 40 | ATTR@[40; 116) |
41 | POUND@[40; 41) "#" | 41 | POUND@[40; 41) "#" |
42 | EXCL@[41; 42) "!" | 42 | BANG@[41; 42) "!" |
43 | L_BRACK@[42; 43) "[" | 43 | L_BRACK@[42; 43) "[" |
44 | PATH@[43; 47) | 44 | PATH@[43; 47) |
45 | PATH_SEGMENT@[43; 47) | 45 | PATH_SEGMENT@[43; 47) |
@@ -83,7 +83,7 @@ SOURCE_FILE@[0; 236) | |||
83 | WHITESPACE@[116; 117) "\n" | 83 | WHITESPACE@[116; 117) "\n" |
84 | ATTR@[117; 130) | 84 | ATTR@[117; 130) |
85 | POUND@[117; 118) "#" | 85 | POUND@[117; 118) "#" |
86 | EXCL@[118; 119) "!" | 86 | BANG@[118; 119) "!" |
87 | L_BRACK@[119; 120) "[" | 87 | L_BRACK@[119; 120) "[" |
88 | PATH@[120; 124) | 88 | PATH@[120; 124) |
89 | PATH_SEGMENT@[120; 124) | 89 | PATH_SEGMENT@[120; 124) |
@@ -97,7 +97,7 @@ SOURCE_FILE@[0; 236) | |||
97 | WHITESPACE@[130; 131) "\n" | 97 | WHITESPACE@[130; 131) "\n" |
98 | ATTR@[131; 155) | 98 | ATTR@[131; 155) |
99 | POUND@[131; 132) "#" | 99 | POUND@[131; 132) "#" |
100 | EXCL@[132; 133) "!" | 100 | BANG@[132; 133) "!" |
101 | L_BRACK@[133; 134) "[" | 101 | L_BRACK@[133; 134) "[" |
102 | PATH@[134; 138) | 102 | PATH@[134; 138) |
103 | PATH_SEGMENT@[134; 138) | 103 | PATH_SEGMENT@[134; 138) |
@@ -115,7 +115,7 @@ SOURCE_FILE@[0; 236) | |||
115 | WHITESPACE@[155; 156) "\n" | 115 | WHITESPACE@[155; 156) "\n" |
116 | ATTR@[156; 173) | 116 | ATTR@[156; 173) |
117 | POUND@[156; 157) "#" | 117 | POUND@[156; 157) "#" |
118 | EXCL@[157; 158) "!" | 118 | BANG@[157; 158) "!" |
119 | L_BRACK@[158; 159) "[" | 119 | L_BRACK@[158; 159) "[" |
120 | PATH@[159; 166) | 120 | PATH@[159; 166) |
121 | PATH_SEGMENT@[159; 166) | 121 | PATH_SEGMENT@[159; 166) |
@@ -129,7 +129,7 @@ SOURCE_FILE@[0; 236) | |||
129 | WHITESPACE@[173; 174) "\n" | 129 | WHITESPACE@[173; 174) "\n" |
130 | ATTR@[174; 191) | 130 | ATTR@[174; 191) |
131 | POUND@[174; 175) "#" | 131 | POUND@[174; 175) "#" |
132 | EXCL@[175; 176) "!" | 132 | BANG@[175; 176) "!" |
133 | L_BRACK@[176; 177) "[" | 133 | L_BRACK@[176; 177) "[" |
134 | PATH@[177; 181) | 134 | PATH@[177; 181) |
135 | PATH_SEGMENT@[177; 181) | 135 | PATH_SEGMENT@[177; 181) |
@@ -143,7 +143,7 @@ SOURCE_FILE@[0; 236) | |||
143 | WHITESPACE@[191; 192) "\n" | 143 | WHITESPACE@[191; 192) "\n" |
144 | ATTR@[192; 214) | 144 | ATTR@[192; 214) |
145 | POUND@[192; 193) "#" | 145 | POUND@[192; 193) "#" |
146 | EXCL@[193; 194) "!" | 146 | BANG@[193; 194) "!" |
147 | L_BRACK@[194; 195) "[" | 147 | L_BRACK@[194; 195) "[" |
148 | PATH@[195; 199) | 148 | PATH@[195; 199) |
149 | PATH_SEGMENT@[195; 199) | 149 | PATH_SEGMENT@[195; 199) |
@@ -164,7 +164,7 @@ SOURCE_FILE@[0; 236) | |||
164 | WHITESPACE@[214; 215) "\n" | 164 | WHITESPACE@[214; 215) "\n" |
165 | ATTR@[215; 236) | 165 | ATTR@[215; 236) |
166 | POUND@[215; 216) "#" | 166 | POUND@[215; 216) "#" |
167 | EXCL@[216; 217) "!" | 167 | BANG@[216; 217) "!" |
168 | L_BRACK@[217; 218) "[" | 168 | L_BRACK@[217; 218) "[" |
169 | PATH@[218; 222) | 169 | PATH@[218; 222) |
170 | PATH_SEGMENT@[218; 222) | 170 | PATH_SEGMENT@[218; 222) |
diff --git a/crates/ra_syntax/test_data/parser/ok/0007_extern_crate.rast b/crates/ra_syntax/test_data/parser/ok/0007_extern_crate.rast index 1ffa36c7e..4856b4f81 100644 --- a/crates/ra_syntax/test_data/parser/ok/0007_extern_crate.rast +++ b/crates/ra_syntax/test_data/parser/ok/0007_extern_crate.rast | |||
@@ -6,7 +6,7 @@ SOURCE_FILE@[0; 69) | |||
6 | WHITESPACE@[12; 13) " " | 6 | WHITESPACE@[12; 13) " " |
7 | NAME_REF@[13; 16) | 7 | NAME_REF@[13; 16) |
8 | IDENT@[13; 16) "foo" | 8 | IDENT@[13; 16) "foo" |
9 | SEMI@[16; 17) ";" | 9 | SEMICOLON@[16; 17) ";" |
10 | WHITESPACE@[17; 18) "\n" | 10 | WHITESPACE@[17; 18) "\n" |
11 | EXTERN_CRATE_ITEM@[18; 42) | 11 | EXTERN_CRATE_ITEM@[18; 42) |
12 | EXTERN_KW@[18; 24) "extern" | 12 | EXTERN_KW@[18; 24) "extern" |
@@ -21,7 +21,7 @@ SOURCE_FILE@[0; 69) | |||
21 | WHITESPACE@[37; 38) " " | 21 | WHITESPACE@[37; 38) " " |
22 | NAME@[38; 41) | 22 | NAME@[38; 41) |
23 | IDENT@[38; 41) "bar" | 23 | IDENT@[38; 41) "bar" |
24 | SEMI@[41; 42) ";" | 24 | SEMICOLON@[41; 42) ";" |
25 | WHITESPACE@[42; 43) "\n" | 25 | WHITESPACE@[42; 43) "\n" |
26 | EXTERN_CRATE_ITEM@[43; 68) | 26 | EXTERN_CRATE_ITEM@[43; 68) |
27 | EXTERN_KW@[43; 49) "extern" | 27 | EXTERN_KW@[43; 49) "extern" |
@@ -36,5 +36,5 @@ SOURCE_FILE@[0; 69) | |||
36 | WHITESPACE@[63; 64) " " | 36 | WHITESPACE@[63; 64) " " |
37 | NAME@[64; 67) | 37 | NAME@[64; 67) |
38 | IDENT@[64; 67) "baz" | 38 | IDENT@[64; 67) "baz" |
39 | SEMI@[67; 68) ";" | 39 | SEMICOLON@[67; 68) ";" |
40 | WHITESPACE@[68; 69) "\n" | 40 | WHITESPACE@[68; 69) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0008_mod_item.rast b/crates/ra_syntax/test_data/parser/ok/0008_mod_item.rast index 061019a73..1c18edd4e 100644 --- a/crates/ra_syntax/test_data/parser/ok/0008_mod_item.rast +++ b/crates/ra_syntax/test_data/parser/ok/0008_mod_item.rast | |||
@@ -4,7 +4,7 @@ SOURCE_FILE@[0; 118) | |||
4 | WHITESPACE@[3; 4) " " | 4 | WHITESPACE@[3; 4) " " |
5 | NAME@[4; 5) | 5 | NAME@[4; 5) |
6 | IDENT@[4; 5) "a" | 6 | IDENT@[4; 5) "a" |
7 | SEMI@[5; 6) ";" | 7 | SEMICOLON@[5; 6) ";" |
8 | WHITESPACE@[6; 8) "\n\n" | 8 | WHITESPACE@[6; 8) "\n\n" |
9 | MODULE@[8; 17) | 9 | MODULE@[8; 17) |
10 | MOD_KW@[8; 11) "mod" | 10 | MOD_KW@[8; 11) "mod" |
@@ -64,7 +64,7 @@ SOURCE_FILE@[0; 118) | |||
64 | WHITESPACE@[74; 79) "\n " | 64 | WHITESPACE@[74; 79) "\n " |
65 | ATTR@[79; 87) | 65 | ATTR@[79; 87) |
66 | POUND@[79; 80) "#" | 66 | POUND@[79; 80) "#" |
67 | EXCL@[80; 81) "!" | 67 | BANG@[80; 81) "!" |
68 | L_BRACK@[81; 82) "[" | 68 | L_BRACK@[81; 82) "[" |
69 | PATH@[82; 86) | 69 | PATH@[82; 86) |
70 | PATH_SEGMENT@[82; 86) | 70 | PATH_SEGMENT@[82; 86) |
@@ -77,7 +77,7 @@ SOURCE_FILE@[0; 118) | |||
77 | WHITESPACE@[95; 96) " " | 77 | WHITESPACE@[95; 96) " " |
78 | NAME@[96; 97) | 78 | NAME@[96; 97) |
79 | IDENT@[96; 97) "e" | 79 | IDENT@[96; 97) "e" |
80 | SEMI@[97; 98) ";" | 80 | SEMICOLON@[97; 98) ";" |
81 | WHITESPACE@[98; 103) "\n " | 81 | WHITESPACE@[98; 103) "\n " |
82 | MODULE@[103; 116) | 82 | MODULE@[103; 116) |
83 | MOD_KW@[103; 106) "mod" | 83 | MOD_KW@[103; 106) "mod" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0009_use_item.rast b/crates/ra_syntax/test_data/parser/ok/0009_use_item.rast index 41db9dbb7..62a8ae433 100644 --- a/crates/ra_syntax/test_data/parser/ok/0009_use_item.rast +++ b/crates/ra_syntax/test_data/parser/ok/0009_use_item.rast | |||
@@ -7,7 +7,7 @@ SOURCE_FILE@[0; 19) | |||
7 | PATH_SEGMENT@[4; 7) | 7 | PATH_SEGMENT@[4; 7) |
8 | NAME_REF@[4; 7) | 8 | NAME_REF@[4; 7) |
9 | IDENT@[4; 7) "foo" | 9 | IDENT@[4; 7) "foo" |
10 | SEMI@[7; 8) ";" | 10 | SEMICOLON@[7; 8) ";" |
11 | WHITESPACE@[8; 9) "\n" | 11 | WHITESPACE@[8; 9) "\n" |
12 | USE_ITEM@[9; 19) | 12 | USE_ITEM@[9; 19) |
13 | USE_KW@[9; 12) "use" | 13 | USE_KW@[9; 12) "use" |
@@ -15,7 +15,7 @@ SOURCE_FILE@[0; 19) | |||
15 | USE_TREE@[13; 18) | 15 | USE_TREE@[13; 18) |
16 | PATH@[13; 18) | 16 | PATH@[13; 18) |
17 | PATH_SEGMENT@[13; 18) | 17 | PATH_SEGMENT@[13; 18) |
18 | COLONCOLON@[13; 15) "::" | 18 | COLON2@[13; 15) "::" |
19 | NAME_REF@[15; 18) | 19 | NAME_REF@[15; 18) |
20 | IDENT@[15; 18) "bar" | 20 | IDENT@[15; 18) "bar" |
21 | SEMI@[18; 19) ";" | 21 | SEMICOLON@[18; 19) ";" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0010_use_path_segments.rast b/crates/ra_syntax/test_data/parser/ok/0010_use_path_segments.rast index 09871b84d..f2689e1ed 100644 --- a/crates/ra_syntax/test_data/parser/ok/0010_use_path_segments.rast +++ b/crates/ra_syntax/test_data/parser/ok/0010_use_path_segments.rast | |||
@@ -7,18 +7,18 @@ SOURCE_FILE@[0; 40) | |||
7 | PATH@[4; 14) | 7 | PATH@[4; 14) |
8 | PATH@[4; 9) | 8 | PATH@[4; 9) |
9 | PATH_SEGMENT@[4; 9) | 9 | PATH_SEGMENT@[4; 9) |
10 | COLONCOLON@[4; 6) "::" | 10 | COLON2@[4; 6) "::" |
11 | NAME_REF@[6; 9) | 11 | NAME_REF@[6; 9) |
12 | IDENT@[6; 9) "foo" | 12 | IDENT@[6; 9) "foo" |
13 | COLONCOLON@[9; 11) "::" | 13 | COLON2@[9; 11) "::" |
14 | PATH_SEGMENT@[11; 14) | 14 | PATH_SEGMENT@[11; 14) |
15 | NAME_REF@[11; 14) | 15 | NAME_REF@[11; 14) |
16 | IDENT@[11; 14) "bar" | 16 | IDENT@[11; 14) "bar" |
17 | COLONCOLON@[14; 16) "::" | 17 | COLON2@[14; 16) "::" |
18 | PATH_SEGMENT@[16; 19) | 18 | PATH_SEGMENT@[16; 19) |
19 | NAME_REF@[16; 19) | 19 | NAME_REF@[16; 19) |
20 | IDENT@[16; 19) "baz" | 20 | IDENT@[16; 19) "baz" |
21 | SEMI@[19; 20) ";" | 21 | SEMICOLON@[19; 20) ";" |
22 | WHITESPACE@[20; 21) "\n" | 22 | WHITESPACE@[20; 21) "\n" |
23 | USE_ITEM@[21; 39) | 23 | USE_ITEM@[21; 39) |
24 | USE_KW@[21; 24) "use" | 24 | USE_KW@[21; 24) "use" |
@@ -30,13 +30,13 @@ SOURCE_FILE@[0; 40) | |||
30 | PATH_SEGMENT@[25; 28) | 30 | PATH_SEGMENT@[25; 28) |
31 | NAME_REF@[25; 28) | 31 | NAME_REF@[25; 28) |
32 | IDENT@[25; 28) "foo" | 32 | IDENT@[25; 28) "foo" |
33 | COLONCOLON@[28; 30) "::" | 33 | COLON2@[28; 30) "::" |
34 | PATH_SEGMENT@[30; 33) | 34 | PATH_SEGMENT@[30; 33) |
35 | NAME_REF@[30; 33) | 35 | NAME_REF@[30; 33) |
36 | IDENT@[30; 33) "bar" | 36 | IDENT@[30; 33) "bar" |
37 | COLONCOLON@[33; 35) "::" | 37 | COLON2@[33; 35) "::" |
38 | PATH_SEGMENT@[35; 38) | 38 | PATH_SEGMENT@[35; 38) |
39 | NAME_REF@[35; 38) | 39 | NAME_REF@[35; 38) |
40 | IDENT@[35; 38) "baz" | 40 | IDENT@[35; 38) "baz" |
41 | SEMI@[38; 39) ";" | 41 | SEMICOLON@[38; 39) ";" |
42 | WHITESPACE@[39; 40) "\n" | 42 | WHITESPACE@[39; 40) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0011_outer_attribute.rast b/crates/ra_syntax/test_data/parser/ok/0011_outer_attribute.rast index f7aa8afe4..4426d586a 100644 --- a/crates/ra_syntax/test_data/parser/ok/0011_outer_attribute.rast +++ b/crates/ra_syntax/test_data/parser/ok/0011_outer_attribute.rast | |||
@@ -54,5 +54,5 @@ SOURCE_FILE@[0; 60) | |||
54 | WHITESPACE@[56; 57) " " | 54 | WHITESPACE@[56; 57) " " |
55 | NAME@[57; 58) | 55 | NAME@[57; 58) |
56 | IDENT@[57; 58) "b" | 56 | IDENT@[57; 58) "b" |
57 | SEMI@[58; 59) ";" | 57 | SEMICOLON@[58; 59) ";" |
58 | WHITESPACE@[59; 60) "\n" | 58 | WHITESPACE@[59; 60) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0012_visibility.rast b/crates/ra_syntax/test_data/parser/ok/0012_visibility.rast index 68e692fd0..c76cf9fe9 100644 --- a/crates/ra_syntax/test_data/parser/ok/0012_visibility.rast +++ b/crates/ra_syntax/test_data/parser/ok/0012_visibility.rast | |||
@@ -82,11 +82,11 @@ SOURCE_FILE@[0; 98) | |||
82 | PATH_SEGMENT@[73; 76) | 82 | PATH_SEGMENT@[73; 76) |
83 | NAME_REF@[73; 76) | 83 | NAME_REF@[73; 76) |
84 | IDENT@[73; 76) "foo" | 84 | IDENT@[73; 76) "foo" |
85 | COLONCOLON@[76; 78) "::" | 85 | COLON2@[76; 78) "::" |
86 | PATH_SEGMENT@[78; 81) | 86 | PATH_SEGMENT@[78; 81) |
87 | NAME_REF@[78; 81) | 87 | NAME_REF@[78; 81) |
88 | IDENT@[78; 81) "bar" | 88 | IDENT@[78; 81) "bar" |
89 | COLONCOLON@[81; 83) "::" | 89 | COLON2@[81; 83) "::" |
90 | PATH_SEGMENT@[83; 86) | 90 | PATH_SEGMENT@[83; 86) |
91 | NAME_REF@[83; 86) | 91 | NAME_REF@[83; 86) |
92 | IDENT@[83; 86) "baz" | 92 | IDENT@[83; 86) "baz" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0013_use_path_self_super.rast b/crates/ra_syntax/test_data/parser/ok/0013_use_path_self_super.rast index 50730e958..552cb3daf 100644 --- a/crates/ra_syntax/test_data/parser/ok/0013_use_path_self_super.rast +++ b/crates/ra_syntax/test_data/parser/ok/0013_use_path_self_super.rast | |||
@@ -7,11 +7,11 @@ SOURCE_FILE@[0; 65) | |||
7 | PATH@[4; 8) | 7 | PATH@[4; 8) |
8 | PATH_SEGMENT@[4; 8) | 8 | PATH_SEGMENT@[4; 8) |
9 | SELF_KW@[4; 8) "self" | 9 | SELF_KW@[4; 8) "self" |
10 | COLONCOLON@[8; 10) "::" | 10 | COLON2@[8; 10) "::" |
11 | PATH_SEGMENT@[10; 13) | 11 | PATH_SEGMENT@[10; 13) |
12 | NAME_REF@[10; 13) | 12 | NAME_REF@[10; 13) |
13 | IDENT@[10; 13) "foo" | 13 | IDENT@[10; 13) "foo" |
14 | SEMI@[13; 14) ";" | 14 | SEMICOLON@[13; 14) ";" |
15 | WHITESPACE@[14; 15) "\n" | 15 | WHITESPACE@[14; 15) "\n" |
16 | USE_ITEM@[15; 37) | 16 | USE_ITEM@[15; 37) |
17 | USE_KW@[15; 18) "use" | 17 | USE_KW@[15; 18) "use" |
@@ -22,14 +22,14 @@ SOURCE_FILE@[0; 65) | |||
22 | PATH@[19; 24) | 22 | PATH@[19; 24) |
23 | PATH_SEGMENT@[19; 24) | 23 | PATH_SEGMENT@[19; 24) |
24 | SUPER_KW@[19; 24) "super" | 24 | SUPER_KW@[19; 24) "super" |
25 | COLONCOLON@[24; 26) "::" | 25 | COLON2@[24; 26) "::" |
26 | PATH_SEGMENT@[26; 31) | 26 | PATH_SEGMENT@[26; 31) |
27 | SUPER_KW@[26; 31) "super" | 27 | SUPER_KW@[26; 31) "super" |
28 | COLONCOLON@[31; 33) "::" | 28 | COLON2@[31; 33) "::" |
29 | PATH_SEGMENT@[33; 36) | 29 | PATH_SEGMENT@[33; 36) |
30 | NAME_REF@[33; 36) | 30 | NAME_REF@[33; 36) |
31 | IDENT@[33; 36) "bar" | 31 | IDENT@[33; 36) "bar" |
32 | SEMI@[36; 37) ";" | 32 | SEMICOLON@[36; 37) ";" |
33 | WHITESPACE@[37; 38) "\n" | 33 | WHITESPACE@[37; 38) "\n" |
34 | USE_ITEM@[38; 64) | 34 | USE_ITEM@[38; 64) |
35 | USE_KW@[38; 41) "use" | 35 | USE_KW@[38; 41) "use" |
@@ -40,18 +40,18 @@ SOURCE_FILE@[0; 65) | |||
40 | PATH@[42; 51) | 40 | PATH@[42; 51) |
41 | PATH@[42; 48) | 41 | PATH@[42; 48) |
42 | PATH_SEGMENT@[42; 48) | 42 | PATH_SEGMENT@[42; 48) |
43 | COLONCOLON@[42; 44) "::" | 43 | COLON2@[42; 44) "::" |
44 | SELF_KW@[44; 48) "self" | 44 | SELF_KW@[44; 48) "self" |
45 | COLONCOLON@[48; 50) "::" | 45 | COLON2@[48; 50) "::" |
46 | PATH_SEGMENT@[50; 51) | 46 | PATH_SEGMENT@[50; 51) |
47 | NAME_REF@[50; 51) | 47 | NAME_REF@[50; 51) |
48 | IDENT@[50; 51) "a" | 48 | IDENT@[50; 51) "a" |
49 | COLONCOLON@[51; 53) "::" | 49 | COLON2@[51; 53) "::" |
50 | PATH_SEGMENT@[53; 58) | 50 | PATH_SEGMENT@[53; 58) |
51 | SUPER_KW@[53; 58) "super" | 51 | SUPER_KW@[53; 58) "super" |
52 | COLONCOLON@[58; 60) "::" | 52 | COLON2@[58; 60) "::" |
53 | PATH_SEGMENT@[60; 63) | 53 | PATH_SEGMENT@[60; 63) |
54 | NAME_REF@[60; 63) | 54 | NAME_REF@[60; 63) |
55 | IDENT@[60; 63) "bar" | 55 | IDENT@[60; 63) "bar" |
56 | SEMI@[63; 64) ";" | 56 | SEMICOLON@[63; 64) ";" |
57 | WHITESPACE@[64; 65) "\n" | 57 | WHITESPACE@[64; 65) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0014_use_tree.rast b/crates/ra_syntax/test_data/parser/ok/0014_use_tree.rast index 3fe34d001..49a68e881 100644 --- a/crates/ra_syntax/test_data/parser/ok/0014_use_tree.rast +++ b/crates/ra_syntax/test_data/parser/ok/0014_use_tree.rast | |||
@@ -4,25 +4,25 @@ SOURCE_FILE@[0; 81) | |||
4 | WHITESPACE@[3; 4) " " | 4 | WHITESPACE@[3; 4) " " |
5 | USE_TREE@[4; 5) | 5 | USE_TREE@[4; 5) |
6 | STAR@[4; 5) "*" | 6 | STAR@[4; 5) "*" |
7 | SEMI@[5; 6) ";" | 7 | SEMICOLON@[5; 6) ";" |
8 | WHITESPACE@[6; 7) "\n" | 8 | WHITESPACE@[6; 7) "\n" |
9 | USE_ITEM@[7; 15) | 9 | USE_ITEM@[7; 15) |
10 | USE_KW@[7; 10) "use" | 10 | USE_KW@[7; 10) "use" |
11 | WHITESPACE@[10; 11) " " | 11 | WHITESPACE@[10; 11) " " |
12 | USE_TREE@[11; 14) | 12 | USE_TREE@[11; 14) |
13 | COLONCOLON@[11; 13) "::" | 13 | COLON2@[11; 13) "::" |
14 | STAR@[13; 14) "*" | 14 | STAR@[13; 14) "*" |
15 | SEMI@[14; 15) ";" | 15 | SEMICOLON@[14; 15) ";" |
16 | WHITESPACE@[15; 16) "\n" | 16 | WHITESPACE@[15; 16) "\n" |
17 | USE_ITEM@[16; 25) | 17 | USE_ITEM@[16; 25) |
18 | USE_KW@[16; 19) "use" | 18 | USE_KW@[16; 19) "use" |
19 | WHITESPACE@[19; 20) " " | 19 | WHITESPACE@[19; 20) " " |
20 | USE_TREE@[20; 24) | 20 | USE_TREE@[20; 24) |
21 | COLONCOLON@[20; 22) "::" | 21 | COLON2@[20; 22) "::" |
22 | USE_TREE_LIST@[22; 24) | 22 | USE_TREE_LIST@[22; 24) |
23 | L_CURLY@[22; 23) "{" | 23 | L_CURLY@[22; 23) "{" |
24 | R_CURLY@[23; 24) "}" | 24 | R_CURLY@[23; 24) "}" |
25 | SEMI@[24; 25) ";" | 25 | SEMICOLON@[24; 25) ";" |
26 | WHITESPACE@[25; 26) "\n" | 26 | WHITESPACE@[25; 26) "\n" |
27 | USE_ITEM@[26; 33) | 27 | USE_ITEM@[26; 33) |
28 | USE_KW@[26; 29) "use" | 28 | USE_KW@[26; 29) "use" |
@@ -31,7 +31,7 @@ SOURCE_FILE@[0; 81) | |||
31 | USE_TREE_LIST@[30; 32) | 31 | USE_TREE_LIST@[30; 32) |
32 | L_CURLY@[30; 31) "{" | 32 | L_CURLY@[30; 31) "{" |
33 | R_CURLY@[31; 32) "}" | 33 | R_CURLY@[31; 32) "}" |
34 | SEMI@[32; 33) ";" | 34 | SEMICOLON@[32; 33) ";" |
35 | WHITESPACE@[33; 34) "\n" | 35 | WHITESPACE@[33; 34) "\n" |
36 | USE_ITEM@[34; 45) | 36 | USE_ITEM@[34; 45) |
37 | USE_KW@[34; 37) "use" | 37 | USE_KW@[34; 37) "use" |
@@ -41,9 +41,9 @@ SOURCE_FILE@[0; 81) | |||
41 | PATH_SEGMENT@[38; 41) | 41 | PATH_SEGMENT@[38; 41) |
42 | NAME_REF@[38; 41) | 42 | NAME_REF@[38; 41) |
43 | IDENT@[38; 41) "foo" | 43 | IDENT@[38; 41) "foo" |
44 | COLONCOLON@[41; 43) "::" | 44 | COLON2@[41; 43) "::" |
45 | STAR@[43; 44) "*" | 45 | STAR@[43; 44) "*" |
46 | SEMI@[44; 45) ";" | 46 | SEMICOLON@[44; 45) ";" |
47 | WHITESPACE@[45; 46) "\n" | 47 | WHITESPACE@[45; 46) "\n" |
48 | USE_ITEM@[46; 58) | 48 | USE_ITEM@[46; 58) |
49 | USE_KW@[46; 49) "use" | 49 | USE_KW@[46; 49) "use" |
@@ -53,11 +53,11 @@ SOURCE_FILE@[0; 81) | |||
53 | PATH_SEGMENT@[50; 53) | 53 | PATH_SEGMENT@[50; 53) |
54 | NAME_REF@[50; 53) | 54 | NAME_REF@[50; 53) |
55 | IDENT@[50; 53) "foo" | 55 | IDENT@[50; 53) "foo" |
56 | COLONCOLON@[53; 55) "::" | 56 | COLON2@[53; 55) "::" |
57 | USE_TREE_LIST@[55; 57) | 57 | USE_TREE_LIST@[55; 57) |
58 | L_CURLY@[55; 56) "{" | 58 | L_CURLY@[55; 56) "{" |
59 | R_CURLY@[56; 57) "}" | 59 | R_CURLY@[56; 57) "}" |
60 | SEMI@[57; 58) ";" | 60 | SEMICOLON@[57; 58) ";" |
61 | WHITESPACE@[58; 59) "\n" | 61 | WHITESPACE@[58; 59) "\n" |
62 | USE_ITEM@[59; 80) | 62 | USE_ITEM@[59; 80) |
63 | USE_KW@[59; 62) "use" | 63 | USE_KW@[59; 62) "use" |
@@ -65,10 +65,10 @@ SOURCE_FILE@[0; 81) | |||
65 | USE_TREE@[63; 79) | 65 | USE_TREE@[63; 79) |
66 | PATH@[63; 68) | 66 | PATH@[63; 68) |
67 | PATH_SEGMENT@[63; 68) | 67 | PATH_SEGMENT@[63; 68) |
68 | COLONCOLON@[63; 65) "::" | 68 | COLON2@[63; 65) "::" |
69 | NAME_REF@[65; 68) | 69 | NAME_REF@[65; 68) |
70 | IDENT@[65; 68) "foo" | 70 | IDENT@[65; 68) "foo" |
71 | COLONCOLON@[68; 70) "::" | 71 | COLON2@[68; 70) "::" |
72 | USE_TREE_LIST@[70; 79) | 72 | USE_TREE_LIST@[70; 79) |
73 | L_CURLY@[70; 71) "{" | 73 | L_CURLY@[70; 71) "{" |
74 | USE_TREE@[71; 72) | 74 | USE_TREE@[71; 72) |
@@ -91,5 +91,5 @@ SOURCE_FILE@[0; 81) | |||
91 | NAME_REF@[77; 78) | 91 | NAME_REF@[77; 78) |
92 | IDENT@[77; 78) "c" | 92 | IDENT@[77; 78) "c" |
93 | R_CURLY@[78; 79) "}" | 93 | R_CURLY@[78; 79) "}" |
94 | SEMI@[79; 80) ";" | 94 | SEMICOLON@[79; 80) ";" |
95 | WHITESPACE@[80; 81) "\n" | 95 | WHITESPACE@[80; 81) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0015_use_tree.rast b/crates/ra_syntax/test_data/parser/ok/0015_use_tree.rast index e63f14253..719ac98ef 100644 --- a/crates/ra_syntax/test_data/parser/ok/0015_use_tree.rast +++ b/crates/ra_syntax/test_data/parser/ok/0015_use_tree.rast | |||
@@ -13,7 +13,7 @@ SOURCE_FILE@[0; 55) | |||
13 | WHITESPACE@[10; 11) " " | 13 | WHITESPACE@[10; 11) " " |
14 | NAME@[11; 14) | 14 | NAME@[11; 14) |
15 | IDENT@[11; 14) "bar" | 15 | IDENT@[11; 14) "bar" |
16 | SEMI@[14; 15) ";" | 16 | SEMICOLON@[14; 15) ";" |
17 | WHITESPACE@[15; 16) "\n" | 17 | WHITESPACE@[15; 16) "\n" |
18 | USE_ITEM@[16; 54) | 18 | USE_ITEM@[16; 54) |
19 | USE_KW@[16; 19) "use" | 19 | USE_KW@[16; 19) "use" |
@@ -23,7 +23,7 @@ SOURCE_FILE@[0; 55) | |||
23 | PATH_SEGMENT@[20; 23) | 23 | PATH_SEGMENT@[20; 23) |
24 | NAME_REF@[20; 23) | 24 | NAME_REF@[20; 23) |
25 | IDENT@[20; 23) "foo" | 25 | IDENT@[20; 23) "foo" |
26 | COLONCOLON@[23; 25) "::" | 26 | COLON2@[23; 25) "::" |
27 | USE_TREE_LIST@[25; 53) | 27 | USE_TREE_LIST@[25; 53) |
28 | L_CURLY@[25; 26) "{" | 28 | L_CURLY@[25; 26) "{" |
29 | USE_TREE@[26; 32) | 29 | USE_TREE@[26; 32) |
@@ -44,14 +44,14 @@ SOURCE_FILE@[0; 55) | |||
44 | COMMA@[35; 36) "," | 44 | COMMA@[35; 36) "," |
45 | WHITESPACE@[36; 37) " " | 45 | WHITESPACE@[36; 37) " " |
46 | USE_TREE@[37; 40) | 46 | USE_TREE@[37; 40) |
47 | COLONCOLON@[37; 39) "::" | 47 | COLON2@[37; 39) "::" |
48 | STAR@[39; 40) "*" | 48 | STAR@[39; 40) "*" |
49 | COMMA@[40; 41) "," | 49 | COMMA@[40; 41) "," |
50 | WHITESPACE@[41; 42) " " | 50 | WHITESPACE@[41; 42) " " |
51 | USE_TREE@[42; 52) | 51 | USE_TREE@[42; 52) |
52 | PATH@[42; 47) | 52 | PATH@[42; 47) |
53 | PATH_SEGMENT@[42; 47) | 53 | PATH_SEGMENT@[42; 47) |
54 | COLONCOLON@[42; 44) "::" | 54 | COLON2@[42; 44) "::" |
55 | NAME_REF@[44; 47) | 55 | NAME_REF@[44; 47) |
56 | IDENT@[44; 47) "foo" | 56 | IDENT@[44; 47) "foo" |
57 | WHITESPACE@[47; 48) " " | 57 | WHITESPACE@[47; 48) " " |
@@ -61,5 +61,5 @@ SOURCE_FILE@[0; 55) | |||
61 | NAME@[51; 52) | 61 | NAME@[51; 52) |
62 | IDENT@[51; 52) "x" | 62 | IDENT@[51; 52) "x" |
63 | R_CURLY@[52; 53) "}" | 63 | R_CURLY@[52; 53) "}" |
64 | SEMI@[53; 54) ";" | 64 | SEMICOLON@[53; 54) ";" |
65 | WHITESPACE@[54; 55) "\n" | 65 | WHITESPACE@[54; 55) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0016_struct_flavors.rast b/crates/ra_syntax/test_data/parser/ok/0016_struct_flavors.rast index 3fbd14d7b..f4739451e 100644 --- a/crates/ra_syntax/test_data/parser/ok/0016_struct_flavors.rast +++ b/crates/ra_syntax/test_data/parser/ok/0016_struct_flavors.rast | |||
@@ -4,7 +4,7 @@ SOURCE_FILE@[0; 97) | |||
4 | WHITESPACE@[6; 7) " " | 4 | WHITESPACE@[6; 7) " " |
5 | NAME@[7; 8) | 5 | NAME@[7; 8) |
6 | IDENT@[7; 8) "A" | 6 | IDENT@[7; 8) "A" |
7 | SEMI@[8; 9) ";" | 7 | SEMICOLON@[8; 9) ";" |
8 | WHITESPACE@[9; 10) "\n" | 8 | WHITESPACE@[9; 10) "\n" |
9 | STRUCT_DEF@[10; 21) | 9 | STRUCT_DEF@[10; 21) |
10 | STRUCT_KW@[10; 16) "struct" | 10 | STRUCT_KW@[10; 16) "struct" |
@@ -24,7 +24,7 @@ SOURCE_FILE@[0; 97) | |||
24 | TUPLE_FIELD_DEF_LIST@[30; 32) | 24 | TUPLE_FIELD_DEF_LIST@[30; 32) |
25 | L_PAREN@[30; 31) "(" | 25 | L_PAREN@[30; 31) "(" |
26 | R_PAREN@[31; 32) ")" | 26 | R_PAREN@[31; 32) ")" |
27 | SEMI@[32; 33) ";" | 27 | SEMICOLON@[32; 33) ";" |
28 | WHITESPACE@[33; 35) "\n\n" | 28 | WHITESPACE@[33; 35) "\n\n" |
29 | STRUCT_DEF@[35; 74) | 29 | STRUCT_DEF@[35; 74) |
30 | STRUCT_KW@[35; 41) "struct" | 30 | STRUCT_KW@[35; 41) "struct" |
@@ -89,5 +89,5 @@ SOURCE_FILE@[0; 97) | |||
89 | IDENT@[92; 93) "y" | 89 | IDENT@[92; 93) "y" |
90 | COMMA@[93; 94) "," | 90 | COMMA@[93; 94) "," |
91 | R_PAREN@[94; 95) ")" | 91 | R_PAREN@[94; 95) ")" |
92 | SEMI@[95; 96) ";" | 92 | SEMICOLON@[95; 96) ";" |
93 | WHITESPACE@[96; 97) "\n" | 93 | WHITESPACE@[96; 97) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.rast b/crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.rast index 1e4e58dd3..5e859ef29 100644 --- a/crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.rast +++ b/crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.rast | |||
@@ -10,7 +10,7 @@ SOURCE_FILE@[0; 290) | |||
10 | NAME@[10; 11) | 10 | NAME@[10; 11) |
11 | IDENT@[10; 11) "T" | 11 | IDENT@[10; 11) "T" |
12 | R_ANGLE@[11; 12) ">" | 12 | R_ANGLE@[11; 12) ">" |
13 | SEMI@[12; 13) ";" | 13 | SEMICOLON@[12; 13) ";" |
14 | WHITESPACE@[13; 14) "\n" | 14 | WHITESPACE@[13; 14) "\n" |
15 | STRUCT_DEF@[14; 32) | 15 | STRUCT_DEF@[14; 32) |
16 | STRUCT_KW@[14; 20) "struct" | 16 | STRUCT_KW@[14; 20) "struct" |
@@ -32,7 +32,7 @@ SOURCE_FILE@[0; 290) | |||
32 | NAME_REF@[27; 30) | 32 | NAME_REF@[27; 30) |
33 | IDENT@[27; 30) "u32" | 33 | IDENT@[27; 30) "u32" |
34 | R_PAREN@[30; 31) ")" | 34 | R_PAREN@[30; 31) ")" |
35 | SEMI@[31; 32) ";" | 35 | SEMICOLON@[31; 32) ";" |
36 | WHITESPACE@[32; 33) "\n" | 36 | WHITESPACE@[32; 33) "\n" |
37 | STRUCT_DEF@[33; 56) | 37 | STRUCT_DEF@[33; 56) |
38 | STRUCT_KW@[33; 39) "struct" | 38 | STRUCT_KW@[33; 39) "struct" |
@@ -70,7 +70,7 @@ SOURCE_FILE@[0; 290) | |||
70 | TYPE_PARAM_LIST@[67; 69) | 70 | TYPE_PARAM_LIST@[67; 69) |
71 | L_ANGLE@[67; 68) "<" | 71 | L_ANGLE@[67; 68) "<" |
72 | R_ANGLE@[68; 69) ">" | 72 | R_ANGLE@[68; 69) ">" |
73 | SEMI@[69; 70) ";" | 73 | SEMICOLON@[69; 70) ";" |
74 | WHITESPACE@[70; 71) "\n" | 74 | WHITESPACE@[70; 71) "\n" |
75 | STRUCT_DEF@[71; 85) | 75 | STRUCT_DEF@[71; 85) |
76 | STRUCT_KW@[71; 77) "struct" | 76 | STRUCT_KW@[71; 77) "struct" |
@@ -82,7 +82,7 @@ SOURCE_FILE@[0; 290) | |||
82 | LIFETIME_PARAM@[81; 83) | 82 | LIFETIME_PARAM@[81; 83) |
83 | LIFETIME@[81; 83) "\'a" | 83 | LIFETIME@[81; 83) "\'a" |
84 | R_ANGLE@[83; 84) ">" | 84 | R_ANGLE@[83; 84) ">" |
85 | SEMI@[84; 85) ";" | 85 | SEMICOLON@[84; 85) ";" |
86 | WHITESPACE@[85; 86) "\n" | 86 | WHITESPACE@[85; 86) "\n" |
87 | STRUCT_DEF@[86; 101) | 87 | STRUCT_DEF@[86; 101) |
88 | STRUCT_KW@[86; 92) "struct" | 88 | STRUCT_KW@[86; 92) "struct" |
@@ -95,7 +95,7 @@ SOURCE_FILE@[0; 290) | |||
95 | LIFETIME@[96; 98) "\'a" | 95 | LIFETIME@[96; 98) "\'a" |
96 | COLON@[98; 99) ":" | 96 | COLON@[98; 99) ":" |
97 | R_ANGLE@[99; 100) ">" | 97 | R_ANGLE@[99; 100) ">" |
98 | SEMI@[100; 101) ";" | 98 | SEMICOLON@[100; 101) ";" |
99 | WHITESPACE@[101; 102) "\n" | 99 | WHITESPACE@[101; 102) "\n" |
100 | STRUCT_DEF@[102; 120) | 100 | STRUCT_DEF@[102; 120) |
101 | STRUCT_KW@[102; 108) "struct" | 101 | STRUCT_KW@[102; 108) "struct" |
@@ -110,7 +110,7 @@ SOURCE_FILE@[0; 290) | |||
110 | WHITESPACE@[115; 116) " " | 110 | WHITESPACE@[115; 116) " " |
111 | LIFETIME@[116; 118) "\'b" | 111 | LIFETIME@[116; 118) "\'b" |
112 | R_ANGLE@[118; 119) ">" | 112 | R_ANGLE@[118; 119) ">" |
113 | SEMI@[119; 120) ";" | 113 | SEMICOLON@[119; 120) ";" |
114 | WHITESPACE@[120; 121) "\n" | 114 | WHITESPACE@[120; 121) "\n" |
115 | STRUCT_DEF@[121; 142) | 115 | STRUCT_DEF@[121; 142) |
116 | STRUCT_KW@[121; 127) "struct" | 116 | STRUCT_KW@[121; 127) "struct" |
@@ -128,7 +128,7 @@ SOURCE_FILE@[0; 290) | |||
128 | PLUS@[138; 139) "+" | 128 | PLUS@[138; 139) "+" |
129 | WHITESPACE@[139; 140) " " | 129 | WHITESPACE@[139; 140) " " |
130 | R_ANGLE@[140; 141) ">" | 130 | R_ANGLE@[140; 141) ">" |
131 | SEMI@[141; 142) ";" | 131 | SEMICOLON@[141; 142) ";" |
132 | WHITESPACE@[142; 143) "\n" | 132 | WHITESPACE@[142; 143) "\n" |
133 | STRUCT_DEF@[143; 166) | 133 | STRUCT_DEF@[143; 166) |
134 | STRUCT_KW@[143; 149) "struct" | 134 | STRUCT_KW@[143; 149) "struct" |
@@ -147,7 +147,7 @@ SOURCE_FILE@[0; 290) | |||
147 | WHITESPACE@[161; 162) " " | 147 | WHITESPACE@[161; 162) " " |
148 | LIFETIME@[162; 164) "\'c" | 148 | LIFETIME@[162; 164) "\'c" |
149 | R_ANGLE@[164; 165) ">" | 149 | R_ANGLE@[164; 165) ">" |
150 | SEMI@[165; 166) ";" | 150 | SEMICOLON@[165; 166) ";" |
151 | WHITESPACE@[166; 167) "\n" | 151 | WHITESPACE@[166; 167) "\n" |
152 | STRUCT_DEF@[167; 183) | 152 | STRUCT_DEF@[167; 183) |
153 | STRUCT_KW@[167; 173) "struct" | 153 | STRUCT_KW@[167; 173) "struct" |
@@ -160,7 +160,7 @@ SOURCE_FILE@[0; 290) | |||
160 | LIFETIME@[178; 180) "\'a" | 160 | LIFETIME@[178; 180) "\'a" |
161 | COMMA@[180; 181) "," | 161 | COMMA@[180; 181) "," |
162 | R_ANGLE@[181; 182) ">" | 162 | R_ANGLE@[181; 182) ">" |
163 | SEMI@[182; 183) ";" | 163 | SEMICOLON@[182; 183) ";" |
164 | WHITESPACE@[183; 184) "\n" | 164 | WHITESPACE@[183; 184) "\n" |
165 | STRUCT_DEF@[184; 203) | 165 | STRUCT_DEF@[184; 203) |
166 | STRUCT_KW@[184; 190) "struct" | 166 | STRUCT_KW@[184; 190) "struct" |
@@ -176,7 +176,7 @@ SOURCE_FILE@[0; 290) | |||
176 | LIFETIME_PARAM@[199; 201) | 176 | LIFETIME_PARAM@[199; 201) |
177 | LIFETIME@[199; 201) "\'b" | 177 | LIFETIME@[199; 201) "\'b" |
178 | R_ANGLE@[201; 202) ">" | 178 | R_ANGLE@[201; 202) ">" |
179 | SEMI@[202; 203) ";" | 179 | SEMICOLON@[202; 203) ";" |
180 | WHITESPACE@[203; 204) "\n" | 180 | WHITESPACE@[203; 204) "\n" |
181 | STRUCT_DEF@[204; 233) | 181 | STRUCT_DEF@[204; 233) |
182 | STRUCT_KW@[204; 210) "struct" | 182 | STRUCT_KW@[204; 210) "struct" |
@@ -200,7 +200,7 @@ SOURCE_FILE@[0; 290) | |||
200 | LIFETIME@[228; 230) "\'c" | 200 | LIFETIME@[228; 230) "\'c" |
201 | COMMA@[230; 231) "," | 201 | COMMA@[230; 231) "," |
202 | R_ANGLE@[231; 232) ">" | 202 | R_ANGLE@[231; 232) ">" |
203 | SEMI@[232; 233) ";" | 203 | SEMICOLON@[232; 233) ";" |
204 | WHITESPACE@[233; 235) "\n\n" | 204 | WHITESPACE@[233; 235) "\n\n" |
205 | STRUCT_DEF@[235; 249) | 205 | STRUCT_DEF@[235; 249) |
206 | STRUCT_KW@[235; 241) "struct" | 206 | STRUCT_KW@[235; 241) "struct" |
@@ -213,7 +213,7 @@ SOURCE_FILE@[0; 290) | |||
213 | NAME@[246; 247) | 213 | NAME@[246; 247) |
214 | IDENT@[246; 247) "T" | 214 | IDENT@[246; 247) "T" |
215 | R_ANGLE@[247; 248) ">" | 215 | R_ANGLE@[247; 248) ">" |
216 | SEMI@[248; 249) ";" | 216 | SEMICOLON@[248; 249) ";" |
217 | WHITESPACE@[249; 250) "\n" | 217 | WHITESPACE@[249; 250) "\n" |
218 | STRUCT_DEF@[250; 267) | 218 | STRUCT_DEF@[250; 267) |
219 | STRUCT_KW@[250; 256) "struct" | 219 | STRUCT_KW@[250; 256) "struct" |
@@ -231,7 +231,7 @@ SOURCE_FILE@[0; 290) | |||
231 | NAME@[264; 265) | 231 | NAME@[264; 265) |
232 | IDENT@[264; 265) "U" | 232 | IDENT@[264; 265) "U" |
233 | R_ANGLE@[265; 266) ">" | 233 | R_ANGLE@[265; 266) ">" |
234 | SEMI@[266; 267) ";" | 234 | SEMICOLON@[266; 267) ";" |
235 | WHITESPACE@[267; 268) "\n" | 235 | WHITESPACE@[267; 268) "\n" |
236 | STRUCT_DEF@[268; 289) | 236 | STRUCT_DEF@[268; 289) |
237 | STRUCT_KW@[268; 274) "struct" | 237 | STRUCT_KW@[268; 274) "struct" |
@@ -253,5 +253,5 @@ SOURCE_FILE@[0; 290) | |||
253 | NAME@[286; 287) | 253 | NAME@[286; 287) |
254 | IDENT@[286; 287) "U" | 254 | IDENT@[286; 287) "U" |
255 | R_ANGLE@[287; 288) ">" | 255 | R_ANGLE@[287; 288) ">" |
256 | SEMI@[288; 289) ";" | 256 | SEMICOLON@[288; 289) ";" |
257 | WHITESPACE@[289; 290) "\n" | 257 | WHITESPACE@[289; 290) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0020_type_param_bounds.rast b/crates/ra_syntax/test_data/parser/ok/0020_type_param_bounds.rast index 18a5fd784..edacc4bd9 100644 --- a/crates/ra_syntax/test_data/parser/ok/0020_type_param_bounds.rast +++ b/crates/ra_syntax/test_data/parser/ok/0020_type_param_bounds.rast | |||
@@ -10,7 +10,7 @@ SOURCE_FILE@[0; 250) | |||
10 | NAME@[9; 10) | 10 | NAME@[9; 10) |
11 | IDENT@[9; 10) "T" | 11 | IDENT@[9; 10) "T" |
12 | R_ANGLE@[10; 11) ">" | 12 | R_ANGLE@[10; 11) ">" |
13 | SEMI@[11; 12) ";" | 13 | SEMICOLON@[11; 12) ";" |
14 | WHITESPACE@[12; 13) "\n" | 14 | WHITESPACE@[12; 13) "\n" |
15 | STRUCT_DEF@[13; 26) | 15 | STRUCT_DEF@[13; 26) |
16 | STRUCT_KW@[13; 19) "struct" | 16 | STRUCT_KW@[13; 19) "struct" |
@@ -25,7 +25,7 @@ SOURCE_FILE@[0; 250) | |||
25 | COLON@[23; 24) ":" | 25 | COLON@[23; 24) ":" |
26 | TYPE_BOUND_LIST@[24; 24) | 26 | TYPE_BOUND_LIST@[24; 24) |
27 | R_ANGLE@[24; 25) ">" | 27 | R_ANGLE@[24; 25) ">" |
28 | SEMI@[25; 26) ";" | 28 | SEMICOLON@[25; 26) ";" |
29 | WHITESPACE@[26; 27) "\n" | 29 | WHITESPACE@[26; 27) "\n" |
30 | STRUCT_DEF@[27; 43) | 30 | STRUCT_DEF@[27; 43) |
31 | STRUCT_KW@[27; 33) "struct" | 31 | STRUCT_KW@[27; 33) "struct" |
@@ -43,7 +43,7 @@ SOURCE_FILE@[0; 250) | |||
43 | TYPE_BOUND@[39; 41) | 43 | TYPE_BOUND@[39; 41) |
44 | LIFETIME@[39; 41) "\'a" | 44 | LIFETIME@[39; 41) "\'a" |
45 | R_ANGLE@[41; 42) ">" | 45 | R_ANGLE@[41; 42) ">" |
46 | SEMI@[42; 43) ";" | 46 | SEMICOLON@[42; 43) ";" |
47 | WHITESPACE@[43; 44) "\n" | 47 | WHITESPACE@[43; 44) "\n" |
48 | STRUCT_DEF@[44; 63) | 48 | STRUCT_DEF@[44; 63) |
49 | STRUCT_KW@[44; 50) "struct" | 49 | STRUCT_KW@[44; 50) "struct" |
@@ -64,7 +64,7 @@ SOURCE_FILE@[0; 250) | |||
64 | PLUS@[59; 60) "+" | 64 | PLUS@[59; 60) "+" |
65 | WHITESPACE@[60; 61) " " | 65 | WHITESPACE@[60; 61) " " |
66 | R_ANGLE@[61; 62) ">" | 66 | R_ANGLE@[61; 62) ">" |
67 | SEMI@[62; 63) ";" | 67 | SEMICOLON@[62; 63) ";" |
68 | WHITESPACE@[63; 64) "\n" | 68 | WHITESPACE@[63; 64) "\n" |
69 | STRUCT_DEF@[64; 86) | 69 | STRUCT_DEF@[64; 86) |
70 | STRUCT_KW@[64; 70) "struct" | 70 | STRUCT_KW@[64; 70) "struct" |
@@ -88,7 +88,7 @@ SOURCE_FILE@[0; 250) | |||
88 | LIFETIME@[81; 83) "\'d" | 88 | LIFETIME@[81; 83) "\'d" |
89 | WHITESPACE@[83; 84) " " | 89 | WHITESPACE@[83; 84) " " |
90 | R_ANGLE@[84; 85) ">" | 90 | R_ANGLE@[84; 85) ">" |
91 | SEMI@[85; 86) ";" | 91 | SEMICOLON@[85; 86) ";" |
92 | WHITESPACE@[86; 87) "\n" | 92 | WHITESPACE@[86; 87) "\n" |
93 | STRUCT_DEF@[87; 116) | 93 | STRUCT_DEF@[87; 116) |
94 | STRUCT_KW@[87; 93) "struct" | 94 | STRUCT_KW@[87; 93) "struct" |
@@ -120,7 +120,7 @@ SOURCE_FILE@[0; 250) | |||
120 | NAME_REF@[109; 114) | 120 | NAME_REF@[109; 114) |
121 | IDENT@[109; 114) "Clone" | 121 | IDENT@[109; 114) "Clone" |
122 | R_ANGLE@[114; 115) ">" | 122 | R_ANGLE@[114; 115) ">" |
123 | SEMI@[115; 116) ";" | 123 | SEMICOLON@[115; 116) ";" |
124 | WHITESPACE@[116; 117) "\n" | 124 | WHITESPACE@[116; 117) "\n" |
125 | STRUCT_DEF@[117; 143) | 125 | STRUCT_DEF@[117; 143) |
126 | STRUCT_KW@[117; 123) "struct" | 126 | STRUCT_KW@[117; 123) "struct" |
@@ -151,7 +151,7 @@ SOURCE_FILE@[0; 250) | |||
151 | NAME_REF@[137; 141) | 151 | NAME_REF@[137; 141) |
152 | IDENT@[137; 141) "Copy" | 152 | IDENT@[137; 141) "Copy" |
153 | R_ANGLE@[141; 142) ">" | 153 | R_ANGLE@[141; 142) ">" |
154 | SEMI@[142; 143) ";" | 154 | SEMICOLON@[142; 143) ";" |
155 | WHITESPACE@[143; 144) "\n" | 155 | WHITESPACE@[143; 144) "\n" |
156 | STRUCT_DEF@[144; 180) | 156 | STRUCT_DEF@[144; 180) |
157 | STRUCT_KW@[144; 150) "struct" | 157 | STRUCT_KW@[144; 150) "struct" |
@@ -170,7 +170,7 @@ SOURCE_FILE@[0; 250) | |||
170 | PATH_TYPE@[156; 161) | 170 | PATH_TYPE@[156; 161) |
171 | PATH@[156; 161) | 171 | PATH@[156; 161) |
172 | PATH_SEGMENT@[156; 161) | 172 | PATH_SEGMENT@[156; 161) |
173 | COLONCOLON@[156; 158) "::" | 173 | COLON2@[156; 158) "::" |
174 | NAME_REF@[158; 161) | 174 | NAME_REF@[158; 161) |
175 | IDENT@[158; 161) "Foo" | 175 | IDENT@[158; 161) "Foo" |
176 | WHITESPACE@[161; 162) " " | 176 | WHITESPACE@[161; 162) " " |
@@ -182,7 +182,7 @@ SOURCE_FILE@[0; 250) | |||
182 | PATH@[164; 168) | 182 | PATH@[164; 168) |
183 | PATH_SEGMENT@[164; 168) | 183 | PATH_SEGMENT@[164; 168) |
184 | SELF_KW@[164; 168) "self" | 184 | SELF_KW@[164; 168) "self" |
185 | COLONCOLON@[168; 170) "::" | 185 | COLON2@[168; 170) "::" |
186 | PATH_SEGMENT@[170; 173) | 186 | PATH_SEGMENT@[170; 173) |
187 | NAME_REF@[170; 173) | 187 | NAME_REF@[170; 173) |
188 | IDENT@[170; 173) "Bar" | 188 | IDENT@[170; 173) "Bar" |
@@ -192,7 +192,7 @@ SOURCE_FILE@[0; 250) | |||
192 | TYPE_BOUND@[176; 178) | 192 | TYPE_BOUND@[176; 178) |
193 | LIFETIME@[176; 178) "\'a" | 193 | LIFETIME@[176; 178) "\'a" |
194 | R_ANGLE@[178; 179) ">" | 194 | R_ANGLE@[178; 179) ">" |
195 | SEMI@[179; 180) ";" | 195 | SEMICOLON@[179; 180) ";" |
196 | WHITESPACE@[180; 181) "\n" | 196 | WHITESPACE@[180; 181) "\n" |
197 | STRUCT_DEF@[181; 199) | 197 | STRUCT_DEF@[181; 199) |
198 | STRUCT_KW@[181; 187) "struct" | 198 | STRUCT_KW@[181; 187) "struct" |
@@ -215,7 +215,7 @@ SOURCE_FILE@[0; 250) | |||
215 | TYPE_BOUND_LIST@[196; 196) | 215 | TYPE_BOUND_LIST@[196; 196) |
216 | COMMA@[196; 197) "," | 216 | COMMA@[196; 197) "," |
217 | R_ANGLE@[197; 198) ">" | 217 | R_ANGLE@[197; 198) ">" |
218 | SEMI@[198; 199) ";" | 218 | SEMICOLON@[198; 199) ";" |
219 | WHITESPACE@[199; 200) "\n" | 219 | WHITESPACE@[199; 200) "\n" |
220 | STRUCT_DEF@[200; 250) | 220 | STRUCT_DEF@[200; 250) |
221 | STRUCT_KW@[200; 206) "struct" | 221 | STRUCT_KW@[200; 206) "struct" |
@@ -265,4 +265,4 @@ SOURCE_FILE@[0; 250) | |||
265 | NAME_REF@[243; 248) | 265 | NAME_REF@[243; 248) |
266 | IDENT@[243; 248) "Clone" | 266 | IDENT@[243; 248) "Clone" |
267 | R_ANGLE@[248; 249) ">" | 267 | R_ANGLE@[248; 249) ">" |
268 | SEMI@[249; 250) ";" | 268 | SEMICOLON@[249; 250) ";" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0023_static_items.rast b/crates/ra_syntax/test_data/parser/ok/0023_static_items.rast index 5591f95eb..dadf24fa6 100644 --- a/crates/ra_syntax/test_data/parser/ok/0023_static_items.rast +++ b/crates/ra_syntax/test_data/parser/ok/0023_static_items.rast | |||
@@ -16,7 +16,7 @@ SOURCE_FILE@[0; 47) | |||
16 | WHITESPACE@[17; 18) " " | 16 | WHITESPACE@[17; 18) " " |
17 | LITERAL@[18; 19) | 17 | LITERAL@[18; 19) |
18 | INT_NUMBER@[18; 19) "1" | 18 | INT_NUMBER@[18; 19) "1" |
19 | SEMI@[19; 20) ";" | 19 | SEMICOLON@[19; 20) ";" |
20 | WHITESPACE@[20; 21) "\n" | 20 | WHITESPACE@[20; 21) "\n" |
21 | STATIC_DEF@[21; 46) | 21 | STATIC_DEF@[21; 46) |
22 | STATIC_KW@[21; 27) "static" | 22 | STATIC_KW@[21; 27) "static" |
@@ -37,5 +37,5 @@ SOURCE_FILE@[0; 47) | |||
37 | WHITESPACE@[42; 43) " " | 37 | WHITESPACE@[42; 43) " " |
38 | LITERAL@[43; 45) | 38 | LITERAL@[43; 45) |
39 | INT_NUMBER@[43; 45) "92" | 39 | INT_NUMBER@[43; 45) "92" |
40 | SEMI@[45; 46) ";" | 40 | SEMICOLON@[45; 46) ";" |
41 | WHITESPACE@[46; 47) "\n" | 41 | WHITESPACE@[46; 47) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0024_const_item.rast b/crates/ra_syntax/test_data/parser/ok/0024_const_item.rast index abe9f851b..262e31f7f 100644 --- a/crates/ra_syntax/test_data/parser/ok/0024_const_item.rast +++ b/crates/ra_syntax/test_data/parser/ok/0024_const_item.rast | |||
@@ -15,7 +15,7 @@ SOURCE_FILE@[0; 64) | |||
15 | WHITESPACE@[14; 15) " " | 15 | WHITESPACE@[14; 15) " " |
16 | LITERAL@[15; 16) | 16 | LITERAL@[15; 16) |
17 | INT_NUMBER@[15; 16) "0" | 17 | INT_NUMBER@[15; 16) "0" |
18 | SEMI@[16; 17) ";" | 18 | SEMICOLON@[16; 17) ";" |
19 | WHITESPACE@[17; 18) "\n" | 19 | WHITESPACE@[17; 18) "\n" |
20 | CONST_DEF@[18; 38) | 20 | CONST_DEF@[18; 38) |
21 | CONST_KW@[18; 23) "const" | 21 | CONST_KW@[18; 23) "const" |
@@ -34,7 +34,7 @@ SOURCE_FILE@[0; 64) | |||
34 | WHITESPACE@[34; 35) " " | 34 | WHITESPACE@[34; 35) " " |
35 | LITERAL@[35; 37) | 35 | LITERAL@[35; 37) |
36 | INT_NUMBER@[35; 37) "92" | 36 | INT_NUMBER@[35; 37) "92" |
37 | SEMI@[37; 38) ";" | 37 | SEMICOLON@[37; 38) ";" |
38 | WHITESPACE@[38; 39) "\n" | 38 | WHITESPACE@[38; 39) "\n" |
39 | CONST_DEF@[39; 63) | 39 | CONST_DEF@[39; 63) |
40 | CONST_KW@[39; 44) "const" | 40 | CONST_KW@[39; 44) "const" |
@@ -55,5 +55,5 @@ SOURCE_FILE@[0; 64) | |||
55 | WHITESPACE@[59; 60) " " | 55 | WHITESPACE@[59; 60) " " |
56 | LITERAL@[60; 62) | 56 | LITERAL@[60; 62) |
57 | INT_NUMBER@[60; 62) "62" | 57 | INT_NUMBER@[60; 62) "62" |
58 | SEMI@[62; 63) ";" | 58 | SEMICOLON@[62; 63) ";" |
59 | WHITESPACE@[63; 64) "\n" | 59 | WHITESPACE@[63; 64) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0028_operator_binding_power.rast b/crates/ra_syntax/test_data/parser/ok/0028_operator_binding_power.rast index afca1fba2..5542f7701 100644 --- a/crates/ra_syntax/test_data/parser/ok/0028_operator_binding_power.rast +++ b/crates/ra_syntax/test_data/parser/ok/0028_operator_binding_power.rast | |||
@@ -53,7 +53,7 @@ SOURCE_FILE@[0; 248) | |||
53 | WHITESPACE@[52; 53) " " | 53 | WHITESPACE@[52; 53) " " |
54 | LITERAL@[53; 54) | 54 | LITERAL@[53; 54) |
55 | INT_NUMBER@[53; 54) "6" | 55 | INT_NUMBER@[53; 54) "6" |
56 | SEMI@[54; 55) ";" | 56 | SEMICOLON@[54; 55) ";" |
57 | WHITESPACE@[55; 60) "\n " | 57 | WHITESPACE@[55; 60) "\n " |
58 | EXPR_STMT@[60; 70) | 58 | EXPR_STMT@[60; 70) |
59 | BIN_EXPR@[60; 69) | 59 | BIN_EXPR@[60; 69) |
@@ -70,7 +70,7 @@ SOURCE_FILE@[0; 248) | |||
70 | WHITESPACE@[67; 68) " " | 70 | WHITESPACE@[67; 68) " " |
71 | LITERAL@[68; 69) | 71 | LITERAL@[68; 69) |
72 | INT_NUMBER@[68; 69) "3" | 72 | INT_NUMBER@[68; 69) "3" |
73 | SEMI@[69; 70) ";" | 73 | SEMICOLON@[69; 70) ";" |
74 | WHITESPACE@[70; 75) "\n " | 74 | WHITESPACE@[70; 75) "\n " |
75 | EXPR_STMT@[75; 86) | 75 | EXPR_STMT@[75; 86) |
76 | BIN_EXPR@[75; 85) | 76 | BIN_EXPR@[75; 85) |
@@ -87,7 +87,7 @@ SOURCE_FILE@[0; 248) | |||
87 | WHITESPACE@[83; 84) " " | 87 | WHITESPACE@[83; 84) " " |
88 | LITERAL@[84; 85) | 88 | LITERAL@[84; 85) |
89 | INT_NUMBER@[84; 85) "3" | 89 | INT_NUMBER@[84; 85) "3" |
90 | SEMI@[85; 86) ";" | 90 | SEMICOLON@[85; 86) ";" |
91 | WHITESPACE@[86; 91) "\n " | 91 | WHITESPACE@[86; 91) "\n " |
92 | EXPR_STMT@[91; 102) | 92 | EXPR_STMT@[91; 102) |
93 | BIN_EXPR@[91; 101) | 93 | BIN_EXPR@[91; 101) |
@@ -104,7 +104,7 @@ SOURCE_FILE@[0; 248) | |||
104 | WHITESPACE@[99; 100) " " | 104 | WHITESPACE@[99; 100) " " |
105 | LITERAL@[100; 101) | 105 | LITERAL@[100; 101) |
106 | INT_NUMBER@[100; 101) "3" | 106 | INT_NUMBER@[100; 101) "3" |
107 | SEMI@[101; 102) ";" | 107 | SEMICOLON@[101; 102) ";" |
108 | WHITESPACE@[102; 107) "\n " | 108 | WHITESPACE@[102; 107) "\n " |
109 | EXPR_STMT@[107; 117) | 109 | EXPR_STMT@[107; 117) |
110 | BIN_EXPR@[107; 116) | 110 | BIN_EXPR@[107; 116) |
@@ -121,7 +121,7 @@ SOURCE_FILE@[0; 248) | |||
121 | WHITESPACE@[114; 115) " " | 121 | WHITESPACE@[114; 115) " " |
122 | LITERAL@[115; 116) | 122 | LITERAL@[115; 116) |
123 | INT_NUMBER@[115; 116) "3" | 123 | INT_NUMBER@[115; 116) "3" |
124 | SEMI@[116; 117) ";" | 124 | SEMICOLON@[116; 117) ";" |
125 | WHITESPACE@[117; 122) "\n " | 125 | WHITESPACE@[117; 122) "\n " |
126 | EXPR_STMT@[122; 132) | 126 | EXPR_STMT@[122; 132) |
127 | BIN_EXPR@[122; 131) | 127 | BIN_EXPR@[122; 131) |
@@ -138,14 +138,14 @@ SOURCE_FILE@[0; 248) | |||
138 | WHITESPACE@[129; 130) " " | 138 | WHITESPACE@[129; 130) " " |
139 | LITERAL@[130; 131) | 139 | LITERAL@[130; 131) |
140 | INT_NUMBER@[130; 131) "3" | 140 | INT_NUMBER@[130; 131) "3" |
141 | SEMI@[131; 132) ";" | 141 | SEMICOLON@[131; 132) ";" |
142 | WHITESPACE@[132; 137) "\n " | 142 | WHITESPACE@[132; 137) "\n " |
143 | EXPR_STMT@[137; 148) | 143 | EXPR_STMT@[137; 148) |
144 | BIN_EXPR@[137; 147) | 144 | BIN_EXPR@[137; 147) |
145 | LITERAL@[137; 138) | 145 | LITERAL@[137; 138) |
146 | INT_NUMBER@[137; 138) "1" | 146 | INT_NUMBER@[137; 138) "1" |
147 | WHITESPACE@[138; 139) " " | 147 | WHITESPACE@[138; 139) " " |
148 | EQEQ@[139; 141) "==" | 148 | EQ2@[139; 141) "==" |
149 | WHITESPACE@[141; 142) " " | 149 | WHITESPACE@[141; 142) " " |
150 | BIN_EXPR@[142; 147) | 150 | BIN_EXPR@[142; 147) |
151 | LITERAL@[142; 143) | 151 | LITERAL@[142; 143) |
@@ -155,24 +155,24 @@ SOURCE_FILE@[0; 248) | |||
155 | WHITESPACE@[145; 146) " " | 155 | WHITESPACE@[145; 146) " " |
156 | LITERAL@[146; 147) | 156 | LITERAL@[146; 147) |
157 | INT_NUMBER@[146; 147) "3" | 157 | INT_NUMBER@[146; 147) "3" |
158 | SEMI@[147; 148) ";" | 158 | SEMICOLON@[147; 148) ";" |
159 | WHITESPACE@[148; 153) "\n " | 159 | WHITESPACE@[148; 153) "\n " |
160 | EXPR_STMT@[153; 165) | 160 | EXPR_STMT@[153; 165) |
161 | BIN_EXPR@[153; 164) | 161 | BIN_EXPR@[153; 164) |
162 | LITERAL@[153; 154) | 162 | LITERAL@[153; 154) |
163 | INT_NUMBER@[153; 154) "1" | 163 | INT_NUMBER@[153; 154) "1" |
164 | WHITESPACE@[154; 155) " " | 164 | WHITESPACE@[154; 155) " " |
165 | AMPAMP@[155; 157) "&&" | 165 | AMP2@[155; 157) "&&" |
166 | WHITESPACE@[157; 158) " " | 166 | WHITESPACE@[157; 158) " " |
167 | BIN_EXPR@[158; 164) | 167 | BIN_EXPR@[158; 164) |
168 | LITERAL@[158; 159) | 168 | LITERAL@[158; 159) |
169 | INT_NUMBER@[158; 159) "2" | 169 | INT_NUMBER@[158; 159) "2" |
170 | WHITESPACE@[159; 160) " " | 170 | WHITESPACE@[159; 160) " " |
171 | EQEQ@[160; 162) "==" | 171 | EQ2@[160; 162) "==" |
172 | WHITESPACE@[162; 163) " " | 172 | WHITESPACE@[162; 163) " " |
173 | LITERAL@[163; 164) | 173 | LITERAL@[163; 164) |
174 | INT_NUMBER@[163; 164) "3" | 174 | INT_NUMBER@[163; 164) "3" |
175 | SEMI@[164; 165) ";" | 175 | SEMICOLON@[164; 165) ";" |
176 | WHITESPACE@[165; 170) "\n " | 176 | WHITESPACE@[165; 170) "\n " |
177 | COMMENT@[170; 184) "//1 || 2 && 2;" | 177 | COMMENT@[170; 184) "//1 || 2 && 2;" |
178 | WHITESPACE@[184; 189) "\n " | 178 | WHITESPACE@[184; 189) "\n " |
diff --git a/crates/ra_syntax/test_data/parser/ok/0029_range_forms.rast b/crates/ra_syntax/test_data/parser/ok/0029_range_forms.rast index 95dae4870..78056aa95 100644 --- a/crates/ra_syntax/test_data/parser/ok/0029_range_forms.rast +++ b/crates/ra_syntax/test_data/parser/ok/0029_range_forms.rast | |||
@@ -14,7 +14,7 @@ SOURCE_FILE@[0; 153) | |||
14 | WHITESPACE@[10; 15) "\n " | 14 | WHITESPACE@[10; 15) "\n " |
15 | EXPR_STMT@[15; 23) | 15 | EXPR_STMT@[15; 23) |
16 | RANGE_EXPR@[15; 22) | 16 | RANGE_EXPR@[15; 22) |
17 | DOTDOT@[15; 17) ".." | 17 | DOT2@[15; 17) ".." |
18 | BIN_EXPR@[17; 22) | 18 | BIN_EXPR@[17; 22) |
19 | LITERAL@[17; 18) | 19 | LITERAL@[17; 18) |
20 | INT_NUMBER@[17; 18) "1" | 20 | INT_NUMBER@[17; 18) "1" |
@@ -23,12 +23,12 @@ SOURCE_FILE@[0; 153) | |||
23 | WHITESPACE@[20; 21) " " | 23 | WHITESPACE@[20; 21) " " |
24 | LITERAL@[21; 22) | 24 | LITERAL@[21; 22) |
25 | INT_NUMBER@[21; 22) "1" | 25 | INT_NUMBER@[21; 22) "1" |
26 | SEMI@[22; 23) ";" | 26 | SEMICOLON@[22; 23) ";" |
27 | WHITESPACE@[23; 28) "\n " | 27 | WHITESPACE@[23; 28) "\n " |
28 | EXPR_STMT@[28; 36) | 28 | EXPR_STMT@[28; 36) |
29 | BIN_EXPR@[28; 35) | 29 | BIN_EXPR@[28; 35) |
30 | RANGE_EXPR@[28; 31) | 30 | RANGE_EXPR@[28; 31) |
31 | DOTDOT@[28; 30) ".." | 31 | DOT2@[28; 30) ".." |
32 | PATH_EXPR@[30; 31) | 32 | PATH_EXPR@[30; 31) |
33 | PATH@[30; 31) | 33 | PATH@[30; 31) |
34 | PATH_SEGMENT@[30; 31) | 34 | PATH_SEGMENT@[30; 31) |
@@ -39,7 +39,7 @@ SOURCE_FILE@[0; 153) | |||
39 | WHITESPACE@[33; 34) " " | 39 | WHITESPACE@[33; 34) " " |
40 | LITERAL@[34; 35) | 40 | LITERAL@[34; 35) |
41 | INT_NUMBER@[34; 35) "2" | 41 | INT_NUMBER@[34; 35) "2" |
42 | SEMI@[35; 36) ";" | 42 | SEMICOLON@[35; 36) ";" |
43 | WHITESPACE@[36; 41) "\n " | 43 | WHITESPACE@[36; 41) "\n " |
44 | EXPR_STMT@[41; 59) | 44 | EXPR_STMT@[41; 59) |
45 | BIN_EXPR@[41; 58) | 45 | BIN_EXPR@[41; 58) |
@@ -54,16 +54,16 @@ SOURCE_FILE@[0; 153) | |||
54 | RANGE_EXPR@[45; 58) | 54 | RANGE_EXPR@[45; 58) |
55 | LITERAL@[45; 50) | 55 | LITERAL@[45; 50) |
56 | FALSE_KW@[45; 50) "false" | 56 | FALSE_KW@[45; 50) "false" |
57 | DOTDOT@[50; 52) ".." | 57 | DOT2@[50; 52) ".." |
58 | BIN_EXPR@[52; 58) | 58 | BIN_EXPR@[52; 58) |
59 | LITERAL@[52; 53) | 59 | LITERAL@[52; 53) |
60 | INT_NUMBER@[52; 53) "1" | 60 | INT_NUMBER@[52; 53) "1" |
61 | WHITESPACE@[53; 54) " " | 61 | WHITESPACE@[53; 54) " " |
62 | EQEQ@[54; 56) "==" | 62 | EQ2@[54; 56) "==" |
63 | WHITESPACE@[56; 57) " " | 63 | WHITESPACE@[56; 57) " " |
64 | LITERAL@[57; 58) | 64 | LITERAL@[57; 58) |
65 | INT_NUMBER@[57; 58) "1" | 65 | INT_NUMBER@[57; 58) "1" |
66 | SEMI@[58; 59) ";" | 66 | SEMICOLON@[58; 59) ";" |
67 | WHITESPACE@[59; 64) "\n " | 67 | WHITESPACE@[59; 64) "\n " |
68 | LET_STMT@[64; 76) | 68 | LET_STMT@[64; 76) |
69 | LET_KW@[64; 67) "let" | 69 | LET_KW@[64; 67) "let" |
@@ -77,12 +77,12 @@ SOURCE_FILE@[0; 153) | |||
77 | RANGE_EXPR@[72; 75) | 77 | RANGE_EXPR@[72; 75) |
78 | LITERAL@[72; 73) | 78 | LITERAL@[72; 73) |
79 | INT_NUMBER@[72; 73) "1" | 79 | INT_NUMBER@[72; 73) "1" |
80 | DOTDOT@[73; 75) ".." | 80 | DOT2@[73; 75) ".." |
81 | SEMI@[75; 76) ";" | 81 | SEMICOLON@[75; 76) ";" |
82 | WHITESPACE@[76; 86) "\n \n " | 82 | WHITESPACE@[76; 86) "\n \n " |
83 | EXPR_STMT@[86; 95) | 83 | EXPR_STMT@[86; 95) |
84 | RANGE_EXPR@[86; 94) | 84 | RANGE_EXPR@[86; 94) |
85 | DOTDOTEQ@[86; 89) "..=" | 85 | DOT2EQ@[86; 89) "..=" |
86 | BIN_EXPR@[89; 94) | 86 | BIN_EXPR@[89; 94) |
87 | LITERAL@[89; 90) | 87 | LITERAL@[89; 90) |
88 | INT_NUMBER@[89; 90) "1" | 88 | INT_NUMBER@[89; 90) "1" |
@@ -91,12 +91,12 @@ SOURCE_FILE@[0; 153) | |||
91 | WHITESPACE@[92; 93) " " | 91 | WHITESPACE@[92; 93) " " |
92 | LITERAL@[93; 94) | 92 | LITERAL@[93; 94) |
93 | INT_NUMBER@[93; 94) "1" | 93 | INT_NUMBER@[93; 94) "1" |
94 | SEMI@[94; 95) ";" | 94 | SEMICOLON@[94; 95) ";" |
95 | WHITESPACE@[95; 100) "\n " | 95 | WHITESPACE@[95; 100) "\n " |
96 | EXPR_STMT@[100; 109) | 96 | EXPR_STMT@[100; 109) |
97 | BIN_EXPR@[100; 108) | 97 | BIN_EXPR@[100; 108) |
98 | RANGE_EXPR@[100; 104) | 98 | RANGE_EXPR@[100; 104) |
99 | DOTDOTEQ@[100; 103) "..=" | 99 | DOT2EQ@[100; 103) "..=" |
100 | PATH_EXPR@[103; 104) | 100 | PATH_EXPR@[103; 104) |
101 | PATH@[103; 104) | 101 | PATH@[103; 104) |
102 | PATH_SEGMENT@[103; 104) | 102 | PATH_SEGMENT@[103; 104) |
@@ -107,7 +107,7 @@ SOURCE_FILE@[0; 153) | |||
107 | WHITESPACE@[106; 107) " " | 107 | WHITESPACE@[106; 107) " " |
108 | LITERAL@[107; 108) | 108 | LITERAL@[107; 108) |
109 | INT_NUMBER@[107; 108) "2" | 109 | INT_NUMBER@[107; 108) "2" |
110 | SEMI@[108; 109) ";" | 110 | SEMICOLON@[108; 109) ";" |
111 | WHITESPACE@[109; 114) "\n " | 111 | WHITESPACE@[109; 114) "\n " |
112 | EXPR_STMT@[114; 133) | 112 | EXPR_STMT@[114; 133) |
113 | BIN_EXPR@[114; 132) | 113 | BIN_EXPR@[114; 132) |
@@ -122,16 +122,16 @@ SOURCE_FILE@[0; 153) | |||
122 | RANGE_EXPR@[118; 132) | 122 | RANGE_EXPR@[118; 132) |
123 | LITERAL@[118; 123) | 123 | LITERAL@[118; 123) |
124 | FALSE_KW@[118; 123) "false" | 124 | FALSE_KW@[118; 123) "false" |
125 | DOTDOTEQ@[123; 126) "..=" | 125 | DOT2EQ@[123; 126) "..=" |
126 | BIN_EXPR@[126; 132) | 126 | BIN_EXPR@[126; 132) |
127 | LITERAL@[126; 127) | 127 | LITERAL@[126; 127) |
128 | INT_NUMBER@[126; 127) "1" | 128 | INT_NUMBER@[126; 127) "1" |
129 | WHITESPACE@[127; 128) " " | 129 | WHITESPACE@[127; 128) " " |
130 | EQEQ@[128; 130) "==" | 130 | EQ2@[128; 130) "==" |
131 | WHITESPACE@[130; 131) " " | 131 | WHITESPACE@[130; 131) " " |
132 | LITERAL@[131; 132) | 132 | LITERAL@[131; 132) |
133 | INT_NUMBER@[131; 132) "1" | 133 | INT_NUMBER@[131; 132) "1" |
134 | SEMI@[132; 133) ";" | 134 | SEMICOLON@[132; 133) ";" |
135 | WHITESPACE@[133; 138) "\n " | 135 | WHITESPACE@[133; 138) "\n " |
136 | LET_STMT@[138; 150) | 136 | LET_STMT@[138; 150) |
137 | LET_KW@[138; 141) "let" | 137 | LET_KW@[138; 141) "let" |
@@ -145,8 +145,8 @@ SOURCE_FILE@[0; 153) | |||
145 | RANGE_EXPR@[146; 149) | 145 | RANGE_EXPR@[146; 149) |
146 | LITERAL@[146; 147) | 146 | LITERAL@[146; 147) |
147 | INT_NUMBER@[146; 147) "1" | 147 | INT_NUMBER@[146; 147) "1" |
148 | DOTDOT@[147; 149) ".." | 148 | DOT2@[147; 149) ".." |
149 | SEMI@[149; 150) ";" | 149 | SEMICOLON@[149; 150) ";" |
150 | WHITESPACE@[150; 151) "\n" | 150 | WHITESPACE@[150; 151) "\n" |
151 | R_CURLY@[151; 152) "}" | 151 | R_CURLY@[151; 152) "}" |
152 | WHITESPACE@[152; 153) "\n" | 152 | WHITESPACE@[152; 153) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0030_string_suffixes.rast b/crates/ra_syntax/test_data/parser/ok/0030_string_suffixes.rast index cdc9f05ae..4e583c6e8 100644 --- a/crates/ra_syntax/test_data/parser/ok/0030_string_suffixes.rast +++ b/crates/ra_syntax/test_data/parser/ok/0030_string_suffixes.rast | |||
@@ -22,7 +22,7 @@ SOURCE_FILE@[0; 112) | |||
22 | WHITESPACE@[23; 24) " " | 22 | WHITESPACE@[23; 24) " " |
23 | LITERAL@[24; 30) | 23 | LITERAL@[24; 30) |
24 | CHAR@[24; 30) "\'c\'u32" | 24 | CHAR@[24; 30) "\'c\'u32" |
25 | SEMI@[30; 31) ";" | 25 | SEMICOLON@[30; 31) ";" |
26 | WHITESPACE@[31; 36) "\n " | 26 | WHITESPACE@[31; 36) "\n " |
27 | LET_STMT@[36; 60) | 27 | LET_STMT@[36; 60) |
28 | LET_KW@[36; 39) "let" | 28 | LET_KW@[36; 39) "let" |
@@ -34,7 +34,7 @@ SOURCE_FILE@[0; 112) | |||
34 | WHITESPACE@[43; 44) " " | 34 | WHITESPACE@[43; 44) " " |
35 | LITERAL@[44; 59) | 35 | LITERAL@[44; 59) |
36 | STRING@[44; 59) "\"string\"invalid" | 36 | STRING@[44; 59) "\"string\"invalid" |
37 | SEMI@[59; 60) ";" | 37 | SEMICOLON@[59; 60) ";" |
38 | WHITESPACE@[60; 65) "\n " | 38 | WHITESPACE@[60; 65) "\n " |
39 | LET_STMT@[65; 83) | 39 | LET_STMT@[65; 83) |
40 | LET_KW@[65; 68) "let" | 40 | LET_KW@[65; 68) "let" |
@@ -46,7 +46,7 @@ SOURCE_FILE@[0; 112) | |||
46 | WHITESPACE@[72; 73) " " | 46 | WHITESPACE@[72; 73) " " |
47 | LITERAL@[73; 82) | 47 | LITERAL@[73; 82) |
48 | BYTE@[73; 82) "b\'b\'_suff" | 48 | BYTE@[73; 82) "b\'b\'_suff" |
49 | SEMI@[82; 83) ";" | 49 | SEMICOLON@[82; 83) ";" |
50 | WHITESPACE@[83; 88) "\n " | 50 | WHITESPACE@[83; 88) "\n " |
51 | LET_STMT@[88; 109) | 51 | LET_STMT@[88; 109) |
52 | LET_KW@[88; 91) "let" | 52 | LET_KW@[88; 91) "let" |
@@ -58,7 +58,7 @@ SOURCE_FILE@[0; 112) | |||
58 | WHITESPACE@[95; 96) " " | 58 | WHITESPACE@[95; 96) " " |
59 | LITERAL@[96; 108) | 59 | LITERAL@[96; 108) |
60 | BYTE_STRING@[96; 108) "b\"bs\"invalid" | 60 | BYTE_STRING@[96; 108) "b\"bs\"invalid" |
61 | SEMI@[108; 109) ";" | 61 | SEMICOLON@[108; 109) ";" |
62 | WHITESPACE@[109; 110) "\n" | 62 | WHITESPACE@[109; 110) "\n" |
63 | R_CURLY@[110; 111) "}" | 63 | R_CURLY@[110; 111) "}" |
64 | WHITESPACE@[111; 112) "\n" | 64 | WHITESPACE@[111; 112) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0030_traits.rast b/crates/ra_syntax/test_data/parser/ok/0030_traits.rast index ac314ae50..4131cd81a 100644 --- a/crates/ra_syntax/test_data/parser/ok/0030_traits.rast +++ b/crates/ra_syntax/test_data/parser/ok/0030_traits.rast | |||
@@ -16,7 +16,7 @@ SOURCE_FILE@[0; 96) | |||
16 | PARAM_LIST@[31; 33) | 16 | PARAM_LIST@[31; 33) |
17 | L_PAREN@[31; 32) "(" | 17 | L_PAREN@[31; 32) "(" |
18 | R_PAREN@[32; 33) ")" | 18 | R_PAREN@[32; 33) ")" |
19 | SEMI@[33; 34) ";" | 19 | SEMICOLON@[33; 34) ";" |
20 | WHITESPACE@[34; 35) "\n" | 20 | WHITESPACE@[34; 35) "\n" |
21 | R_CURLY@[35; 36) "}" | 21 | R_CURLY@[35; 36) "}" |
22 | WHITESPACE@[36; 38) "\n\n" | 22 | WHITESPACE@[36; 38) "\n\n" |
@@ -49,13 +49,13 @@ SOURCE_FILE@[0; 96) | |||
49 | PATH_SEGMENT@[84; 87) | 49 | PATH_SEGMENT@[84; 87) |
50 | NAME_REF@[84; 87) | 50 | NAME_REF@[84; 87) |
51 | IDENT@[84; 87) "i32" | 51 | IDENT@[84; 87) "i32" |
52 | SEMI@[87; 88) ";" | 52 | SEMICOLON@[87; 88) ";" |
53 | WHITESPACE@[88; 89) " " | 53 | WHITESPACE@[88; 89) " " |
54 | LITERAL@[89; 90) | 54 | LITERAL@[89; 90) |
55 | INT_NUMBER@[89; 90) "1" | 55 | INT_NUMBER@[89; 90) "1" |
56 | R_BRACK@[90; 91) "]" | 56 | R_BRACK@[90; 91) "]" |
57 | R_PAREN@[91; 92) ")" | 57 | R_PAREN@[91; 92) ")" |
58 | SEMI@[92; 93) ";" | 58 | SEMICOLON@[92; 93) ";" |
59 | WHITESPACE@[93; 94) "\n" | 59 | WHITESPACE@[93; 94) "\n" |
60 | R_CURLY@[94; 95) "}" | 60 | R_CURLY@[94; 95) "}" |
61 | WHITESPACE@[95; 96) "\n" | 61 | WHITESPACE@[95; 96) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0031_extern.rast b/crates/ra_syntax/test_data/parser/ok/0031_extern.rast index badbf76c5..23757df52 100644 --- a/crates/ra_syntax/test_data/parser/ok/0031_extern.rast +++ b/crates/ra_syntax/test_data/parser/ok/0031_extern.rast | |||
@@ -25,7 +25,7 @@ SOURCE_FILE@[0; 1598) | |||
25 | PATH_TYPE@[35; 42) | 25 | PATH_TYPE@[35; 42) |
26 | PATH@[35; 42) | 26 | PATH@[35; 42) |
27 | PATH_SEGMENT@[35; 42) | 27 | PATH_SEGMENT@[35; 42) |
28 | COLONCOLON@[35; 37) "::" | 28 | COLON2@[35; 37) "::" |
29 | NAME_REF@[37; 42) | 29 | NAME_REF@[37; 42) |
30 | IDENT@[37; 42) "c_int" | 30 | IDENT@[37; 42) "c_int" |
31 | COMMA@[42; 43) "," | 31 | COMMA@[42; 43) "," |
@@ -39,7 +39,7 @@ SOURCE_FILE@[0; 1598) | |||
39 | PATH_TYPE@[48; 55) | 39 | PATH_TYPE@[48; 55) |
40 | PATH@[48; 55) | 40 | PATH@[48; 55) |
41 | PATH_SEGMENT@[48; 55) | 41 | PATH_SEGMENT@[48; 55) |
42 | COLONCOLON@[48; 50) "::" | 42 | COLON2@[48; 50) "::" |
43 | NAME_REF@[50; 55) | 43 | NAME_REF@[50; 55) |
44 | IDENT@[50; 55) "c_int" | 44 | IDENT@[50; 55) "c_int" |
45 | COMMA@[55; 56) "," | 45 | COMMA@[55; 56) "," |
@@ -53,7 +53,7 @@ SOURCE_FILE@[0; 1598) | |||
53 | PATH_TYPE@[67; 74) | 53 | PATH_TYPE@[67; 74) |
54 | PATH@[67; 74) | 54 | PATH@[67; 74) |
55 | PATH_SEGMENT@[67; 74) | 55 | PATH_SEGMENT@[67; 74) |
56 | COLONCOLON@[67; 69) "::" | 56 | COLON2@[67; 69) "::" |
57 | NAME_REF@[69; 74) | 57 | NAME_REF@[69; 74) |
58 | IDENT@[69; 74) "c_int" | 58 | IDENT@[69; 74) "c_int" |
59 | R_PAREN@[74; 75) ")" | 59 | R_PAREN@[74; 75) ")" |
@@ -64,10 +64,10 @@ SOURCE_FILE@[0; 1598) | |||
64 | PATH_TYPE@[79; 86) | 64 | PATH_TYPE@[79; 86) |
65 | PATH@[79; 86) | 65 | PATH@[79; 86) |
66 | PATH_SEGMENT@[79; 86) | 66 | PATH_SEGMENT@[79; 86) |
67 | COLONCOLON@[79; 81) "::" | 67 | COLON2@[79; 81) "::" |
68 | NAME_REF@[81; 86) | 68 | NAME_REF@[81; 86) |
69 | IDENT@[81; 86) "c_int" | 69 | IDENT@[81; 86) "c_int" |
70 | SEMI@[86; 87) ";" | 70 | SEMICOLON@[86; 87) ";" |
71 | WHITESPACE@[87; 92) "\n " | 71 | WHITESPACE@[87; 92) "\n " |
72 | FN_DEF@[92; 167) | 72 | FN_DEF@[92; 167) |
73 | VISIBILITY@[92; 95) | 73 | VISIBILITY@[92; 95) |
@@ -88,7 +88,7 @@ SOURCE_FILE@[0; 1598) | |||
88 | PATH_TYPE@[108; 115) | 88 | PATH_TYPE@[108; 115) |
89 | PATH@[108; 115) | 89 | PATH@[108; 115) |
90 | PATH_SEGMENT@[108; 115) | 90 | PATH_SEGMENT@[108; 115) |
91 | COLONCOLON@[108; 110) "::" | 91 | COLON2@[108; 110) "::" |
92 | NAME_REF@[110; 115) | 92 | NAME_REF@[110; 115) |
93 | IDENT@[110; 115) "c_int" | 93 | IDENT@[110; 115) "c_int" |
94 | COMMA@[115; 116) "," | 94 | COMMA@[115; 116) "," |
@@ -129,10 +129,10 @@ SOURCE_FILE@[0; 1598) | |||
129 | PATH_TYPE@[159; 166) | 129 | PATH_TYPE@[159; 166) |
130 | PATH@[159; 166) | 130 | PATH@[159; 166) |
131 | PATH_SEGMENT@[159; 166) | 131 | PATH_SEGMENT@[159; 166) |
132 | COLONCOLON@[159; 161) "::" | 132 | COLON2@[159; 161) "::" |
133 | NAME_REF@[161; 166) | 133 | NAME_REF@[161; 166) |
134 | IDENT@[161; 166) "c_int" | 134 | IDENT@[161; 166) "c_int" |
135 | SEMI@[166; 167) ";" | 135 | SEMICOLON@[166; 167) ";" |
136 | WHITESPACE@[167; 172) "\n " | 136 | WHITESPACE@[167; 172) "\n " |
137 | FN_DEF@[172; 276) | 137 | FN_DEF@[172; 276) |
138 | VISIBILITY@[172; 175) | 138 | VISIBILITY@[172; 175) |
@@ -153,7 +153,7 @@ SOURCE_FILE@[0; 1598) | |||
153 | PATH_TYPE@[195; 202) | 153 | PATH_TYPE@[195; 202) |
154 | PATH@[195; 202) | 154 | PATH@[195; 202) |
155 | PATH_SEGMENT@[195; 202) | 155 | PATH_SEGMENT@[195; 202) |
156 | COLONCOLON@[195; 197) "::" | 156 | COLON2@[195; 197) "::" |
157 | NAME_REF@[197; 202) | 157 | NAME_REF@[197; 202) |
158 | IDENT@[197; 202) "c_int" | 158 | IDENT@[197; 202) "c_int" |
159 | COMMA@[202; 203) "," | 159 | COMMA@[202; 203) "," |
@@ -194,10 +194,10 @@ SOURCE_FILE@[0; 1598) | |||
194 | PATH_TYPE@[268; 275) | 194 | PATH_TYPE@[268; 275) |
195 | PATH@[268; 275) | 195 | PATH@[268; 275) |
196 | PATH_SEGMENT@[268; 275) | 196 | PATH_SEGMENT@[268; 275) |
197 | COLONCOLON@[268; 270) "::" | 197 | COLON2@[268; 270) "::" |
198 | NAME_REF@[270; 275) | 198 | NAME_REF@[270; 275) |
199 | IDENT@[270; 275) "c_int" | 199 | IDENT@[270; 275) "c_int" |
200 | SEMI@[275; 276) ";" | 200 | SEMICOLON@[275; 276) ";" |
201 | WHITESPACE@[276; 281) "\n " | 201 | WHITESPACE@[276; 281) "\n " |
202 | FN_DEF@[281; 341) | 202 | FN_DEF@[281; 341) |
203 | VISIBILITY@[281; 284) | 203 | VISIBILITY@[281; 284) |
@@ -218,7 +218,7 @@ SOURCE_FILE@[0; 1598) | |||
218 | PATH_TYPE@[303; 310) | 218 | PATH_TYPE@[303; 310) |
219 | PATH@[303; 310) | 219 | PATH@[303; 310) |
220 | PATH_SEGMENT@[303; 310) | 220 | PATH_SEGMENT@[303; 310) |
221 | COLONCOLON@[303; 305) "::" | 221 | COLON2@[303; 305) "::" |
222 | NAME_REF@[305; 310) | 222 | NAME_REF@[305; 310) |
223 | IDENT@[305; 310) "c_int" | 223 | IDENT@[305; 310) "c_int" |
224 | COMMA@[310; 311) "," | 224 | COMMA@[310; 311) "," |
@@ -232,7 +232,7 @@ SOURCE_FILE@[0; 1598) | |||
232 | PATH_TYPE@[321; 328) | 232 | PATH_TYPE@[321; 328) |
233 | PATH@[321; 328) | 233 | PATH@[321; 328) |
234 | PATH_SEGMENT@[321; 328) | 234 | PATH_SEGMENT@[321; 328) |
235 | COLONCOLON@[321; 323) "::" | 235 | COLON2@[321; 323) "::" |
236 | NAME_REF@[323; 328) | 236 | NAME_REF@[323; 328) |
237 | IDENT@[323; 328) "c_int" | 237 | IDENT@[323; 328) "c_int" |
238 | R_PAREN@[328; 329) ")" | 238 | R_PAREN@[328; 329) ")" |
@@ -243,10 +243,10 @@ SOURCE_FILE@[0; 1598) | |||
243 | PATH_TYPE@[333; 340) | 243 | PATH_TYPE@[333; 340) |
244 | PATH@[333; 340) | 244 | PATH@[333; 340) |
245 | PATH_SEGMENT@[333; 340) | 245 | PATH_SEGMENT@[333; 340) |
246 | COLONCOLON@[333; 335) "::" | 246 | COLON2@[333; 335) "::" |
247 | NAME_REF@[335; 340) | 247 | NAME_REF@[335; 340) |
248 | IDENT@[335; 340) "c_int" | 248 | IDENT@[335; 340) "c_int" |
249 | SEMI@[340; 341) ";" | 249 | SEMICOLON@[340; 341) ";" |
250 | WHITESPACE@[341; 346) "\n " | 250 | WHITESPACE@[341; 346) "\n " |
251 | FN_DEF@[346; 469) | 251 | FN_DEF@[346; 469) |
252 | VISIBILITY@[346; 349) | 252 | VISIBILITY@[346; 349) |
@@ -267,7 +267,7 @@ SOURCE_FILE@[0; 1598) | |||
267 | PATH_TYPE@[373; 380) | 267 | PATH_TYPE@[373; 380) |
268 | PATH@[373; 380) | 268 | PATH@[373; 380) |
269 | PATH_SEGMENT@[373; 380) | 269 | PATH_SEGMENT@[373; 380) |
270 | COLONCOLON@[373; 375) "::" | 270 | COLON2@[373; 375) "::" |
271 | NAME_REF@[375; 380) | 271 | NAME_REF@[375; 380) |
272 | IDENT@[375; 380) "c_int" | 272 | IDENT@[375; 380) "c_int" |
273 | COMMA@[380; 381) "," | 273 | COMMA@[380; 381) "," |
@@ -312,10 +312,10 @@ SOURCE_FILE@[0; 1598) | |||
312 | PATH_TYPE@[461; 468) | 312 | PATH_TYPE@[461; 468) |
313 | PATH@[461; 468) | 313 | PATH@[461; 468) |
314 | PATH_SEGMENT@[461; 468) | 314 | PATH_SEGMENT@[461; 468) |
315 | COLONCOLON@[461; 463) "::" | 315 | COLON2@[461; 463) "::" |
316 | NAME_REF@[463; 468) | 316 | NAME_REF@[463; 468) |
317 | IDENT@[463; 468) "c_int" | 317 | IDENT@[463; 468) "c_int" |
318 | SEMI@[468; 469) ";" | 318 | SEMICOLON@[468; 469) ";" |
319 | WHITESPACE@[469; 474) "\n " | 319 | WHITESPACE@[469; 474) "\n " |
320 | FN_DEF@[474; 691) | 320 | FN_DEF@[474; 691) |
321 | VISIBILITY@[474; 477) | 321 | VISIBILITY@[474; 477) |
@@ -336,7 +336,7 @@ SOURCE_FILE@[0; 1598) | |||
336 | PATH_TYPE@[500; 507) | 336 | PATH_TYPE@[500; 507) |
337 | PATH@[500; 507) | 337 | PATH@[500; 507) |
338 | PATH_SEGMENT@[500; 507) | 338 | PATH_SEGMENT@[500; 507) |
339 | COLONCOLON@[500; 502) "::" | 339 | COLON2@[500; 502) "::" |
340 | NAME_REF@[502; 507) | 340 | NAME_REF@[502; 507) |
341 | IDENT@[502; 507) "c_int" | 341 | IDENT@[502; 507) "c_int" |
342 | COMMA@[507; 508) "," | 342 | COMMA@[507; 508) "," |
@@ -350,7 +350,7 @@ SOURCE_FILE@[0; 1598) | |||
350 | PATH_TYPE@[538; 545) | 350 | PATH_TYPE@[538; 545) |
351 | PATH@[538; 545) | 351 | PATH@[538; 545) |
352 | PATH_SEGMENT@[538; 545) | 352 | PATH_SEGMENT@[538; 545) |
353 | COLONCOLON@[538; 540) "::" | 353 | COLON2@[538; 540) "::" |
354 | NAME_REF@[540; 545) | 354 | NAME_REF@[540; 545) |
355 | IDENT@[540; 545) "c_int" | 355 | IDENT@[540; 545) "c_int" |
356 | COMMA@[545; 546) "," | 356 | COMMA@[545; 546) "," |
@@ -364,7 +364,7 @@ SOURCE_FILE@[0; 1598) | |||
364 | PATH_TYPE@[578; 585) | 364 | PATH_TYPE@[578; 585) |
365 | PATH@[578; 585) | 365 | PATH@[578; 585) |
366 | PATH_SEGMENT@[578; 585) | 366 | PATH_SEGMENT@[578; 585) |
367 | COLONCOLON@[578; 580) "::" | 367 | COLON2@[578; 580) "::" |
368 | NAME_REF@[580; 585) | 368 | NAME_REF@[580; 585) |
369 | IDENT@[580; 585) "c_int" | 369 | IDENT@[580; 585) "c_int" |
370 | COMMA@[585; 586) "," | 370 | COMMA@[585; 586) "," |
@@ -382,7 +382,7 @@ SOURCE_FILE@[0; 1598) | |||
382 | PATH_TYPE@[622; 630) | 382 | PATH_TYPE@[622; 630) |
383 | PATH@[622; 630) | 383 | PATH@[622; 630) |
384 | PATH_SEGMENT@[622; 630) | 384 | PATH_SEGMENT@[622; 630) |
385 | COLONCOLON@[622; 624) "::" | 385 | COLON2@[622; 624) "::" |
386 | NAME_REF@[624; 630) | 386 | NAME_REF@[624; 630) |
387 | IDENT@[624; 630) "c_void" | 387 | IDENT@[624; 630) "c_void" |
388 | COMMA@[630; 631) "," | 388 | COMMA@[630; 631) "," |
@@ -400,7 +400,7 @@ SOURCE_FILE@[0; 1598) | |||
400 | PATH_TYPE@[667; 678) | 400 | PATH_TYPE@[667; 678) |
401 | PATH@[667; 678) | 401 | PATH@[667; 678) |
402 | PATH_SEGMENT@[667; 678) | 402 | PATH_SEGMENT@[667; 678) |
403 | COLONCOLON@[667; 669) "::" | 403 | COLON2@[667; 669) "::" |
404 | NAME_REF@[669; 678) | 404 | NAME_REF@[669; 678) |
405 | IDENT@[669; 678) "socklen_t" | 405 | IDENT@[669; 678) "socklen_t" |
406 | R_PAREN@[678; 679) ")" | 406 | R_PAREN@[678; 679) ")" |
@@ -411,10 +411,10 @@ SOURCE_FILE@[0; 1598) | |||
411 | PATH_TYPE@[683; 690) | 411 | PATH_TYPE@[683; 690) |
412 | PATH@[683; 690) | 412 | PATH@[683; 690) |
413 | PATH_SEGMENT@[683; 690) | 413 | PATH_SEGMENT@[683; 690) |
414 | COLONCOLON@[683; 685) "::" | 414 | COLON2@[683; 685) "::" |
415 | NAME_REF@[685; 690) | 415 | NAME_REF@[685; 690) |
416 | IDENT@[685; 690) "c_int" | 416 | IDENT@[685; 690) "c_int" |
417 | SEMI@[690; 691) ";" | 417 | SEMICOLON@[690; 691) ";" |
418 | WHITESPACE@[691; 696) "\n " | 418 | WHITESPACE@[691; 696) "\n " |
419 | FN_DEF@[696; 864) | 419 | FN_DEF@[696; 864) |
420 | VISIBILITY@[696; 699) | 420 | VISIBILITY@[696; 699) |
@@ -435,7 +435,7 @@ SOURCE_FILE@[0; 1598) | |||
435 | PATH_TYPE@[722; 729) | 435 | PATH_TYPE@[722; 729) |
436 | PATH@[722; 729) | 436 | PATH@[722; 729) |
437 | PATH_SEGMENT@[722; 729) | 437 | PATH_SEGMENT@[722; 729) |
438 | COLONCOLON@[722; 724) "::" | 438 | COLON2@[722; 724) "::" |
439 | NAME_REF@[724; 729) | 439 | NAME_REF@[724; 729) |
440 | IDENT@[724; 729) "c_int" | 440 | IDENT@[724; 729) "c_int" |
441 | COMMA@[729; 730) "," | 441 | COMMA@[729; 730) "," |
@@ -449,7 +449,7 @@ SOURCE_FILE@[0; 1598) | |||
449 | PATH_TYPE@[738; 745) | 449 | PATH_TYPE@[738; 745) |
450 | PATH@[738; 745) | 450 | PATH@[738; 745) |
451 | PATH_SEGMENT@[738; 745) | 451 | PATH_SEGMENT@[738; 745) |
452 | COLONCOLON@[738; 740) "::" | 452 | COLON2@[738; 740) "::" |
453 | NAME_REF@[740; 745) | 453 | NAME_REF@[740; 745) |
454 | IDENT@[740; 745) "c_int" | 454 | IDENT@[740; 745) "c_int" |
455 | COMMA@[745; 746) "," | 455 | COMMA@[745; 746) "," |
@@ -463,7 +463,7 @@ SOURCE_FILE@[0; 1598) | |||
463 | PATH_TYPE@[753; 760) | 463 | PATH_TYPE@[753; 760) |
464 | PATH@[753; 760) | 464 | PATH@[753; 760) |
465 | PATH_SEGMENT@[753; 760) | 465 | PATH_SEGMENT@[753; 760) |
466 | COLONCOLON@[753; 755) "::" | 466 | COLON2@[753; 755) "::" |
467 | NAME_REF@[755; 760) | 467 | NAME_REF@[755; 760) |
468 | IDENT@[755; 760) "c_int" | 468 | IDENT@[755; 760) "c_int" |
469 | COMMA@[760; 761) "," | 469 | COMMA@[760; 761) "," |
@@ -481,7 +481,7 @@ SOURCE_FILE@[0; 1598) | |||
481 | PATH_TYPE@[798; 806) | 481 | PATH_TYPE@[798; 806) |
482 | PATH@[798; 806) | 482 | PATH@[798; 806) |
483 | PATH_SEGMENT@[798; 806) | 483 | PATH_SEGMENT@[798; 806) |
484 | COLONCOLON@[798; 800) "::" | 484 | COLON2@[798; 800) "::" |
485 | NAME_REF@[800; 806) | 485 | NAME_REF@[800; 806) |
486 | IDENT@[800; 806) "c_void" | 486 | IDENT@[800; 806) "c_void" |
487 | COMMA@[806; 807) "," | 487 | COMMA@[806; 807) "," |
@@ -505,10 +505,10 @@ SOURCE_FILE@[0; 1598) | |||
505 | PATH_TYPE@[856; 863) | 505 | PATH_TYPE@[856; 863) |
506 | PATH@[856; 863) | 506 | PATH@[856; 863) |
507 | PATH_SEGMENT@[856; 863) | 507 | PATH_SEGMENT@[856; 863) |
508 | COLONCOLON@[856; 858) "::" | 508 | COLON2@[856; 858) "::" |
509 | NAME_REF@[858; 863) | 509 | NAME_REF@[858; 863) |
510 | IDENT@[858; 863) "c_int" | 510 | IDENT@[858; 863) "c_int" |
511 | SEMI@[863; 864) ";" | 511 | SEMICOLON@[863; 864) ";" |
512 | WHITESPACE@[864; 869) "\n " | 512 | WHITESPACE@[864; 869) "\n " |
513 | FN_DEF@[869; 992) | 513 | FN_DEF@[869; 992) |
514 | VISIBILITY@[869; 872) | 514 | VISIBILITY@[869; 872) |
@@ -529,7 +529,7 @@ SOURCE_FILE@[0; 1598) | |||
529 | PATH_TYPE@[896; 903) | 529 | PATH_TYPE@[896; 903) |
530 | PATH@[896; 903) | 530 | PATH@[896; 903) |
531 | PATH_SEGMENT@[896; 903) | 531 | PATH_SEGMENT@[896; 903) |
532 | COLONCOLON@[896; 898) "::" | 532 | COLON2@[896; 898) "::" |
533 | NAME_REF@[898; 903) | 533 | NAME_REF@[898; 903) |
534 | IDENT@[898; 903) "c_int" | 534 | IDENT@[898; 903) "c_int" |
535 | COMMA@[903; 904) "," | 535 | COMMA@[903; 904) "," |
@@ -574,10 +574,10 @@ SOURCE_FILE@[0; 1598) | |||
574 | PATH_TYPE@[984; 991) | 574 | PATH_TYPE@[984; 991) |
575 | PATH@[984; 991) | 575 | PATH@[984; 991) |
576 | PATH_SEGMENT@[984; 991) | 576 | PATH_SEGMENT@[984; 991) |
577 | COLONCOLON@[984; 986) "::" | 577 | COLON2@[984; 986) "::" |
578 | NAME_REF@[986; 991) | 578 | NAME_REF@[986; 991) |
579 | IDENT@[986; 991) "c_int" | 579 | IDENT@[986; 991) "c_int" |
580 | SEMI@[991; 992) ";" | 580 | SEMICOLON@[991; 992) ";" |
581 | WHITESPACE@[992; 997) "\n " | 581 | WHITESPACE@[992; 997) "\n " |
582 | FN_DEF@[997; 1173) | 582 | FN_DEF@[997; 1173) |
583 | VISIBILITY@[997; 1000) | 583 | VISIBILITY@[997; 1000) |
@@ -598,7 +598,7 @@ SOURCE_FILE@[0; 1598) | |||
598 | PATH_TYPE@[1019; 1026) | 598 | PATH_TYPE@[1019; 1026) |
599 | PATH@[1019; 1026) | 599 | PATH@[1019; 1026) |
600 | PATH_SEGMENT@[1019; 1026) | 600 | PATH_SEGMENT@[1019; 1026) |
601 | COLONCOLON@[1019; 1021) "::" | 601 | COLON2@[1019; 1021) "::" |
602 | NAME_REF@[1021; 1026) | 602 | NAME_REF@[1021; 1026) |
603 | IDENT@[1021; 1026) "c_int" | 603 | IDENT@[1021; 1026) "c_int" |
604 | COMMA@[1026; 1027) "," | 604 | COMMA@[1026; 1027) "," |
@@ -616,7 +616,7 @@ SOURCE_FILE@[0; 1598) | |||
616 | PATH_TYPE@[1040; 1048) | 616 | PATH_TYPE@[1040; 1048) |
617 | PATH@[1040; 1048) | 617 | PATH@[1040; 1048) |
618 | PATH_SEGMENT@[1040; 1048) | 618 | PATH_SEGMENT@[1040; 1048) |
619 | COLONCOLON@[1040; 1042) "::" | 619 | COLON2@[1040; 1042) "::" |
620 | NAME_REF@[1042; 1048) | 620 | NAME_REF@[1042; 1048) |
621 | IDENT@[1042; 1048) "c_void" | 621 | IDENT@[1042; 1048) "c_void" |
622 | COMMA@[1048; 1049) "," | 622 | COMMA@[1048; 1049) "," |
@@ -630,7 +630,7 @@ SOURCE_FILE@[0; 1598) | |||
630 | PATH_TYPE@[1055; 1063) | 630 | PATH_TYPE@[1055; 1063) |
631 | PATH@[1055; 1063) | 631 | PATH@[1055; 1063) |
632 | PATH_SEGMENT@[1055; 1063) | 632 | PATH_SEGMENT@[1055; 1063) |
633 | COLONCOLON@[1055; 1057) "::" | 633 | COLON2@[1055; 1057) "::" |
634 | NAME_REF@[1057; 1063) | 634 | NAME_REF@[1057; 1063) |
635 | IDENT@[1057; 1063) "size_t" | 635 | IDENT@[1057; 1063) "size_t" |
636 | COMMA@[1063; 1064) "," | 636 | COMMA@[1063; 1064) "," |
@@ -644,7 +644,7 @@ SOURCE_FILE@[0; 1598) | |||
644 | PATH_TYPE@[1090; 1097) | 644 | PATH_TYPE@[1090; 1097) |
645 | PATH@[1090; 1097) | 645 | PATH@[1090; 1097) |
646 | PATH_SEGMENT@[1090; 1097) | 646 | PATH_SEGMENT@[1090; 1097) |
647 | COLONCOLON@[1090; 1092) "::" | 647 | COLON2@[1090; 1092) "::" |
648 | NAME_REF@[1092; 1097) | 648 | NAME_REF@[1092; 1097) |
649 | IDENT@[1092; 1097) "c_int" | 649 | IDENT@[1092; 1097) "c_int" |
650 | COMMA@[1097; 1098) "," | 650 | COMMA@[1097; 1098) "," |
@@ -685,10 +685,10 @@ SOURCE_FILE@[0; 1598) | |||
685 | PATH_TYPE@[1163; 1172) | 685 | PATH_TYPE@[1163; 1172) |
686 | PATH@[1163; 1172) | 686 | PATH@[1163; 1172) |
687 | PATH_SEGMENT@[1163; 1172) | 687 | PATH_SEGMENT@[1163; 1172) |
688 | COLONCOLON@[1163; 1165) "::" | 688 | COLON2@[1163; 1165) "::" |
689 | NAME_REF@[1165; 1172) | 689 | NAME_REF@[1165; 1172) |
690 | IDENT@[1165; 1172) "ssize_t" | 690 | IDENT@[1165; 1172) "ssize_t" |
691 | SEMI@[1172; 1173) ";" | 691 | SEMICOLON@[1172; 1173) ";" |
692 | WHITESPACE@[1173; 1178) "\n " | 692 | WHITESPACE@[1173; 1178) "\n " |
693 | FN_DEF@[1178; 1289) | 693 | FN_DEF@[1178; 1289) |
694 | VISIBILITY@[1178; 1181) | 694 | VISIBILITY@[1178; 1181) |
@@ -709,7 +709,7 @@ SOURCE_FILE@[0; 1598) | |||
709 | PATH_TYPE@[1198; 1205) | 709 | PATH_TYPE@[1198; 1205) |
710 | PATH@[1198; 1205) | 710 | PATH@[1198; 1205) |
711 | PATH_SEGMENT@[1198; 1205) | 711 | PATH_SEGMENT@[1198; 1205) |
712 | COLONCOLON@[1198; 1200) "::" | 712 | COLON2@[1198; 1200) "::" |
713 | NAME_REF@[1200; 1205) | 713 | NAME_REF@[1200; 1205) |
714 | IDENT@[1200; 1205) "c_int" | 714 | IDENT@[1200; 1205) "c_int" |
715 | COMMA@[1205; 1206) "," | 715 | COMMA@[1205; 1206) "," |
@@ -727,7 +727,7 @@ SOURCE_FILE@[0; 1598) | |||
727 | PATH_TYPE@[1219; 1227) | 727 | PATH_TYPE@[1219; 1227) |
728 | PATH@[1219; 1227) | 728 | PATH@[1219; 1227) |
729 | PATH_SEGMENT@[1219; 1227) | 729 | PATH_SEGMENT@[1219; 1227) |
730 | COLONCOLON@[1219; 1221) "::" | 730 | COLON2@[1219; 1221) "::" |
731 | NAME_REF@[1221; 1227) | 731 | NAME_REF@[1221; 1227) |
732 | IDENT@[1221; 1227) "c_void" | 732 | IDENT@[1221; 1227) "c_void" |
733 | COMMA@[1227; 1228) "," | 733 | COMMA@[1227; 1228) "," |
@@ -741,7 +741,7 @@ SOURCE_FILE@[0; 1598) | |||
741 | PATH_TYPE@[1234; 1242) | 741 | PATH_TYPE@[1234; 1242) |
742 | PATH@[1234; 1242) | 742 | PATH@[1234; 1242) |
743 | PATH_SEGMENT@[1234; 1242) | 743 | PATH_SEGMENT@[1234; 1242) |
744 | COLONCOLON@[1234; 1236) "::" | 744 | COLON2@[1234; 1236) "::" |
745 | NAME_REF@[1236; 1242) | 745 | NAME_REF@[1236; 1242) |
746 | IDENT@[1236; 1242) "size_t" | 746 | IDENT@[1236; 1242) "size_t" |
747 | COMMA@[1242; 1243) "," | 747 | COMMA@[1242; 1243) "," |
@@ -755,7 +755,7 @@ SOURCE_FILE@[0; 1598) | |||
755 | PATH_TYPE@[1267; 1274) | 755 | PATH_TYPE@[1267; 1274) |
756 | PATH@[1267; 1274) | 756 | PATH@[1267; 1274) |
757 | PATH_SEGMENT@[1267; 1274) | 757 | PATH_SEGMENT@[1267; 1274) |
758 | COLONCOLON@[1267; 1269) "::" | 758 | COLON2@[1267; 1269) "::" |
759 | NAME_REF@[1269; 1274) | 759 | NAME_REF@[1269; 1274) |
760 | IDENT@[1269; 1274) "c_int" | 760 | IDENT@[1269; 1274) "c_int" |
761 | R_PAREN@[1274; 1275) ")" | 761 | R_PAREN@[1274; 1275) ")" |
@@ -766,10 +766,10 @@ SOURCE_FILE@[0; 1598) | |||
766 | PATH_TYPE@[1279; 1288) | 766 | PATH_TYPE@[1279; 1288) |
767 | PATH@[1279; 1288) | 767 | PATH@[1279; 1288) |
768 | PATH_SEGMENT@[1279; 1288) | 768 | PATH_SEGMENT@[1279; 1288) |
769 | COLONCOLON@[1279; 1281) "::" | 769 | COLON2@[1279; 1281) "::" |
770 | NAME_REF@[1281; 1288) | 770 | NAME_REF@[1281; 1288) |
771 | IDENT@[1281; 1288) "ssize_t" | 771 | IDENT@[1281; 1288) "ssize_t" |
772 | SEMI@[1288; 1289) ";" | 772 | SEMICOLON@[1288; 1289) ";" |
773 | WHITESPACE@[1289; 1294) "\n " | 773 | WHITESPACE@[1289; 1294) "\n " |
774 | FN_DEF@[1294; 1481) | 774 | FN_DEF@[1294; 1481) |
775 | VISIBILITY@[1294; 1297) | 775 | VISIBILITY@[1294; 1297) |
@@ -790,7 +790,7 @@ SOURCE_FILE@[0; 1598) | |||
790 | PATH_TYPE@[1318; 1325) | 790 | PATH_TYPE@[1318; 1325) |
791 | PATH@[1318; 1325) | 791 | PATH@[1318; 1325) |
792 | PATH_SEGMENT@[1318; 1325) | 792 | PATH_SEGMENT@[1318; 1325) |
793 | COLONCOLON@[1318; 1320) "::" | 793 | COLON2@[1318; 1320) "::" |
794 | NAME_REF@[1320; 1325) | 794 | NAME_REF@[1320; 1325) |
795 | IDENT@[1320; 1325) "c_int" | 795 | IDENT@[1320; 1325) "c_int" |
796 | COMMA@[1325; 1326) "," | 796 | COMMA@[1325; 1326) "," |
@@ -808,7 +808,7 @@ SOURCE_FILE@[0; 1598) | |||
808 | PATH_TYPE@[1337; 1345) | 808 | PATH_TYPE@[1337; 1345) |
809 | PATH@[1337; 1345) | 809 | PATH@[1337; 1345) |
810 | PATH_SEGMENT@[1337; 1345) | 810 | PATH_SEGMENT@[1337; 1345) |
811 | COLONCOLON@[1337; 1339) "::" | 811 | COLON2@[1337; 1339) "::" |
812 | NAME_REF@[1339; 1345) | 812 | NAME_REF@[1339; 1345) |
813 | IDENT@[1339; 1345) "c_void" | 813 | IDENT@[1339; 1345) "c_void" |
814 | COMMA@[1345; 1346) "," | 814 | COMMA@[1345; 1346) "," |
@@ -822,7 +822,7 @@ SOURCE_FILE@[0; 1598) | |||
822 | PATH_TYPE@[1352; 1360) | 822 | PATH_TYPE@[1352; 1360) |
823 | PATH@[1352; 1360) | 823 | PATH@[1352; 1360) |
824 | PATH_SEGMENT@[1352; 1360) | 824 | PATH_SEGMENT@[1352; 1360) |
825 | COLONCOLON@[1352; 1354) "::" | 825 | COLON2@[1352; 1354) "::" |
826 | NAME_REF@[1354; 1360) | 826 | NAME_REF@[1354; 1360) |
827 | IDENT@[1354; 1360) "size_t" | 827 | IDENT@[1354; 1360) "size_t" |
828 | COMMA@[1360; 1361) "," | 828 | COMMA@[1360; 1361) "," |
@@ -836,7 +836,7 @@ SOURCE_FILE@[0; 1598) | |||
836 | PATH_TYPE@[1389; 1396) | 836 | PATH_TYPE@[1389; 1396) |
837 | PATH@[1389; 1396) | 837 | PATH@[1389; 1396) |
838 | PATH_SEGMENT@[1389; 1396) | 838 | PATH_SEGMENT@[1389; 1396) |
839 | COLONCOLON@[1389; 1391) "::" | 839 | COLON2@[1389; 1391) "::" |
840 | NAME_REF@[1391; 1396) | 840 | NAME_REF@[1391; 1396) |
841 | IDENT@[1391; 1396) "c_int" | 841 | IDENT@[1391; 1396) "c_int" |
842 | COMMA@[1396; 1397) "," | 842 | COMMA@[1396; 1397) "," |
@@ -854,7 +854,7 @@ SOURCE_FILE@[0; 1598) | |||
854 | PATH_TYPE@[1409; 1419) | 854 | PATH_TYPE@[1409; 1419) |
855 | PATH@[1409; 1419) | 855 | PATH@[1409; 1419) |
856 | PATH_SEGMENT@[1409; 1419) | 856 | PATH_SEGMENT@[1409; 1419) |
857 | COLONCOLON@[1409; 1411) "::" | 857 | COLON2@[1409; 1411) "::" |
858 | NAME_REF@[1411; 1419) | 858 | NAME_REF@[1411; 1419) |
859 | IDENT@[1411; 1419) "sockaddr" | 859 | IDENT@[1411; 1419) "sockaddr" |
860 | COMMA@[1419; 1420) "," | 860 | COMMA@[1419; 1420) "," |
@@ -872,7 +872,7 @@ SOURCE_FILE@[0; 1598) | |||
872 | PATH_TYPE@[1455; 1466) | 872 | PATH_TYPE@[1455; 1466) |
873 | PATH@[1455; 1466) | 873 | PATH@[1455; 1466) |
874 | PATH_SEGMENT@[1455; 1466) | 874 | PATH_SEGMENT@[1455; 1466) |
875 | COLONCOLON@[1455; 1457) "::" | 875 | COLON2@[1455; 1457) "::" |
876 | NAME_REF@[1457; 1466) | 876 | NAME_REF@[1457; 1466) |
877 | IDENT@[1457; 1466) "socklen_t" | 877 | IDENT@[1457; 1466) "socklen_t" |
878 | R_PAREN@[1466; 1467) ")" | 878 | R_PAREN@[1466; 1467) ")" |
@@ -883,10 +883,10 @@ SOURCE_FILE@[0; 1598) | |||
883 | PATH_TYPE@[1471; 1480) | 883 | PATH_TYPE@[1471; 1480) |
884 | PATH@[1471; 1480) | 884 | PATH@[1471; 1480) |
885 | PATH_SEGMENT@[1471; 1480) | 885 | PATH_SEGMENT@[1471; 1480) |
886 | COLONCOLON@[1471; 1473) "::" | 886 | COLON2@[1471; 1473) "::" |
887 | NAME_REF@[1473; 1480) | 887 | NAME_REF@[1473; 1480) |
888 | IDENT@[1473; 1480) "ssize_t" | 888 | IDENT@[1473; 1480) "ssize_t" |
889 | SEMI@[1480; 1481) ";" | 889 | SEMICOLON@[1480; 1481) ";" |
890 | WHITESPACE@[1481; 1486) "\n " | 890 | WHITESPACE@[1481; 1486) "\n " |
891 | FN_DEF@[1486; 1595) | 891 | FN_DEF@[1486; 1595) |
892 | VISIBILITY@[1486; 1489) | 892 | VISIBILITY@[1486; 1489) |
@@ -907,7 +907,7 @@ SOURCE_FILE@[0; 1598) | |||
907 | PATH_TYPE@[1506; 1513) | 907 | PATH_TYPE@[1506; 1513) |
908 | PATH@[1506; 1513) | 908 | PATH@[1506; 1513) |
909 | PATH_SEGMENT@[1506; 1513) | 909 | PATH_SEGMENT@[1506; 1513) |
910 | COLONCOLON@[1506; 1508) "::" | 910 | COLON2@[1506; 1508) "::" |
911 | NAME_REF@[1508; 1513) | 911 | NAME_REF@[1508; 1513) |
912 | IDENT@[1508; 1513) "c_int" | 912 | IDENT@[1508; 1513) "c_int" |
913 | COMMA@[1513; 1514) "," | 913 | COMMA@[1513; 1514) "," |
@@ -925,7 +925,7 @@ SOURCE_FILE@[0; 1598) | |||
925 | PATH_TYPE@[1525; 1533) | 925 | PATH_TYPE@[1525; 1533) |
926 | PATH@[1525; 1533) | 926 | PATH@[1525; 1533) |
927 | PATH_SEGMENT@[1525; 1533) | 927 | PATH_SEGMENT@[1525; 1533) |
928 | COLONCOLON@[1525; 1527) "::" | 928 | COLON2@[1525; 1527) "::" |
929 | NAME_REF@[1527; 1533) | 929 | NAME_REF@[1527; 1533) |
930 | IDENT@[1527; 1533) "c_void" | 930 | IDENT@[1527; 1533) "c_void" |
931 | COMMA@[1533; 1534) "," | 931 | COMMA@[1533; 1534) "," |
@@ -939,7 +939,7 @@ SOURCE_FILE@[0; 1598) | |||
939 | PATH_TYPE@[1540; 1548) | 939 | PATH_TYPE@[1540; 1548) |
940 | PATH@[1540; 1548) | 940 | PATH@[1540; 1548) |
941 | PATH_SEGMENT@[1540; 1548) | 941 | PATH_SEGMENT@[1540; 1548) |
942 | COLONCOLON@[1540; 1542) "::" | 942 | COLON2@[1540; 1542) "::" |
943 | NAME_REF@[1542; 1548) | 943 | NAME_REF@[1542; 1548) |
944 | IDENT@[1542; 1548) "size_t" | 944 | IDENT@[1542; 1548) "size_t" |
945 | COMMA@[1548; 1549) "," | 945 | COMMA@[1548; 1549) "," |
@@ -953,7 +953,7 @@ SOURCE_FILE@[0; 1598) | |||
953 | PATH_TYPE@[1573; 1580) | 953 | PATH_TYPE@[1573; 1580) |
954 | PATH@[1573; 1580) | 954 | PATH@[1573; 1580) |
955 | PATH_SEGMENT@[1573; 1580) | 955 | PATH_SEGMENT@[1573; 1580) |
956 | COLONCOLON@[1573; 1575) "::" | 956 | COLON2@[1573; 1575) "::" |
957 | NAME_REF@[1575; 1580) | 957 | NAME_REF@[1575; 1580) |
958 | IDENT@[1575; 1580) "c_int" | 958 | IDENT@[1575; 1580) "c_int" |
959 | R_PAREN@[1580; 1581) ")" | 959 | R_PAREN@[1580; 1581) ")" |
@@ -964,10 +964,10 @@ SOURCE_FILE@[0; 1598) | |||
964 | PATH_TYPE@[1585; 1594) | 964 | PATH_TYPE@[1585; 1594) |
965 | PATH@[1585; 1594) | 965 | PATH@[1585; 1594) |
966 | PATH_SEGMENT@[1585; 1594) | 966 | PATH_SEGMENT@[1585; 1594) |
967 | COLONCOLON@[1585; 1587) "::" | 967 | COLON2@[1585; 1587) "::" |
968 | NAME_REF@[1587; 1594) | 968 | NAME_REF@[1587; 1594) |
969 | IDENT@[1587; 1594) "ssize_t" | 969 | IDENT@[1587; 1594) "ssize_t" |
970 | SEMI@[1594; 1595) ";" | 970 | SEMICOLON@[1594; 1595) ";" |
971 | WHITESPACE@[1595; 1596) "\n" | 971 | WHITESPACE@[1595; 1596) "\n" |
972 | R_CURLY@[1596; 1597) "}" | 972 | R_CURLY@[1596; 1597) "}" |
973 | WHITESPACE@[1597; 1598) "\n" | 973 | WHITESPACE@[1597; 1598) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0032_where_for.rast b/crates/ra_syntax/test_data/parser/ok/0032_where_for.rast index 3a333480e..f71cf5b6c 100644 --- a/crates/ra_syntax/test_data/parser/ok/0032_where_for.rast +++ b/crates/ra_syntax/test_data/parser/ok/0032_where_for.rast | |||
@@ -74,11 +74,11 @@ SOURCE_FILE@[0; 116) | |||
74 | PATH_SEGMENT@[96; 99) | 74 | PATH_SEGMENT@[96; 99) |
75 | NAME_REF@[96; 99) | 75 | NAME_REF@[96; 99) |
76 | IDENT@[96; 99) "std" | 76 | IDENT@[96; 99) "std" |
77 | COLONCOLON@[99; 101) "::" | 77 | COLON2@[99; 101) "::" |
78 | PATH_SEGMENT@[101; 104) | 78 | PATH_SEGMENT@[101; 104) |
79 | NAME_REF@[101; 104) | 79 | NAME_REF@[101; 104) |
80 | IDENT@[101; 104) "fmt" | 80 | IDENT@[101; 104) "fmt" |
81 | COLONCOLON@[104; 106) "::" | 81 | COLON2@[104; 106) "::" |
82 | PATH_SEGMENT@[106; 111) | 82 | PATH_SEGMENT@[106; 111) |
83 | NAME_REF@[106; 111) | 83 | NAME_REF@[106; 111) |
84 | IDENT@[106; 111) "Debug" | 84 | IDENT@[106; 111) "Debug" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0033_label_break.rast b/crates/ra_syntax/test_data/parser/ok/0033_label_break.rast index bd9e3fd85..8af41caa0 100644 --- a/crates/ra_syntax/test_data/parser/ok/0033_label_break.rast +++ b/crates/ra_syntax/test_data/parser/ok/0033_label_break.rast | |||
@@ -43,7 +43,7 @@ SOURCE_FILE@[0; 506) | |||
43 | ARG_LIST@[98; 100) | 43 | ARG_LIST@[98; 100) |
44 | L_PAREN@[98; 99) "(" | 44 | L_PAREN@[98; 99) "(" |
45 | R_PAREN@[99; 100) ")" | 45 | R_PAREN@[99; 100) ")" |
46 | SEMI@[100; 101) ";" | 46 | SEMICOLON@[100; 101) ";" |
47 | WHITESPACE@[101; 110) "\n " | 47 | WHITESPACE@[101; 110) "\n " |
48 | EXPR_STMT@[110; 170) | 48 | EXPR_STMT@[110; 170) |
49 | IF_EXPR@[110; 170) | 49 | IF_EXPR@[110; 170) |
@@ -69,7 +69,7 @@ SOURCE_FILE@[0; 506) | |||
69 | BREAK_KW@[147; 152) "break" | 69 | BREAK_KW@[147; 152) "break" |
70 | WHITESPACE@[152; 153) " " | 70 | WHITESPACE@[152; 153) " " |
71 | LIFETIME@[153; 159) "\'block" | 71 | LIFETIME@[153; 159) "\'block" |
72 | SEMI@[159; 160) ";" | 72 | SEMICOLON@[159; 160) ";" |
73 | WHITESPACE@[160; 169) "\n " | 73 | WHITESPACE@[160; 169) "\n " |
74 | R_CURLY@[169; 170) "}" | 74 | R_CURLY@[169; 170) "}" |
75 | WHITESPACE@[170; 179) "\n " | 75 | WHITESPACE@[170; 179) "\n " |
@@ -83,7 +83,7 @@ SOURCE_FILE@[0; 506) | |||
83 | ARG_LIST@[192; 194) | 83 | ARG_LIST@[192; 194) |
84 | L_PAREN@[192; 193) "(" | 84 | L_PAREN@[192; 193) "(" |
85 | R_PAREN@[193; 194) ")" | 85 | R_PAREN@[193; 194) ")" |
86 | SEMI@[194; 195) ";" | 86 | SEMICOLON@[194; 195) ";" |
87 | WHITESPACE@[195; 204) "\n " | 87 | WHITESPACE@[195; 204) "\n " |
88 | EXPR_STMT@[204; 264) | 88 | EXPR_STMT@[204; 264) |
89 | IF_EXPR@[204; 264) | 89 | IF_EXPR@[204; 264) |
@@ -109,7 +109,7 @@ SOURCE_FILE@[0; 506) | |||
109 | BREAK_KW@[241; 246) "break" | 109 | BREAK_KW@[241; 246) "break" |
110 | WHITESPACE@[246; 247) " " | 110 | WHITESPACE@[246; 247) " " |
111 | LIFETIME@[247; 253) "\'block" | 111 | LIFETIME@[247; 253) "\'block" |
112 | SEMI@[253; 254) ";" | 112 | SEMICOLON@[253; 254) ";" |
113 | WHITESPACE@[254; 263) "\n " | 113 | WHITESPACE@[254; 263) "\n " |
114 | R_CURLY@[263; 264) "}" | 114 | R_CURLY@[263; 264) "}" |
115 | WHITESPACE@[264; 273) "\n " | 115 | WHITESPACE@[264; 273) "\n " |
@@ -123,7 +123,7 @@ SOURCE_FILE@[0; 506) | |||
123 | ARG_LIST@[286; 288) | 123 | ARG_LIST@[286; 288) |
124 | L_PAREN@[286; 287) "(" | 124 | L_PAREN@[286; 287) "(" |
125 | R_PAREN@[287; 288) ")" | 125 | R_PAREN@[287; 288) ")" |
126 | SEMI@[288; 289) ";" | 126 | SEMICOLON@[288; 289) ";" |
127 | WHITESPACE@[289; 294) "\n " | 127 | WHITESPACE@[289; 294) "\n " |
128 | R_CURLY@[294; 295) "}" | 128 | R_CURLY@[294; 295) "}" |
129 | WHITESPACE@[295; 301) "\n\n " | 129 | WHITESPACE@[295; 301) "\n\n " |
@@ -173,7 +173,7 @@ SOURCE_FILE@[0; 506) | |||
173 | WHITESPACE@[390; 391) " " | 173 | WHITESPACE@[390; 391) " " |
174 | LITERAL@[391; 392) | 174 | LITERAL@[391; 392) |
175 | INT_NUMBER@[391; 392) "1" | 175 | INT_NUMBER@[391; 392) "1" |
176 | SEMI@[392; 393) ";" | 176 | SEMICOLON@[392; 393) ";" |
177 | WHITESPACE@[393; 402) "\n " | 177 | WHITESPACE@[393; 402) "\n " |
178 | R_CURLY@[402; 403) "}" | 178 | R_CURLY@[402; 403) "}" |
179 | WHITESPACE@[403; 412) "\n " | 179 | WHITESPACE@[403; 412) "\n " |
@@ -206,7 +206,7 @@ SOURCE_FILE@[0; 506) | |||
206 | WHITESPACE@[473; 474) " " | 206 | WHITESPACE@[473; 474) " " |
207 | LITERAL@[474; 475) | 207 | LITERAL@[474; 475) |
208 | INT_NUMBER@[474; 475) "2" | 208 | INT_NUMBER@[474; 475) "2" |
209 | SEMI@[475; 476) ";" | 209 | SEMICOLON@[475; 476) ";" |
210 | WHITESPACE@[476; 485) "\n " | 210 | WHITESPACE@[476; 485) "\n " |
211 | R_CURLY@[485; 486) "}" | 211 | R_CURLY@[485; 486) "}" |
212 | WHITESPACE@[486; 495) "\n " | 212 | WHITESPACE@[486; 495) "\n " |
@@ -214,7 +214,7 @@ SOURCE_FILE@[0; 506) | |||
214 | INT_NUMBER@[495; 496) "3" | 214 | INT_NUMBER@[495; 496) "3" |
215 | WHITESPACE@[496; 501) "\n " | 215 | WHITESPACE@[496; 501) "\n " |
216 | R_CURLY@[501; 502) "}" | 216 | R_CURLY@[501; 502) "}" |
217 | SEMI@[502; 503) ";" | 217 | SEMICOLON@[502; 503) ";" |
218 | WHITESPACE@[503; 504) "\n" | 218 | WHITESPACE@[503; 504) "\n" |
219 | R_CURLY@[504; 505) "}" | 219 | R_CURLY@[504; 505) "}" |
220 | WHITESPACE@[505; 506) "\n" | 220 | WHITESPACE@[505; 506) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0034_crate_path_in_call.rast b/crates/ra_syntax/test_data/parser/ok/0034_crate_path_in_call.rast index fc0d452f4..beaa96388 100644 --- a/crates/ra_syntax/test_data/parser/ok/0034_crate_path_in_call.rast +++ b/crates/ra_syntax/test_data/parser/ok/0034_crate_path_in_call.rast | |||
@@ -27,16 +27,16 @@ SOURCE_FILE@[0; 62) | |||
27 | PATH@[27; 32) | 27 | PATH@[27; 32) |
28 | PATH_SEGMENT@[27; 32) | 28 | PATH_SEGMENT@[27; 32) |
29 | CRATE_KW@[27; 32) "crate" | 29 | CRATE_KW@[27; 32) "crate" |
30 | COLONCOLON@[32; 34) "::" | 30 | COLON2@[32; 34) "::" |
31 | PATH_SEGMENT@[34; 44) | 31 | PATH_SEGMENT@[34; 44) |
32 | NAME_REF@[34; 44) | 32 | NAME_REF@[34; 44) |
33 | IDENT@[34; 44) "module_map" | 33 | IDENT@[34; 44) "module_map" |
34 | COLONCOLON@[44; 46) "::" | 34 | COLON2@[44; 46) "::" |
35 | PATH_SEGMENT@[46; 57) | 35 | PATH_SEGMENT@[46; 57) |
36 | NAME_REF@[46; 57) | 36 | NAME_REF@[46; 57) |
37 | IDENT@[46; 57) "module_tree" | 37 | IDENT@[46; 57) "module_tree" |
38 | R_PAREN@[57; 58) ")" | 38 | R_PAREN@[57; 58) ")" |
39 | SEMI@[58; 59) ";" | 39 | SEMICOLON@[58; 59) ";" |
40 | WHITESPACE@[59; 60) "\n" | 40 | WHITESPACE@[59; 60) "\n" |
41 | R_CURLY@[60; 61) "}" | 41 | R_CURLY@[60; 61) "}" |
42 | WHITESPACE@[61; 62) "\n" | 42 | WHITESPACE@[61; 62) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast index 90538b90d..7143a31a5 100644 --- a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast +++ b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast | |||
@@ -9,7 +9,7 @@ SOURCE_FILE@[0; 3813) | |||
9 | WHITESPACE@[269; 271) "\n\n" | 9 | WHITESPACE@[269; 271) "\n\n" |
10 | ATTR@[271; 302) | 10 | ATTR@[271; 302) |
11 | POUND@[271; 272) "#" | 11 | POUND@[271; 272) "#" |
12 | EXCL@[272; 273) "!" | 12 | BANG@[272; 273) "!" |
13 | L_BRACK@[273; 274) "[" | 13 | L_BRACK@[273; 274) "[" |
14 | PATH@[274; 279) | 14 | PATH@[274; 279) |
15 | PATH_SEGMENT@[274; 279) | 15 | PATH_SEGMENT@[274; 279) |
@@ -23,7 +23,7 @@ SOURCE_FILE@[0; 3813) | |||
23 | WHITESPACE@[302; 303) "\n" | 23 | WHITESPACE@[302; 303) "\n" |
24 | ATTR@[303; 323) | 24 | ATTR@[303; 323) |
25 | POUND@[303; 304) "#" | 25 | POUND@[303; 304) "#" |
26 | EXCL@[304; 305) "!" | 26 | BANG@[304; 305) "!" |
27 | L_BRACK@[305; 306) "[" | 27 | L_BRACK@[305; 306) "[" |
28 | PATH@[306; 311) | 28 | PATH@[306; 311) |
29 | PATH_SEGMENT@[306; 311) | 29 | PATH_SEGMENT@[306; 311) |
@@ -37,7 +37,7 @@ SOURCE_FILE@[0; 3813) | |||
37 | WHITESPACE@[323; 324) "\n" | 37 | WHITESPACE@[323; 324) "\n" |
38 | ATTR@[324; 351) | 38 | ATTR@[324; 351) |
39 | POUND@[324; 325) "#" | 39 | POUND@[324; 325) "#" |
40 | EXCL@[325; 326) "!" | 40 | BANG@[325; 326) "!" |
41 | L_BRACK@[326; 327) "[" | 41 | L_BRACK@[326; 327) "[" |
42 | PATH@[327; 332) | 42 | PATH@[327; 332) |
43 | PATH_SEGMENT@[327; 332) | 43 | PATH_SEGMENT@[327; 332) |
@@ -51,7 +51,7 @@ SOURCE_FILE@[0; 3813) | |||
51 | WHITESPACE@[351; 352) "\n" | 51 | WHITESPACE@[351; 352) "\n" |
52 | ATTR@[352; 376) | 52 | ATTR@[352; 376) |
53 | POUND@[352; 353) "#" | 53 | POUND@[352; 353) "#" |
54 | EXCL@[353; 354) "!" | 54 | BANG@[353; 354) "!" |
55 | L_BRACK@[354; 355) "[" | 55 | L_BRACK@[354; 355) "[" |
56 | PATH@[355; 360) | 56 | PATH@[355; 360) |
57 | PATH_SEGMENT@[355; 360) | 57 | PATH_SEGMENT@[355; 360) |
@@ -65,7 +65,7 @@ SOURCE_FILE@[0; 3813) | |||
65 | WHITESPACE@[376; 378) "\n\n" | 65 | WHITESPACE@[376; 378) "\n\n" |
66 | ATTR@[378; 405) | 66 | ATTR@[378; 405) |
67 | POUND@[378; 379) "#" | 67 | POUND@[378; 379) "#" |
68 | EXCL@[379; 380) "!" | 68 | BANG@[379; 380) "!" |
69 | L_BRACK@[380; 381) "[" | 69 | L_BRACK@[380; 381) "[" |
70 | PATH@[381; 396) | 70 | PATH@[381; 396) |
71 | PATH_SEGMENT@[381; 396) | 71 | PATH_SEGMENT@[381; 396) |
@@ -88,15 +88,15 @@ SOURCE_FILE@[0; 3813) | |||
88 | PATH_SEGMENT@[411; 414) | 88 | PATH_SEGMENT@[411; 414) |
89 | NAME_REF@[411; 414) | 89 | NAME_REF@[411; 414) |
90 | IDENT@[411; 414) "std" | 90 | IDENT@[411; 414) "std" |
91 | COLONCOLON@[414; 416) "::" | 91 | COLON2@[414; 416) "::" |
92 | PATH_SEGMENT@[416; 420) | 92 | PATH_SEGMENT@[416; 420) |
93 | NAME_REF@[416; 420) | 93 | NAME_REF@[416; 420) |
94 | IDENT@[416; 420) "cell" | 94 | IDENT@[416; 420) "cell" |
95 | COLONCOLON@[420; 422) "::" | 95 | COLON2@[420; 422) "::" |
96 | PATH_SEGMENT@[422; 426) | 96 | PATH_SEGMENT@[422; 426) |
97 | NAME_REF@[422; 426) | 97 | NAME_REF@[422; 426) |
98 | IDENT@[422; 426) "Cell" | 98 | IDENT@[422; 426) "Cell" |
99 | SEMI@[426; 427) ";" | 99 | SEMICOLON@[426; 427) ";" |
100 | WHITESPACE@[427; 428) "\n" | 100 | WHITESPACE@[427; 428) "\n" |
101 | USE_ITEM@[428; 447) | 101 | USE_ITEM@[428; 447) |
102 | USE_KW@[428; 431) "use" | 102 | USE_KW@[428; 431) "use" |
@@ -108,15 +108,15 @@ SOURCE_FILE@[0; 3813) | |||
108 | PATH_SEGMENT@[432; 435) | 108 | PATH_SEGMENT@[432; 435) |
109 | NAME_REF@[432; 435) | 109 | NAME_REF@[432; 435) |
110 | IDENT@[432; 435) "std" | 110 | IDENT@[432; 435) "std" |
111 | COLONCOLON@[435; 437) "::" | 111 | COLON2@[435; 437) "::" |
112 | PATH_SEGMENT@[437; 440) | 112 | PATH_SEGMENT@[437; 440) |
113 | NAME_REF@[437; 440) | 113 | NAME_REF@[437; 440) |
114 | IDENT@[437; 440) "mem" | 114 | IDENT@[437; 440) "mem" |
115 | COLONCOLON@[440; 442) "::" | 115 | COLON2@[440; 442) "::" |
116 | PATH_SEGMENT@[442; 446) | 116 | PATH_SEGMENT@[442; 446) |
117 | NAME_REF@[442; 446) | 117 | NAME_REF@[442; 446) |
118 | IDENT@[442; 446) "swap" | 118 | IDENT@[442; 446) "swap" |
119 | SEMI@[446; 447) ";" | 119 | SEMICOLON@[446; 447) ";" |
120 | WHITESPACE@[447; 449) "\n\n" | 120 | WHITESPACE@[447; 449) "\n\n" |
121 | COMMENT@[449; 518) "// Just a grab bag of ..." | 121 | COMMENT@[449; 518) "// Just a grab bag of ..." |
122 | WHITESPACE@[518; 520) "\n\n" | 122 | WHITESPACE@[518; 520) "\n\n" |
@@ -163,7 +163,7 @@ SOURCE_FILE@[0; 3813) | |||
163 | WHITESPACE@[564; 565) " " | 163 | WHITESPACE@[564; 565) " " |
164 | LITERAL@[565; 569) | 164 | LITERAL@[565; 569) |
165 | TRUE_KW@[565; 569) "true" | 165 | TRUE_KW@[565; 569) "true" |
166 | SEMI@[569; 570) ";" | 166 | SEMICOLON@[569; 570) ";" |
167 | WHITESPACE@[570; 571) " " | 167 | WHITESPACE@[570; 571) " " |
168 | R_CURLY@[571; 572) "}" | 168 | R_CURLY@[571; 572) "}" |
169 | WHITESPACE@[572; 574) "\n\n" | 169 | WHITESPACE@[572; 574) "\n\n" |
@@ -216,7 +216,7 @@ SOURCE_FILE@[0; 3813) | |||
216 | RETURN_EXPR@[614; 620) | 216 | RETURN_EXPR@[614; 620) |
217 | RETURN_KW@[614; 620) "return" | 217 | RETURN_KW@[614; 620) "return" |
218 | R_PAREN@[620; 621) ")" | 218 | R_PAREN@[620; 621) ")" |
219 | SEMI@[621; 622) ";" | 219 | SEMICOLON@[621; 622) ";" |
220 | WHITESPACE@[622; 623) "\n" | 220 | WHITESPACE@[622; 623) "\n" |
221 | R_CURLY@[623; 624) "}" | 221 | R_CURLY@[623; 624) "}" |
222 | WHITESPACE@[624; 626) "\n\n" | 222 | WHITESPACE@[624; 626) "\n\n" |
@@ -277,7 +277,7 @@ SOURCE_FILE@[0; 3813) | |||
277 | WHITESPACE@[687; 688) " " | 277 | WHITESPACE@[687; 688) " " |
278 | CONDITION@[688; 696) | 278 | CONDITION@[688; 696) |
279 | PREFIX_EXPR@[688; 696) | 279 | PREFIX_EXPR@[688; 696) |
280 | EXCL@[688; 689) "!" | 280 | BANG@[688; 689) "!" |
281 | METHOD_CALL_EXPR@[689; 696) | 281 | METHOD_CALL_EXPR@[689; 696) |
282 | PATH_EXPR@[689; 690) | 282 | PATH_EXPR@[689; 690) |
283 | PATH@[689; 690) | 283 | PATH@[689; 690) |
@@ -310,10 +310,10 @@ SOURCE_FILE@[0; 3813) | |||
310 | LITERAL@[705; 709) | 310 | LITERAL@[705; 709) |
311 | TRUE_KW@[705; 709) "true" | 311 | TRUE_KW@[705; 709) "true" |
312 | R_PAREN@[709; 710) ")" | 312 | R_PAREN@[709; 710) ")" |
313 | SEMI@[710; 711) ";" | 313 | SEMICOLON@[710; 711) ";" |
314 | WHITESPACE@[711; 712) " " | 314 | WHITESPACE@[711; 712) " " |
315 | R_CURLY@[712; 713) "}" | 315 | R_CURLY@[712; 713) "}" |
316 | SEMI@[713; 714) ";" | 316 | SEMICOLON@[713; 714) ";" |
317 | WHITESPACE@[714; 719) "\n " | 317 | WHITESPACE@[714; 719) "\n " |
318 | R_CURLY@[719; 720) "}" | 318 | R_CURLY@[719; 720) "}" |
319 | WHITESPACE@[720; 725) "\n " | 319 | WHITESPACE@[720; 725) "\n " |
@@ -335,7 +335,7 @@ SOURCE_FILE@[0; 3813) | |||
335 | PATH_SEGMENT@[734; 738) | 335 | PATH_SEGMENT@[734; 738) |
336 | NAME_REF@[734; 738) | 336 | NAME_REF@[734; 738) |
337 | IDENT@[734; 738) "Cell" | 337 | IDENT@[734; 738) "Cell" |
338 | COLONCOLON@[738; 740) "::" | 338 | COLON2@[738; 740) "::" |
339 | PATH_SEGMENT@[740; 743) | 339 | PATH_SEGMENT@[740; 743) |
340 | NAME_REF@[740; 743) | 340 | NAME_REF@[740; 743) |
341 | IDENT@[740; 743) "new" | 341 | IDENT@[740; 743) "new" |
@@ -344,7 +344,7 @@ SOURCE_FILE@[0; 3813) | |||
344 | LITERAL@[744; 749) | 344 | LITERAL@[744; 749) |
345 | FALSE_KW@[744; 749) "false" | 345 | FALSE_KW@[744; 749) "false" |
346 | R_PAREN@[749; 750) ")" | 346 | R_PAREN@[749; 750) ")" |
347 | SEMI@[750; 751) ";" | 347 | SEMICOLON@[750; 751) ";" |
348 | WHITESPACE@[751; 756) "\n " | 348 | WHITESPACE@[751; 756) "\n " |
349 | LET_STMT@[756; 778) | 349 | LET_STMT@[756; 778) |
350 | LET_KW@[756; 759) "let" | 350 | LET_KW@[756; 759) "let" |
@@ -377,7 +377,7 @@ SOURCE_FILE@[0; 3813) | |||
377 | IDENT@[774; 775) "i" | 377 | IDENT@[774; 775) "i" |
378 | R_PAREN@[775; 776) ")" | 378 | R_PAREN@[775; 776) ")" |
379 | R_CURLY@[776; 777) "}" | 379 | R_CURLY@[776; 777) "}" |
380 | SEMI@[777; 778) ";" | 380 | SEMICOLON@[777; 778) ";" |
381 | WHITESPACE@[778; 783) "\n " | 381 | WHITESPACE@[778; 783) "\n " |
382 | EXPR_STMT@[783; 790) | 382 | EXPR_STMT@[783; 790) |
383 | CALL_EXPR@[783; 789) | 383 | CALL_EXPR@[783; 789) |
@@ -389,7 +389,7 @@ SOURCE_FILE@[0; 3813) | |||
389 | ARG_LIST@[787; 789) | 389 | ARG_LIST@[787; 789) |
390 | L_PAREN@[787; 788) "(" | 390 | L_PAREN@[787; 788) "(" |
391 | R_PAREN@[788; 789) ")" | 391 | R_PAREN@[788; 789) ")" |
392 | SEMI@[789; 790) ";" | 392 | SEMICOLON@[789; 790) ";" |
393 | WHITESPACE@[790; 795) "\n " | 393 | WHITESPACE@[790; 795) "\n " |
394 | EXPR_STMT@[795; 814) | 394 | EXPR_STMT@[795; 814) |
395 | MACRO_CALL@[795; 813) | 395 | MACRO_CALL@[795; 813) |
@@ -397,7 +397,7 @@ SOURCE_FILE@[0; 3813) | |||
397 | PATH_SEGMENT@[795; 801) | 397 | PATH_SEGMENT@[795; 801) |
398 | NAME_REF@[795; 801) | 398 | NAME_REF@[795; 801) |
399 | IDENT@[795; 801) "assert" | 399 | IDENT@[795; 801) "assert" |
400 | EXCL@[801; 802) "!" | 400 | BANG@[801; 802) "!" |
401 | TOKEN_TREE@[802; 813) | 401 | TOKEN_TREE@[802; 813) |
402 | L_PAREN@[802; 803) "(" | 402 | L_PAREN@[802; 803) "(" |
403 | TOKEN_TREE@[803; 812) | 403 | TOKEN_TREE@[803; 812) |
@@ -410,7 +410,7 @@ SOURCE_FILE@[0; 3813) | |||
410 | R_PAREN@[810; 811) ")" | 410 | R_PAREN@[810; 811) ")" |
411 | R_PAREN@[811; 812) ")" | 411 | R_PAREN@[811; 812) ")" |
412 | R_PAREN@[812; 813) ")" | 412 | R_PAREN@[812; 813) ")" |
413 | SEMI@[813; 814) ";" | 413 | SEMICOLON@[813; 814) ";" |
414 | WHITESPACE@[814; 815) "\n" | 414 | WHITESPACE@[814; 815) "\n" |
415 | R_CURLY@[815; 816) "}" | 415 | R_CURLY@[815; 816) "}" |
416 | WHITESPACE@[816; 818) "\n\n" | 416 | WHITESPACE@[816; 818) "\n\n" |
@@ -535,7 +535,7 @@ SOURCE_FILE@[0; 3813) | |||
535 | R_CURLY@[1182; 1183) "}" | 535 | R_CURLY@[1182; 1183) "}" |
536 | WHITESPACE@[1183; 1200) "\n " | 536 | WHITESPACE@[1183; 1200) "\n " |
537 | R_CURLY@[1200; 1201) "}" | 537 | R_CURLY@[1200; 1201) "}" |
538 | SEMI@[1201; 1202) ";" | 538 | SEMICOLON@[1201; 1202) ";" |
539 | WHITESPACE@[1202; 1215) "\n " | 539 | WHITESPACE@[1202; 1215) "\n " |
540 | R_CURLY@[1215; 1216) "}" | 540 | R_CURLY@[1215; 1216) "}" |
541 | WHITESPACE@[1216; 1217) " " | 541 | WHITESPACE@[1216; 1217) " " |
@@ -558,7 +558,7 @@ SOURCE_FILE@[0; 3813) | |||
558 | EXPR_STMT@[1252; 1259) | 558 | EXPR_STMT@[1252; 1259) |
559 | RETURN_EXPR@[1252; 1258) | 559 | RETURN_EXPR@[1252; 1258) |
560 | RETURN_KW@[1252; 1258) "return" | 560 | RETURN_KW@[1252; 1258) "return" |
561 | SEMI@[1258; 1259) ";" | 561 | SEMICOLON@[1258; 1259) ";" |
562 | WHITESPACE@[1259; 1272) "\n " | 562 | WHITESPACE@[1259; 1272) "\n " |
563 | R_CURLY@[1272; 1273) "}" | 563 | R_CURLY@[1272; 1273) "}" |
564 | WHITESPACE@[1273; 1282) "\n " | 564 | WHITESPACE@[1273; 1282) "\n " |
@@ -581,7 +581,7 @@ SOURCE_FILE@[0; 3813) | |||
581 | EXPR_STMT@[1306; 1312) | 581 | EXPR_STMT@[1306; 1312) |
582 | BREAK_EXPR@[1306; 1311) | 582 | BREAK_EXPR@[1306; 1311) |
583 | BREAK_KW@[1306; 1311) "break" | 583 | BREAK_KW@[1306; 1311) "break" |
584 | SEMI@[1311; 1312) ";" | 584 | SEMICOLON@[1311; 1312) ";" |
585 | WHITESPACE@[1312; 1313) " " | 585 | WHITESPACE@[1312; 1313) " " |
586 | R_CURLY@[1313; 1314) "}" | 586 | R_CURLY@[1313; 1314) "}" |
587 | WHITESPACE@[1314; 1319) "\n " | 587 | WHITESPACE@[1314; 1319) "\n " |
@@ -617,7 +617,7 @@ SOURCE_FILE@[0; 3813) | |||
617 | PATH_SEGMENT@[1355; 1360) | 617 | PATH_SEGMENT@[1355; 1360) |
618 | NAME_REF@[1355; 1360) | 618 | NAME_REF@[1355; 1360) |
619 | IDENT@[1355; 1360) "isize" | 619 | IDENT@[1355; 1360) "isize" |
620 | SEMI@[1360; 1361) ";" | 620 | SEMICOLON@[1360; 1361) ";" |
621 | WHITESPACE@[1361; 1366) "\n " | 621 | WHITESPACE@[1361; 1366) "\n " |
622 | LET_STMT@[1366; 1400) | 622 | LET_STMT@[1366; 1400) |
623 | LET_KW@[1366; 1369) "let" | 623 | LET_KW@[1366; 1369) "let" |
@@ -646,7 +646,7 @@ SOURCE_FILE@[0; 3813) | |||
646 | INT_NUMBER@[1385; 1386) "0" | 646 | INT_NUMBER@[1385; 1386) "0" |
647 | R_PAREN@[1386; 1387) ")" | 647 | R_PAREN@[1386; 1387) ")" |
648 | WHITESPACE@[1387; 1388) " " | 648 | WHITESPACE@[1387; 1388) " " |
649 | EQEQ@[1388; 1390) "==" | 649 | EQ2@[1388; 1390) "==" |
650 | WHITESPACE@[1390; 1391) " " | 650 | WHITESPACE@[1390; 1391) " " |
651 | PAREN_EXPR@[1391; 1399) | 651 | PAREN_EXPR@[1391; 1399) |
652 | L_PAREN@[1391; 1392) "(" | 652 | L_PAREN@[1391; 1392) "(" |
@@ -662,7 +662,7 @@ SOURCE_FILE@[0; 3813) | |||
662 | LITERAL@[1397; 1398) | 662 | LITERAL@[1397; 1398) |
663 | INT_NUMBER@[1397; 1398) "0" | 663 | INT_NUMBER@[1397; 1398) "0" |
664 | R_PAREN@[1398; 1399) ")" | 664 | R_PAREN@[1398; 1399) ")" |
665 | SEMI@[1399; 1400) ";" | 665 | SEMICOLON@[1399; 1400) ";" |
666 | WHITESPACE@[1400; 1405) "\n " | 666 | WHITESPACE@[1400; 1405) "\n " |
667 | LET_STMT@[1405; 1438) | 667 | LET_STMT@[1405; 1438) |
668 | LET_KW@[1405; 1408) "let" | 668 | LET_KW@[1405; 1408) "let" |
@@ -707,7 +707,7 @@ SOURCE_FILE@[0; 3813) | |||
707 | LITERAL@[1435; 1436) | 707 | LITERAL@[1435; 1436) |
708 | INT_NUMBER@[1435; 1436) "0" | 708 | INT_NUMBER@[1435; 1436) "0" |
709 | R_PAREN@[1436; 1437) ")" | 709 | R_PAREN@[1436; 1437) ")" |
710 | SEMI@[1437; 1438) ";" | 710 | SEMICOLON@[1437; 1438) ";" |
711 | WHITESPACE@[1438; 1443) "\n " | 711 | WHITESPACE@[1438; 1443) "\n " |
712 | LET_STMT@[1443; 1474) | 712 | LET_STMT@[1443; 1474) |
713 | LET_KW@[1443; 1446) "let" | 713 | LET_KW@[1443; 1446) "let" |
@@ -734,7 +734,7 @@ SOURCE_FILE@[0; 3813) | |||
734 | INT_NUMBER@[1459; 1460) "0" | 734 | INT_NUMBER@[1459; 1460) "0" |
735 | R_PAREN@[1460; 1461) ")" | 735 | R_PAREN@[1460; 1461) ")" |
736 | WHITESPACE@[1461; 1462) " " | 736 | WHITESPACE@[1461; 1462) " " |
737 | EQEQ@[1462; 1464) "==" | 737 | EQ2@[1462; 1464) "==" |
738 | WHITESPACE@[1464; 1465) " " | 738 | WHITESPACE@[1464; 1465) " " |
739 | PAREN_EXPR@[1465; 1473) | 739 | PAREN_EXPR@[1465; 1473) |
740 | L_PAREN@[1465; 1466) "(" | 740 | L_PAREN@[1465; 1466) "(" |
@@ -750,7 +750,7 @@ SOURCE_FILE@[0; 3813) | |||
750 | LITERAL@[1471; 1472) | 750 | LITERAL@[1471; 1472) |
751 | INT_NUMBER@[1471; 1472) "0" | 751 | INT_NUMBER@[1471; 1472) "0" |
752 | R_PAREN@[1472; 1473) ")" | 752 | R_PAREN@[1472; 1473) ")" |
753 | SEMI@[1473; 1474) ";" | 753 | SEMICOLON@[1473; 1474) ";" |
754 | WHITESPACE@[1474; 1479) "\n " | 754 | WHITESPACE@[1474; 1479) "\n " |
755 | LET_STMT@[1479; 1537) | 755 | LET_STMT@[1479; 1537) |
756 | LET_KW@[1479; 1482) "let" | 756 | LET_KW@[1479; 1482) "let" |
@@ -792,7 +792,7 @@ SOURCE_FILE@[0; 3813) | |||
792 | IDENT@[1507; 1509) "_z" | 792 | IDENT@[1507; 1509) "_z" |
793 | R_PAREN@[1509; 1510) ")" | 793 | R_PAREN@[1509; 1510) ")" |
794 | WHITESPACE@[1510; 1511) " " | 794 | WHITESPACE@[1510; 1511) " " |
795 | EQEQ@[1511; 1513) "==" | 795 | EQ2@[1511; 1513) "==" |
796 | WHITESPACE@[1513; 1514) " " | 796 | WHITESPACE@[1513; 1514) " " |
797 | CALL_EXPR@[1514; 1536) | 797 | CALL_EXPR@[1514; 1536) |
798 | PATH_EXPR@[1514; 1518) | 798 | PATH_EXPR@[1514; 1518) |
@@ -823,7 +823,7 @@ SOURCE_FILE@[0; 3813) | |||
823 | NAME_REF@[1533; 1535) | 823 | NAME_REF@[1533; 1535) |
824 | IDENT@[1533; 1535) "_z" | 824 | IDENT@[1533; 1535) "_z" |
825 | R_PAREN@[1535; 1536) ")" | 825 | R_PAREN@[1535; 1536) ")" |
826 | SEMI@[1536; 1537) ";" | 826 | SEMICOLON@[1536; 1537) ";" |
827 | WHITESPACE@[1537; 1538) "\n" | 827 | WHITESPACE@[1537; 1538) "\n" |
828 | R_CURLY@[1538; 1539) "}" | 828 | R_CURLY@[1538; 1539) "}" |
829 | WHITESPACE@[1539; 1541) "\n\n" | 829 | WHITESPACE@[1539; 1541) "\n\n" |
@@ -893,7 +893,7 @@ SOURCE_FILE@[0; 3813) | |||
893 | PATH_SEGMENT@[1613; 1619) | 893 | PATH_SEGMENT@[1613; 1619) |
894 | NAME_REF@[1613; 1619) | 894 | NAME_REF@[1613; 1619) |
895 | IDENT@[1613; 1619) "assert" | 895 | IDENT@[1613; 1619) "assert" |
896 | EXCL@[1619; 1620) "!" | 896 | BANG@[1619; 1620) "!" |
897 | TOKEN_TREE@[1620; 1628) | 897 | TOKEN_TREE@[1620; 1628) |
898 | L_PAREN@[1620; 1621) "(" | 898 | L_PAREN@[1620; 1621) "(" |
899 | TOKEN_TREE@[1621; 1627) | 899 | TOKEN_TREE@[1621; 1627) |
@@ -902,7 +902,7 @@ SOURCE_FILE@[0; 3813) | |||
902 | R_PAREN@[1626; 1627) ")" | 902 | R_PAREN@[1626; 1627) ")" |
903 | R_PAREN@[1627; 1628) ")" | 903 | R_PAREN@[1627; 1628) ")" |
904 | WHITESPACE@[1628; 1629) " " | 904 | WHITESPACE@[1628; 1629) " " |
905 | EQEQ@[1629; 1631) "==" | 905 | EQ2@[1629; 1631) "==" |
906 | WHITESPACE@[1631; 1632) " " | 906 | WHITESPACE@[1631; 1632) " " |
907 | PAREN_EXPR@[1632; 1646) | 907 | PAREN_EXPR@[1632; 1646) |
908 | L_PAREN@[1632; 1633) "(" | 908 | L_PAREN@[1632; 1633) "(" |
@@ -911,7 +911,7 @@ SOURCE_FILE@[0; 3813) | |||
911 | PATH_SEGMENT@[1633; 1639) | 911 | PATH_SEGMENT@[1633; 1639) |
912 | NAME_REF@[1633; 1639) | 912 | NAME_REF@[1633; 1639) |
913 | IDENT@[1633; 1639) "assert" | 913 | IDENT@[1633; 1639) "assert" |
914 | EXCL@[1639; 1640) "!" | 914 | BANG@[1639; 1640) "!" |
915 | TOKEN_TREE@[1640; 1645) | 915 | TOKEN_TREE@[1640; 1645) |
916 | L_PAREN@[1640; 1641) "(" | 916 | L_PAREN@[1640; 1641) "(" |
917 | IDENT@[1641; 1642) "p" | 917 | IDENT@[1641; 1642) "p" |
@@ -921,7 +921,7 @@ SOURCE_FILE@[0; 3813) | |||
921 | R_PAREN@[1644; 1645) ")" | 921 | R_PAREN@[1644; 1645) ")" |
922 | R_PAREN@[1645; 1646) ")" | 922 | R_PAREN@[1645; 1646) ")" |
923 | R_PAREN@[1646; 1647) ")" | 923 | R_PAREN@[1646; 1647) ")" |
924 | SEMI@[1647; 1648) ";" | 924 | SEMICOLON@[1647; 1648) ";" |
925 | WHITESPACE@[1648; 1653) "\n " | 925 | WHITESPACE@[1648; 1653) "\n " |
926 | LET_STMT@[1653; 1685) | 926 | LET_STMT@[1653; 1685) |
927 | LET_KW@[1653; 1656) "let" | 927 | LET_KW@[1653; 1656) "let" |
@@ -940,7 +940,7 @@ SOURCE_FILE@[0; 3813) | |||
940 | PATH_SEGMENT@[1663; 1669) | 940 | PATH_SEGMENT@[1663; 1669) |
941 | NAME_REF@[1663; 1669) | 941 | NAME_REF@[1663; 1669) |
942 | IDENT@[1663; 1669) "assert" | 942 | IDENT@[1663; 1669) "assert" |
943 | EXCL@[1669; 1670) "!" | 943 | BANG@[1669; 1670) "!" |
944 | TOKEN_TREE@[1670; 1677) | 944 | TOKEN_TREE@[1670; 1677) |
945 | L_PAREN@[1670; 1671) "(" | 945 | L_PAREN@[1670; 1671) "(" |
946 | TOKEN_TREE@[1671; 1676) | 946 | TOKEN_TREE@[1671; 1676) |
@@ -952,13 +952,13 @@ SOURCE_FILE@[0; 3813) | |||
952 | R_PAREN@[1675; 1676) ")" | 952 | R_PAREN@[1675; 1676) ")" |
953 | R_PAREN@[1676; 1677) ")" | 953 | R_PAREN@[1676; 1677) ")" |
954 | WHITESPACE@[1677; 1678) " " | 954 | WHITESPACE@[1677; 1678) " " |
955 | EQEQ@[1678; 1680) "==" | 955 | EQ2@[1678; 1680) "==" |
956 | WHITESPACE@[1680; 1681) " " | 956 | WHITESPACE@[1680; 1681) " " |
957 | TUPLE_EXPR@[1681; 1683) | 957 | TUPLE_EXPR@[1681; 1683) |
958 | L_PAREN@[1681; 1682) "(" | 958 | L_PAREN@[1681; 1682) "(" |
959 | R_PAREN@[1682; 1683) ")" | 959 | R_PAREN@[1682; 1683) ")" |
960 | R_PAREN@[1683; 1684) ")" | 960 | R_PAREN@[1683; 1684) ")" |
961 | SEMI@[1684; 1685) ";" | 961 | SEMICOLON@[1684; 1685) ";" |
962 | WHITESPACE@[1685; 1690) "\n " | 962 | WHITESPACE@[1685; 1690) "\n " |
963 | LET_STMT@[1690; 1739) | 963 | LET_STMT@[1690; 1739) |
964 | LET_KW@[1690; 1693) "let" | 964 | LET_KW@[1690; 1693) "let" |
@@ -984,7 +984,7 @@ SOURCE_FILE@[0; 3813) | |||
984 | PATH_SEGMENT@[1706; 1713) | 984 | PATH_SEGMENT@[1706; 1713) |
985 | NAME_REF@[1706; 1713) | 985 | NAME_REF@[1706; 1713) |
986 | IDENT@[1706; 1713) "println" | 986 | IDENT@[1706; 1713) "println" |
987 | EXCL@[1713; 1714) "!" | 987 | BANG@[1713; 1714) "!" |
988 | TOKEN_TREE@[1714; 1723) | 988 | TOKEN_TREE@[1714; 1723) |
989 | L_PAREN@[1714; 1715) "(" | 989 | L_PAREN@[1714; 1715) "(" |
990 | STRING@[1715; 1719) "\"{}\"" | 990 | STRING@[1715; 1719) "\"{}\"" |
@@ -993,7 +993,7 @@ SOURCE_FILE@[0; 3813) | |||
993 | INT_NUMBER@[1721; 1722) "0" | 993 | INT_NUMBER@[1721; 1722) "0" |
994 | R_PAREN@[1722; 1723) ")" | 994 | R_PAREN@[1722; 1723) ")" |
995 | WHITESPACE@[1723; 1724) " " | 995 | WHITESPACE@[1723; 1724) " " |
996 | EQEQ@[1724; 1726) "==" | 996 | EQ2@[1724; 1726) "==" |
997 | WHITESPACE@[1726; 1727) " " | 997 | WHITESPACE@[1726; 1727) " " |
998 | PAREN_EXPR@[1727; 1737) | 998 | PAREN_EXPR@[1727; 1737) |
999 | L_PAREN@[1727; 1728) "(" | 999 | L_PAREN@[1727; 1728) "(" |
@@ -1004,7 +1004,7 @@ SOURCE_FILE@[0; 3813) | |||
1004 | INT_NUMBER@[1735; 1736) "0" | 1004 | INT_NUMBER@[1735; 1736) "0" |
1005 | R_PAREN@[1736; 1737) ")" | 1005 | R_PAREN@[1736; 1737) ")" |
1006 | R_PAREN@[1737; 1738) ")" | 1006 | R_PAREN@[1737; 1738) ")" |
1007 | SEMI@[1738; 1739) ";" | 1007 | SEMICOLON@[1738; 1739) ";" |
1008 | WHITESPACE@[1739; 1740) "\n" | 1008 | WHITESPACE@[1739; 1740) "\n" |
1009 | R_CURLY@[1740; 1741) "}" | 1009 | R_CURLY@[1740; 1741) "}" |
1010 | WHITESPACE@[1741; 1743) "\n\n" | 1010 | WHITESPACE@[1741; 1743) "\n\n" |
@@ -1057,7 +1057,7 @@ SOURCE_FILE@[0; 3813) | |||
1057 | WHITESPACE@[1801; 1802) " " | 1057 | WHITESPACE@[1801; 1802) " " |
1058 | LITERAL@[1802; 1803) | 1058 | LITERAL@[1802; 1803) |
1059 | INT_NUMBER@[1802; 1803) "0" | 1059 | INT_NUMBER@[1802; 1803) "0" |
1060 | SEMI@[1803; 1804) ";" | 1060 | SEMICOLON@[1803; 1804) ";" |
1061 | WHITESPACE@[1804; 1809) "\n " | 1061 | WHITESPACE@[1804; 1809) "\n " |
1062 | LOOP_EXPR@[1809; 1902) | 1062 | LOOP_EXPR@[1809; 1902) |
1063 | LOOP_KW@[1809; 1813) "loop" | 1063 | LOOP_KW@[1809; 1813) "loop" |
@@ -1078,7 +1078,7 @@ SOURCE_FILE@[0; 3813) | |||
1078 | WHITESPACE@[1820; 1821) " " | 1078 | WHITESPACE@[1820; 1821) " " |
1079 | LITERAL@[1821; 1822) | 1079 | LITERAL@[1821; 1822) |
1080 | INT_NUMBER@[1821; 1822) "1" | 1080 | INT_NUMBER@[1821; 1822) "1" |
1081 | SEMI@[1822; 1823) ";" | 1081 | SEMICOLON@[1822; 1823) ";" |
1082 | WHITESPACE@[1823; 1824) " " | 1082 | WHITESPACE@[1823; 1824) " " |
1083 | EXPR_STMT@[1824; 1887) | 1083 | EXPR_STMT@[1824; 1887) |
1084 | IF_EXPR@[1824; 1887) | 1084 | IF_EXPR@[1824; 1887) |
@@ -1092,7 +1092,7 @@ SOURCE_FILE@[0; 3813) | |||
1092 | NAME_REF@[1827; 1828) | 1092 | NAME_REF@[1827; 1828) |
1093 | IDENT@[1827; 1828) "i" | 1093 | IDENT@[1827; 1828) "i" |
1094 | WHITESPACE@[1828; 1829) " " | 1094 | WHITESPACE@[1828; 1829) " " |
1095 | EQEQ@[1829; 1831) "==" | 1095 | EQ2@[1829; 1831) "==" |
1096 | WHITESPACE@[1831; 1832) " " | 1096 | WHITESPACE@[1831; 1832) " " |
1097 | LITERAL@[1832; 1833) | 1097 | LITERAL@[1832; 1833) |
1098 | INT_NUMBER@[1832; 1833) "1" | 1098 | INT_NUMBER@[1832; 1833) "1" |
@@ -1138,7 +1138,7 @@ SOURCE_FILE@[0; 3813) | |||
1138 | PATH_SEGMENT@[1870; 1875) | 1138 | PATH_SEGMENT@[1870; 1875) |
1139 | NAME_REF@[1870; 1875) | 1139 | NAME_REF@[1870; 1875) |
1140 | IDENT@[1870; 1875) "panic" | 1140 | IDENT@[1870; 1875) "panic" |
1141 | EXCL@[1875; 1876) "!" | 1141 | BANG@[1875; 1876) "!" |
1142 | TOKEN_TREE@[1876; 1883) | 1142 | TOKEN_TREE@[1876; 1883) |
1143 | L_PAREN@[1876; 1877) "(" | 1143 | L_PAREN@[1876; 1877) "(" |
1144 | STRING@[1877; 1882) "\"wat\"" | 1144 | STRING@[1877; 1882) "\"wat\"" |
@@ -1151,7 +1151,7 @@ SOURCE_FILE@[0; 3813) | |||
1151 | EXPR_STMT@[1894; 1900) | 1151 | EXPR_STMT@[1894; 1900) |
1152 | BREAK_EXPR@[1894; 1899) | 1152 | BREAK_EXPR@[1894; 1899) |
1153 | BREAK_KW@[1894; 1899) "break" | 1153 | BREAK_KW@[1894; 1899) "break" |
1154 | SEMI@[1899; 1900) ";" | 1154 | SEMICOLON@[1899; 1900) ";" |
1155 | WHITESPACE@[1900; 1901) " " | 1155 | WHITESPACE@[1900; 1901) " " |
1156 | R_CURLY@[1901; 1902) "}" | 1156 | R_CURLY@[1901; 1902) "}" |
1157 | WHITESPACE@[1902; 1903) "\n" | 1157 | WHITESPACE@[1902; 1903) "\n" |
@@ -1184,12 +1184,12 @@ SOURCE_FILE@[0; 3813) | |||
1184 | PATH_SEGMENT@[1938; 1945) | 1184 | PATH_SEGMENT@[1938; 1945) |
1185 | NAME_REF@[1938; 1945) | 1185 | NAME_REF@[1938; 1945) |
1186 | IDENT@[1938; 1945) "println" | 1186 | IDENT@[1938; 1945) "println" |
1187 | EXCL@[1945; 1946) "!" | 1187 | BANG@[1945; 1946) "!" |
1188 | TOKEN_TREE@[1946; 1957) | 1188 | TOKEN_TREE@[1946; 1957) |
1189 | L_PAREN@[1946; 1947) "(" | 1189 | L_PAREN@[1946; 1947) "(" |
1190 | STRING@[1947; 1956) "\"lincoln\"" | 1190 | STRING@[1947; 1956) "\"lincoln\"" |
1191 | R_PAREN@[1956; 1957) ")" | 1191 | R_PAREN@[1956; 1957) ")" |
1192 | SEMI@[1957; 1958) ";" | 1192 | SEMICOLON@[1957; 1958) ";" |
1193 | WHITESPACE@[1958; 1959) " " | 1193 | WHITESPACE@[1958; 1959) " " |
1194 | R_CURLY@[1959; 1960) "}" | 1194 | R_CURLY@[1959; 1960) "}" |
1195 | WHITESPACE@[1960; 1962) "\n\n" | 1195 | WHITESPACE@[1960; 1962) "\n\n" |
@@ -1212,7 +1212,7 @@ SOURCE_FILE@[0; 3813) | |||
1212 | PATH_SEGMENT@[1978; 1987) | 1212 | PATH_SEGMENT@[1978; 1987) |
1213 | NAME_REF@[1978; 1987) | 1213 | NAME_REF@[1978; 1987) |
1214 | IDENT@[1978; 1987) "assert_eq" | 1214 | IDENT@[1978; 1987) "assert_eq" |
1215 | EXCL@[1987; 1988) "!" | 1215 | BANG@[1987; 1988) "!" |
1216 | TOKEN_TREE@[1988; 2195) | 1216 | TOKEN_TREE@[1988; 2195) |
1217 | L_PAREN@[1988; 1989) "(" | 1217 | L_PAREN@[1988; 1989) "(" |
1218 | IDENT@[1989; 1995) "String" | 1218 | IDENT@[1989; 1995) "String" |
@@ -1226,7 +1226,7 @@ SOURCE_FILE@[0; 3813) | |||
1226 | COMMA@[2055; 2056) "," | 1226 | COMMA@[2055; 2056) "," |
1227 | WHITESPACE@[2056; 2072) "\n " | 1227 | WHITESPACE@[2056; 2072) "\n " |
1228 | IDENT@[2072; 2078) "format" | 1228 | IDENT@[2072; 2078) "format" |
1229 | EXCL@[2078; 2079) "!" | 1229 | BANG@[2078; 2079) "!" |
1230 | TOKEN_TREE@[2079; 2194) | 1230 | TOKEN_TREE@[2079; 2194) |
1231 | L_PAREN@[2079; 2080) "(" | 1231 | L_PAREN@[2079; 2080) "(" |
1232 | STRING@[2080; 2086) "\"{:?}\"" | 1232 | STRING@[2080; 2086) "\"{:?}\"" |
@@ -1308,7 +1308,7 @@ SOURCE_FILE@[0; 3813) | |||
1308 | DOT@[2192; 2193) "." | 1308 | DOT@[2192; 2193) "." |
1309 | R_PAREN@[2193; 2194) ")" | 1309 | R_PAREN@[2193; 2194) ")" |
1310 | R_PAREN@[2194; 2195) ")" | 1310 | R_PAREN@[2194; 2195) ")" |
1311 | SEMI@[2195; 2196) ";" | 1311 | SEMICOLON@[2195; 2196) ";" |
1312 | WHITESPACE@[2196; 2197) "\n" | 1312 | WHITESPACE@[2196; 2197) "\n" |
1313 | R_CURLY@[2197; 2198) "}" | 1313 | R_CURLY@[2197; 2198) "}" |
1314 | WHITESPACE@[2198; 2200) "\n\n" | 1314 | WHITESPACE@[2198; 2200) "\n\n" |
@@ -1362,7 +1362,7 @@ SOURCE_FILE@[0; 3813) | |||
1362 | PATH_SEGMENT@[2243; 2252) | 1362 | PATH_SEGMENT@[2243; 2252) |
1363 | NAME_REF@[2243; 2252) | 1363 | NAME_REF@[2243; 2252) |
1364 | IDENT@[2243; 2252) "assert_eq" | 1364 | IDENT@[2243; 2252) "assert_eq" |
1365 | EXCL@[2252; 2253) "!" | 1365 | BANG@[2252; 2253) "!" |
1366 | TOKEN_TREE@[2253; 2684) | 1366 | TOKEN_TREE@[2253; 2684) |
1367 | L_PAREN@[2253; 2254) "(" | 1367 | L_PAREN@[2253; 2254) "(" |
1368 | INT_NUMBER@[2254; 2257) "8u8" | 1368 | INT_NUMBER@[2254; 2257) "8u8" |
@@ -1372,7 +1372,7 @@ SOURCE_FILE@[0; 3813) | |||
1372 | L_CURLY@[2259; 2260) "{" | 1372 | L_CURLY@[2259; 2260) "{" |
1373 | WHITESPACE@[2260; 2273) "\n " | 1373 | WHITESPACE@[2260; 2273) "\n " |
1374 | IDENT@[2273; 2284) "macro_rules" | 1374 | IDENT@[2273; 2284) "macro_rules" |
1375 | EXCL@[2284; 2285) "!" | 1375 | BANG@[2284; 2285) "!" |
1376 | WHITESPACE@[2285; 2286) " " | 1376 | WHITESPACE@[2285; 2286) " " |
1377 | IDENT@[2286; 2288) "u8" | 1377 | IDENT@[2286; 2288) "u8" |
1378 | WHITESPACE@[2288; 2289) " " | 1378 | WHITESPACE@[2288; 2289) " " |
@@ -1435,7 +1435,7 @@ SOURCE_FILE@[0; 3813) | |||
1435 | L_CURLY@[2420; 2421) "{" | 1435 | L_CURLY@[2420; 2421) "{" |
1436 | WHITESPACE@[2421; 2450) "\n ..." | 1436 | WHITESPACE@[2421; 2450) "\n ..." |
1437 | STRING@[2450; 2454) "\"u8\"" | 1437 | STRING@[2450; 2454) "\"u8\"" |
1438 | SEMI@[2454; 2455) ";" | 1438 | SEMICOLON@[2454; 2455) ";" |
1439 | WHITESPACE@[2455; 2484) "\n ..." | 1439 | WHITESPACE@[2455; 2484) "\n ..." |
1440 | IDENT@[2484; 2486) "u8" | 1440 | IDENT@[2484; 2486) "u8" |
1441 | WHITESPACE@[2486; 2511) "\n ..." | 1441 | WHITESPACE@[2486; 2511) "\n ..." |
@@ -1444,17 +1444,17 @@ SOURCE_FILE@[0; 3813) | |||
1444 | R_CURLY@[2533; 2534) "}" | 1444 | R_CURLY@[2533; 2534) "}" |
1445 | WHITESPACE@[2534; 2551) "\n " | 1445 | WHITESPACE@[2534; 2551) "\n " |
1446 | R_CURLY@[2551; 2552) "}" | 1446 | R_CURLY@[2551; 2552) "}" |
1447 | SEMI@[2552; 2553) ";" | 1447 | SEMICOLON@[2552; 2553) ";" |
1448 | WHITESPACE@[2553; 2566) "\n " | 1448 | WHITESPACE@[2553; 2566) "\n " |
1449 | R_CURLY@[2566; 2567) "}" | 1449 | R_CURLY@[2566; 2567) "}" |
1450 | WHITESPACE@[2567; 2581) "\n\n " | 1450 | WHITESPACE@[2567; 2581) "\n\n " |
1451 | IDENT@[2581; 2583) "u8" | 1451 | IDENT@[2581; 2583) "u8" |
1452 | EXCL@[2583; 2584) "!" | 1452 | BANG@[2583; 2584) "!" |
1453 | TOKEN_TREE@[2584; 2588) | 1453 | TOKEN_TREE@[2584; 2588) |
1454 | L_PAREN@[2584; 2585) "(" | 1454 | L_PAREN@[2584; 2585) "(" |
1455 | IDENT@[2585; 2587) "u8" | 1455 | IDENT@[2585; 2587) "u8" |
1456 | R_PAREN@[2587; 2588) ")" | 1456 | R_PAREN@[2587; 2588) ")" |
1457 | SEMI@[2588; 2589) ";" | 1457 | SEMICOLON@[2588; 2589) ";" |
1458 | WHITESPACE@[2589; 2602) "\n " | 1458 | WHITESPACE@[2589; 2602) "\n " |
1459 | LET_KW@[2602; 2605) "let" | 1459 | LET_KW@[2602; 2605) "let" |
1460 | WHITESPACE@[2605; 2606) " " | 1460 | WHITESPACE@[2605; 2606) " " |
@@ -1476,7 +1476,7 @@ SOURCE_FILE@[0; 3813) | |||
1476 | AMP@[2624; 2625) "&" | 1476 | AMP@[2624; 2625) "&" |
1477 | INT_NUMBER@[2625; 2628) "8u8" | 1477 | INT_NUMBER@[2625; 2628) "8u8" |
1478 | R_PAREN@[2628; 2629) ")" | 1478 | R_PAREN@[2628; 2629) ")" |
1479 | SEMI@[2629; 2630) ";" | 1479 | SEMICOLON@[2629; 2630) ";" |
1480 | WHITESPACE@[2630; 2643) "\n " | 1480 | WHITESPACE@[2630; 2643) "\n " |
1481 | CRATE_KW@[2643; 2648) "crate" | 1481 | CRATE_KW@[2643; 2648) "crate" |
1482 | COLON@[2648; 2649) ":" | 1482 | COLON@[2648; 2649) ":" |
@@ -1486,13 +1486,13 @@ SOURCE_FILE@[0; 3813) | |||
1486 | L_PAREN@[2652; 2653) "(" | 1486 | L_PAREN@[2652; 2653) "(" |
1487 | INT_NUMBER@[2653; 2656) "0u8" | 1487 | INT_NUMBER@[2653; 2656) "0u8" |
1488 | R_PAREN@[2656; 2657) ")" | 1488 | R_PAREN@[2656; 2657) ")" |
1489 | SEMI@[2657; 2658) ";" | 1489 | SEMICOLON@[2657; 2658) ";" |
1490 | WHITESPACE@[2658; 2671) "\n " | 1490 | WHITESPACE@[2658; 2671) "\n " |
1491 | IDENT@[2671; 2673) "u8" | 1491 | IDENT@[2671; 2673) "u8" |
1492 | WHITESPACE@[2673; 2682) "\n " | 1492 | WHITESPACE@[2673; 2682) "\n " |
1493 | R_CURLY@[2682; 2683) "}" | 1493 | R_CURLY@[2682; 2683) "}" |
1494 | R_PAREN@[2683; 2684) ")" | 1494 | R_PAREN@[2683; 2684) ")" |
1495 | SEMI@[2684; 2685) ";" | 1495 | SEMICOLON@[2684; 2685) ";" |
1496 | WHITESPACE@[2685; 2690) "\n " | 1496 | WHITESPACE@[2685; 2690) "\n " |
1497 | R_CURLY@[2690; 2691) "}" | 1497 | R_CURLY@[2690; 2691) "}" |
1498 | WHITESPACE@[2691; 2692) "\n" | 1498 | WHITESPACE@[2691; 2692) "\n" |
@@ -1517,7 +1517,7 @@ SOURCE_FILE@[0; 3813) | |||
1517 | PATH_SEGMENT@[2712; 2721) | 1517 | PATH_SEGMENT@[2712; 2721) |
1518 | NAME_REF@[2712; 2721) | 1518 | NAME_REF@[2712; 2721) |
1519 | IDENT@[2712; 2721) "assert_eq" | 1519 | IDENT@[2712; 2721) "assert_eq" |
1520 | EXCL@[2721; 2722) "!" | 1520 | BANG@[2721; 2722) "!" |
1521 | TOKEN_TREE@[2722; 2829) | 1521 | TOKEN_TREE@[2722; 2829) |
1522 | L_PAREN@[2722; 2723) "(" | 1522 | L_PAREN@[2722; 2723) "(" |
1523 | IDENT@[2723; 2729) "String" | 1523 | IDENT@[2723; 2729) "String" |
@@ -1575,7 +1575,7 @@ SOURCE_FILE@[0; 3813) | |||
1575 | L_PAREN@[2826; 2827) "(" | 1575 | L_PAREN@[2826; 2827) "(" |
1576 | R_PAREN@[2827; 2828) ")" | 1576 | R_PAREN@[2827; 2828) ")" |
1577 | R_PAREN@[2828; 2829) ")" | 1577 | R_PAREN@[2828; 2829) ")" |
1578 | SEMI@[2829; 2830) ";" | 1578 | SEMICOLON@[2829; 2830) ";" |
1579 | WHITESPACE@[2830; 2831) "\n" | 1579 | WHITESPACE@[2830; 2831) "\n" |
1580 | R_CURLY@[2831; 2832) "}" | 1580 | R_CURLY@[2831; 2832) "}" |
1581 | WHITESPACE@[2832; 2834) "\n\n" | 1581 | WHITESPACE@[2832; 2834) "\n\n" |
@@ -1654,7 +1654,7 @@ SOURCE_FILE@[0; 3813) | |||
1654 | EQ@[2946; 2947) "=" | 1654 | EQ@[2946; 2947) "=" |
1655 | WHITESPACE@[2947; 2948) " " | 1655 | WHITESPACE@[2947; 2948) " " |
1656 | PREFIX_EXPR@[2948; 3013) | 1656 | PREFIX_EXPR@[2948; 3013) |
1657 | EXCL@[2948; 2949) "!" | 1657 | BANG@[2948; 2949) "!" |
1658 | PAREN_EXPR@[2949; 3013) | 1658 | PAREN_EXPR@[2949; 3013) |
1659 | L_PAREN@[2949; 2950) "(" | 1659 | L_PAREN@[2949; 2950) "(" |
1660 | BIN_EXPR@[2950; 3012) | 1660 | BIN_EXPR@[2950; 3012) |
@@ -1668,7 +1668,7 @@ SOURCE_FILE@[0; 3813) | |||
1668 | TUPLE_PAT@[2952; 2956) | 1668 | TUPLE_PAT@[2952; 2956) |
1669 | L_PAREN@[2952; 2953) "(" | 1669 | L_PAREN@[2952; 2953) "(" |
1670 | DOT_DOT_PAT@[2953; 2955) | 1670 | DOT_DOT_PAT@[2953; 2955) |
1671 | DOTDOT@[2953; 2955) ".." | 1671 | DOT2@[2953; 2955) ".." |
1672 | R_PAREN@[2955; 2956) ")" | 1672 | R_PAREN@[2955; 2956) ")" |
1673 | COLON@[2956; 2957) ":" | 1673 | COLON@[2956; 2957) ":" |
1674 | TUPLE_TYPE@[2957; 2962) | 1674 | TUPLE_TYPE@[2957; 2962) |
@@ -1715,7 +1715,7 @@ SOURCE_FILE@[0; 3813) | |||
1715 | L_CURLY@[2992; 2993) "{" | 1715 | L_CURLY@[2992; 2993) "{" |
1716 | R_CURLY@[2993; 2994) "}" | 1716 | R_CURLY@[2993; 2994) "}" |
1717 | R_PAREN@[2994; 2995) ")" | 1717 | R_PAREN@[2994; 2995) ")" |
1718 | EQEQ@[2995; 2997) "==" | 1718 | EQ2@[2995; 2997) "==" |
1719 | BLOCK_EXPR@[2997; 3012) | 1719 | BLOCK_EXPR@[2997; 3012) |
1720 | BLOCK@[2997; 3012) | 1720 | BLOCK@[2997; 3012) |
1721 | L_CURLY@[2997; 2998) "{" | 1721 | L_CURLY@[2997; 2998) "{" |
@@ -1726,20 +1726,20 @@ SOURCE_FILE@[0; 3813) | |||
1726 | ARRAY_EXPR@[2999; 3006) | 1726 | ARRAY_EXPR@[2999; 3006) |
1727 | L_BRACK@[2999; 3000) "[" | 1727 | L_BRACK@[2999; 3000) "[" |
1728 | RANGE_EXPR@[3000; 3005) | 1728 | RANGE_EXPR@[3000; 3005) |
1729 | DOTDOTEQ@[3000; 3003) "..=" | 1729 | DOT2EQ@[3000; 3003) "..=" |
1730 | RANGE_EXPR@[3003; 3005) | 1730 | RANGE_EXPR@[3003; 3005) |
1731 | DOTDOT@[3003; 3005) ".." | 1731 | DOT2@[3003; 3005) ".." |
1732 | R_BRACK@[3005; 3006) "]" | 1732 | R_BRACK@[3005; 3006) "]" |
1733 | L_BRACK@[3006; 3007) "[" | 1733 | L_BRACK@[3006; 3007) "[" |
1734 | RANGE_EXPR@[3007; 3009) | 1734 | RANGE_EXPR@[3007; 3009) |
1735 | DOTDOT@[3007; 3009) ".." | 1735 | DOT2@[3007; 3009) ".." |
1736 | R_BRACK@[3009; 3010) "]" | 1736 | R_BRACK@[3009; 3010) "]" |
1737 | SEMI@[3010; 3011) ";" | 1737 | SEMICOLON@[3010; 3011) ";" |
1738 | R_CURLY@[3011; 3012) "}" | 1738 | R_CURLY@[3011; 3012) "}" |
1739 | R_PAREN@[3012; 3013) ")" | 1739 | R_PAREN@[3012; 3013) ")" |
1740 | COMMENT@[3013; 3015) "//" | 1740 | COMMENT@[3013; 3015) "//" |
1741 | WHITESPACE@[3015; 3020) "\n " | 1741 | WHITESPACE@[3015; 3020) "\n " |
1742 | SEMI@[3020; 3021) ";" | 1742 | SEMICOLON@[3020; 3021) ";" |
1743 | WHITESPACE@[3021; 3026) "\n " | 1743 | WHITESPACE@[3021; 3026) "\n " |
1744 | EXPR_STMT@[3026; 3040) | 1744 | EXPR_STMT@[3026; 3040) |
1745 | MACRO_CALL@[3026; 3039) | 1745 | MACRO_CALL@[3026; 3039) |
@@ -1747,13 +1747,13 @@ SOURCE_FILE@[0; 3813) | |||
1747 | PATH_SEGMENT@[3026; 3032) | 1747 | PATH_SEGMENT@[3026; 3032) |
1748 | NAME_REF@[3026; 3032) | 1748 | NAME_REF@[3026; 3032) |
1749 | IDENT@[3026; 3032) "assert" | 1749 | IDENT@[3026; 3032) "assert" |
1750 | EXCL@[3032; 3033) "!" | 1750 | BANG@[3032; 3033) "!" |
1751 | TOKEN_TREE@[3033; 3039) | 1751 | TOKEN_TREE@[3033; 3039) |
1752 | L_PAREN@[3033; 3034) "(" | 1752 | L_PAREN@[3033; 3034) "(" |
1753 | EXCL@[3034; 3035) "!" | 1753 | BANG@[3034; 3035) "!" |
1754 | IDENT@[3035; 3038) "val" | 1754 | IDENT@[3035; 3038) "val" |
1755 | R_PAREN@[3038; 3039) ")" | 1755 | R_PAREN@[3038; 3039) ")" |
1756 | SEMI@[3039; 3040) ";" | 1756 | SEMICOLON@[3039; 3040) ";" |
1757 | WHITESPACE@[3040; 3041) "\n" | 1757 | WHITESPACE@[3040; 3041) "\n" |
1758 | R_CURLY@[3041; 3042) "}" | 1758 | R_CURLY@[3041; 3042) "}" |
1759 | WHITESPACE@[3042; 3044) "\n\n" | 1759 | WHITESPACE@[3042; 3044) "\n\n" |
@@ -1781,11 +1781,11 @@ SOURCE_FILE@[0; 3813) | |||
1781 | PATH_SEGMENT@[3068; 3071) | 1781 | PATH_SEGMENT@[3068; 3071) |
1782 | NAME_REF@[3068; 3071) | 1782 | NAME_REF@[3068; 3071) |
1783 | IDENT@[3068; 3071) "std" | 1783 | IDENT@[3068; 3071) "std" |
1784 | COLONCOLON@[3071; 3073) "::" | 1784 | COLON2@[3071; 3073) "::" |
1785 | PATH_SEGMENT@[3073; 3076) | 1785 | PATH_SEGMENT@[3073; 3076) |
1786 | NAME_REF@[3073; 3076) | 1786 | NAME_REF@[3073; 3076) |
1787 | IDENT@[3073; 3076) "fmt" | 1787 | IDENT@[3073; 3076) "fmt" |
1788 | COLONCOLON@[3076; 3078) "::" | 1788 | COLON2@[3076; 3078) "::" |
1789 | PATH_SEGMENT@[3078; 3083) | 1789 | PATH_SEGMENT@[3078; 3083) |
1790 | NAME_REF@[3078; 3083) | 1790 | NAME_REF@[3078; 3083) |
1791 | IDENT@[3078; 3083) "Debug" | 1791 | IDENT@[3078; 3083) "Debug" |
@@ -1795,300 +1795,300 @@ SOURCE_FILE@[0; 3813) | |||
1795 | L_CURLY@[3084; 3085) "{" | 1795 | L_CURLY@[3084; 3085) "{" |
1796 | WHITESPACE@[3085; 3090) "\n " | 1796 | WHITESPACE@[3085; 3090) "\n " |
1797 | RANGE_EXPR@[3090; 3512) | 1797 | RANGE_EXPR@[3090; 3512) |
1798 | DOTDOTEQ@[3090; 3093) "..=" | 1798 | DOT2EQ@[3090; 3093) "..=" |
1799 | RANGE_EXPR@[3093; 3512) | 1799 | RANGE_EXPR@[3093; 3512) |
1800 | DOTDOTEQ@[3093; 3096) "..=" | 1800 | DOT2EQ@[3093; 3096) "..=" |
1801 | RANGE_EXPR@[3096; 3512) | 1801 | RANGE_EXPR@[3096; 3512) |
1802 | DOTDOT@[3096; 3098) ".." | 1802 | DOT2@[3096; 3098) ".." |
1803 | WHITESPACE@[3098; 3099) " " | 1803 | WHITESPACE@[3098; 3099) " " |
1804 | RANGE_EXPR@[3099; 3512) | 1804 | RANGE_EXPR@[3099; 3512) |
1805 | DOTDOT@[3099; 3101) ".." | 1805 | DOT2@[3099; 3101) ".." |
1806 | WHITESPACE@[3101; 3105) " " | 1806 | WHITESPACE@[3101; 3105) " " |
1807 | RANGE_EXPR@[3105; 3512) | 1807 | RANGE_EXPR@[3105; 3512) |
1808 | DOTDOT@[3105; 3107) ".." | 1808 | DOT2@[3105; 3107) ".." |
1809 | WHITESPACE@[3107; 3108) " " | 1809 | WHITESPACE@[3107; 3108) " " |
1810 | RANGE_EXPR@[3108; 3512) | 1810 | RANGE_EXPR@[3108; 3512) |
1811 | DOTDOT@[3108; 3110) ".." | 1811 | DOT2@[3108; 3110) ".." |
1812 | WHITESPACE@[3110; 3111) " " | 1812 | WHITESPACE@[3110; 3111) " " |
1813 | RANGE_EXPR@[3111; 3512) | 1813 | RANGE_EXPR@[3111; 3512) |
1814 | DOTDOT@[3111; 3113) ".." | 1814 | DOT2@[3111; 3113) ".." |
1815 | WHITESPACE@[3113; 3114) " " | 1815 | WHITESPACE@[3113; 3114) " " |
1816 | RANGE_EXPR@[3114; 3512) | 1816 | RANGE_EXPR@[3114; 3512) |
1817 | DOTDOT@[3114; 3116) ".." | 1817 | DOT2@[3114; 3116) ".." |
1818 | WHITESPACE@[3116; 3120) " " | 1818 | WHITESPACE@[3116; 3120) " " |
1819 | RANGE_EXPR@[3120; 3512) | 1819 | RANGE_EXPR@[3120; 3512) |
1820 | DOTDOT@[3120; 3122) ".." | 1820 | DOT2@[3120; 3122) ".." |
1821 | WHITESPACE@[3122; 3123) " " | 1821 | WHITESPACE@[3122; 3123) " " |
1822 | RANGE_EXPR@[3123; 3512) | 1822 | RANGE_EXPR@[3123; 3512) |
1823 | DOTDOT@[3123; 3125) ".." | 1823 | DOT2@[3123; 3125) ".." |
1824 | WHITESPACE@[3125; 3126) " " | 1824 | WHITESPACE@[3125; 3126) " " |
1825 | RANGE_EXPR@[3126; 3512) | 1825 | RANGE_EXPR@[3126; 3512) |
1826 | DOTDOT@[3126; 3128) ".." | 1826 | DOT2@[3126; 3128) ".." |
1827 | WHITESPACE@[3128; 3129) " " | 1827 | WHITESPACE@[3128; 3129) " " |
1828 | RANGE_EXPR@[3129; 3512) | 1828 | RANGE_EXPR@[3129; 3512) |
1829 | DOTDOT@[3129; 3131) ".." | 1829 | DOT2@[3129; 3131) ".." |
1830 | WHITESPACE@[3131; 3135) " " | 1830 | WHITESPACE@[3131; 3135) " " |
1831 | RANGE_EXPR@[3135; 3512) | 1831 | RANGE_EXPR@[3135; 3512) |
1832 | DOTDOT@[3135; 3137) ".." | 1832 | DOT2@[3135; 3137) ".." |
1833 | WHITESPACE@[3137; 3138) " " | 1833 | WHITESPACE@[3137; 3138) " " |
1834 | RANGE_EXPR@[3138; 3512) | 1834 | RANGE_EXPR@[3138; 3512) |
1835 | DOTDOTEQ@[3138; 3141) "..=" | 1835 | DOT2EQ@[3138; 3141) "..=" |
1836 | RANGE_EXPR@[3141; 3512) | 1836 | RANGE_EXPR@[3141; 3512) |
1837 | DOTDOT@[3141; 3143) ".." | 1837 | DOT2@[3141; 3143) ".." |
1838 | WHITESPACE@[3143; 3144) " " | 1838 | WHITESPACE@[3143; 3144) " " |
1839 | RANGE_EXPR@[3144; 3512) | 1839 | RANGE_EXPR@[3144; 3512) |
1840 | DOTDOT@[3144; 3146) ".." | 1840 | DOT2@[3144; 3146) ".." |
1841 | WHITESPACE@[3146; 3151) "\n " | 1841 | WHITESPACE@[3146; 3151) "\n " |
1842 | RANGE_EXPR@[3151; 3512) | 1842 | RANGE_EXPR@[3151; 3512) |
1843 | DOTDOTEQ@[3151; 3154) "..=" | 1843 | DOT2EQ@[3151; 3154) "..=" |
1844 | RANGE_EXPR@[3154; 3512) | 1844 | RANGE_EXPR@[3154; 3512) |
1845 | DOTDOT@[3154; 3156) ".." | 1845 | DOT2@[3154; 3156) ".." |
1846 | WHITESPACE@[3156; 3157) " " | 1846 | WHITESPACE@[3156; 3157) " " |
1847 | RANGE_EXPR@[3157; 3512) | 1847 | RANGE_EXPR@[3157; 3512) |
1848 | DOTDOTEQ@[3157; 3160) "..=" | 1848 | DOT2EQ@[3157; 3160) "..=" |
1849 | RANGE_EXPR@[3160; 3512) | 1849 | RANGE_EXPR@[3160; 3512) |
1850 | DOTDOT@[3160; 3162) ".." | 1850 | DOT2@[3160; 3162) ".." |
1851 | WHITESPACE@[3162; 3166) " " | 1851 | WHITESPACE@[3162; 3166) " " |
1852 | RANGE_EXPR@[3166; 3512) | 1852 | RANGE_EXPR@[3166; 3512) |
1853 | DOTDOT@[3166; 3168) ".." | 1853 | DOT2@[3166; 3168) ".." |
1854 | WHITESPACE@[3168; 3169) " " | 1854 | WHITESPACE@[3168; 3169) " " |
1855 | RANGE_EXPR@[3169; 3512) | 1855 | RANGE_EXPR@[3169; 3512) |
1856 | DOTDOT@[3169; 3171) ".." | 1856 | DOT2@[3169; 3171) ".." |
1857 | WHITESPACE@[3171; 3172) " " | 1857 | WHITESPACE@[3171; 3172) " " |
1858 | RANGE_EXPR@[3172; 3512) | 1858 | RANGE_EXPR@[3172; 3512) |
1859 | DOTDOT@[3172; 3174) ".." | 1859 | DOT2@[3172; 3174) ".." |
1860 | WHITESPACE@[3174; 3175) " " | 1860 | WHITESPACE@[3174; 3175) " " |
1861 | RANGE_EXPR@[3175; 3512) | 1861 | RANGE_EXPR@[3175; 3512) |
1862 | DOTDOT@[3175; 3177) ".." | 1862 | DOT2@[3175; 3177) ".." |
1863 | WHITESPACE@[3177; 3181) " " | 1863 | WHITESPACE@[3177; 3181) " " |
1864 | RANGE_EXPR@[3181; 3512) | 1864 | RANGE_EXPR@[3181; 3512) |
1865 | DOTDOT@[3181; 3183) ".." | 1865 | DOT2@[3181; 3183) ".." |
1866 | WHITESPACE@[3183; 3184) " " | 1866 | WHITESPACE@[3183; 3184) " " |
1867 | RANGE_EXPR@[3184; 3512) | 1867 | RANGE_EXPR@[3184; 3512) |
1868 | DOTDOT@[3184; 3186) ".." | 1868 | DOT2@[3184; 3186) ".." |
1869 | WHITESPACE@[3186; 3187) " " | 1869 | WHITESPACE@[3186; 3187) " " |
1870 | RANGE_EXPR@[3187; 3512) | 1870 | RANGE_EXPR@[3187; 3512) |
1871 | DOTDOT@[3187; 3189) ".." | 1871 | DOT2@[3187; 3189) ".." |
1872 | WHITESPACE@[3189; 3190) " " | 1872 | WHITESPACE@[3189; 3190) " " |
1873 | RANGE_EXPR@[3190; 3512) | 1873 | RANGE_EXPR@[3190; 3512) |
1874 | DOTDOT@[3190; 3192) ".." | 1874 | DOT2@[3190; 3192) ".." |
1875 | WHITESPACE@[3192; 3196) " " | 1875 | WHITESPACE@[3192; 3196) " " |
1876 | RANGE_EXPR@[3196; 3512) | 1876 | RANGE_EXPR@[3196; 3512) |
1877 | DOTDOTEQ@[3196; 3199) "..=" | 1877 | DOT2EQ@[3196; 3199) "..=" |
1878 | RANGE_EXPR@[3199; 3512) | 1878 | RANGE_EXPR@[3199; 3512) |
1879 | DOTDOTEQ@[3199; 3202) "..=" | 1879 | DOT2EQ@[3199; 3202) "..=" |
1880 | RANGE_EXPR@[3202; 3512) | 1880 | RANGE_EXPR@[3202; 3512) |
1881 | DOTDOTEQ@[3202; 3205) "..=" | 1881 | DOT2EQ@[3202; 3205) "..=" |
1882 | RANGE_EXPR@[3205; 3512) | 1882 | RANGE_EXPR@[3205; 3512) |
1883 | DOTDOT@[3205; 3207) ".." | 1883 | DOT2@[3205; 3207) ".." |
1884 | WHITESPACE@[3207; 3212) "\n " | 1884 | WHITESPACE@[3207; 3212) "\n " |
1885 | RANGE_EXPR@[3212; 3512) | 1885 | RANGE_EXPR@[3212; 3512) |
1886 | DOTDOTEQ@[3212; 3215) "..=" | 1886 | DOT2EQ@[3212; 3215) "..=" |
1887 | RANGE_EXPR@[3215; 3512) | 1887 | RANGE_EXPR@[3215; 3512) |
1888 | DOTDOT@[3215; 3217) ".." | 1888 | DOT2@[3215; 3217) ".." |
1889 | WHITESPACE@[3217; 3218) " " | 1889 | WHITESPACE@[3217; 3218) " " |
1890 | RANGE_EXPR@[3218; 3512) | 1890 | RANGE_EXPR@[3218; 3512) |
1891 | DOTDOTEQ@[3218; 3221) "..=" | 1891 | DOT2EQ@[3218; 3221) "..=" |
1892 | RANGE_EXPR@[3221; 3512) | 1892 | RANGE_EXPR@[3221; 3512) |
1893 | DOTDOT@[3221; 3223) ".." | 1893 | DOT2@[3221; 3223) ".." |
1894 | WHITESPACE@[3223; 3227) " " | 1894 | WHITESPACE@[3223; 3227) " " |
1895 | RANGE_EXPR@[3227; 3512) | 1895 | RANGE_EXPR@[3227; 3512) |
1896 | DOTDOTEQ@[3227; 3230) "..=" | 1896 | DOT2EQ@[3227; 3230) "..=" |
1897 | RANGE_EXPR@[3230; 3512) | 1897 | RANGE_EXPR@[3230; 3512) |
1898 | DOTDOT@[3230; 3232) ".." | 1898 | DOT2@[3230; 3232) ".." |
1899 | WHITESPACE@[3232; 3233) " " | 1899 | WHITESPACE@[3232; 3233) " " |
1900 | RANGE_EXPR@[3233; 3512) | 1900 | RANGE_EXPR@[3233; 3512) |
1901 | DOTDOTEQ@[3233; 3236) "..=" | 1901 | DOT2EQ@[3233; 3236) "..=" |
1902 | RANGE_EXPR@[3236; 3512) | 1902 | RANGE_EXPR@[3236; 3512) |
1903 | DOTDOT@[3236; 3238) ".." | 1903 | DOT2@[3236; 3238) ".." |
1904 | WHITESPACE@[3238; 3242) " " | 1904 | WHITESPACE@[3238; 3242) " " |
1905 | RANGE_EXPR@[3242; 3512) | 1905 | RANGE_EXPR@[3242; 3512) |
1906 | DOTDOT@[3242; 3244) ".." | 1906 | DOT2@[3242; 3244) ".." |
1907 | WHITESPACE@[3244; 3245) " " | 1907 | WHITESPACE@[3244; 3245) " " |
1908 | RANGE_EXPR@[3245; 3512) | 1908 | RANGE_EXPR@[3245; 3512) |
1909 | DOTDOTEQ@[3245; 3248) "..=" | 1909 | DOT2EQ@[3245; 3248) "..=" |
1910 | RANGE_EXPR@[3248; 3512) | 1910 | RANGE_EXPR@[3248; 3512) |
1911 | DOTDOTEQ@[3248; 3251) "..=" | 1911 | DOT2EQ@[3248; 3251) "..=" |
1912 | RANGE_EXPR@[3251; 3512) | 1912 | RANGE_EXPR@[3251; 3512) |
1913 | DOTDOT@[3251; 3253) ".." | 1913 | DOT2@[3251; 3253) ".." |
1914 | WHITESPACE@[3253; 3257) " " | 1914 | WHITESPACE@[3253; 3257) " " |
1915 | RANGE_EXPR@[3257; 3512) | 1915 | RANGE_EXPR@[3257; 3512) |
1916 | DOTDOT@[3257; 3259) ".." | 1916 | DOT2@[3257; 3259) ".." |
1917 | WHITESPACE@[3259; 3260) " " | 1917 | WHITESPACE@[3259; 3260) " " |
1918 | RANGE_EXPR@[3260; 3512) | 1918 | RANGE_EXPR@[3260; 3512) |
1919 | DOTDOTEQ@[3260; 3263) "..=" | 1919 | DOT2EQ@[3260; 3263) "..=" |
1920 | RANGE_EXPR@[3263; 3512) | 1920 | RANGE_EXPR@[3263; 3512) |
1921 | DOTDOT@[3263; 3265) ".." | 1921 | DOT2@[3263; 3265) ".." |
1922 | WHITESPACE@[3265; 3266) " " | 1922 | WHITESPACE@[3265; 3266) " " |
1923 | RANGE_EXPR@[3266; 3512) | 1923 | RANGE_EXPR@[3266; 3512) |
1924 | DOTDOT@[3266; 3268) ".." | 1924 | DOT2@[3266; 3268) ".." |
1925 | WHITESPACE@[3268; 3273) "\n " | 1925 | WHITESPACE@[3268; 3273) "\n " |
1926 | RANGE_EXPR@[3273; 3512) | 1926 | RANGE_EXPR@[3273; 3512) |
1927 | DOTDOTEQ@[3273; 3276) "..=" | 1927 | DOT2EQ@[3273; 3276) "..=" |
1928 | RANGE_EXPR@[3276; 3512) | 1928 | RANGE_EXPR@[3276; 3512) |
1929 | DOTDOTEQ@[3276; 3279) "..=" | 1929 | DOT2EQ@[3276; 3279) "..=" |
1930 | RANGE_EXPR@[3279; 3512) | 1930 | RANGE_EXPR@[3279; 3512) |
1931 | DOTDOT@[3279; 3281) ".." | 1931 | DOT2@[3279; 3281) ".." |
1932 | WHITESPACE@[3281; 3282) " " | 1932 | WHITESPACE@[3281; 3282) " " |
1933 | RANGE_EXPR@[3282; 3512) | 1933 | RANGE_EXPR@[3282; 3512) |
1934 | DOTDOT@[3282; 3284) ".." | 1934 | DOT2@[3282; 3284) ".." |
1935 | WHITESPACE@[3284; 3288) " " | 1935 | WHITESPACE@[3284; 3288) " " |
1936 | RANGE_EXPR@[3288; 3512) | 1936 | RANGE_EXPR@[3288; 3512) |
1937 | DOTDOTEQ@[3288; 3291) "..=" | 1937 | DOT2EQ@[3288; 3291) "..=" |
1938 | RANGE_EXPR@[3291; 3512) | 1938 | RANGE_EXPR@[3291; 3512) |
1939 | DOTDOT@[3291; 3293) ".." | 1939 | DOT2@[3291; 3293) ".." |
1940 | WHITESPACE@[3293; 3294) " " | 1940 | WHITESPACE@[3293; 3294) " " |
1941 | RANGE_EXPR@[3294; 3512) | 1941 | RANGE_EXPR@[3294; 3512) |
1942 | DOTDOTEQ@[3294; 3297) "..=" | 1942 | DOT2EQ@[3294; 3297) "..=" |
1943 | RANGE_EXPR@[3297; 3512) | 1943 | RANGE_EXPR@[3297; 3512) |
1944 | DOTDOT@[3297; 3299) ".." | 1944 | DOT2@[3297; 3299) ".." |
1945 | WHITESPACE@[3299; 3303) " " | 1945 | WHITESPACE@[3299; 3303) " " |
1946 | RANGE_EXPR@[3303; 3512) | 1946 | RANGE_EXPR@[3303; 3512) |
1947 | DOTDOTEQ@[3303; 3306) "..=" | 1947 | DOT2EQ@[3303; 3306) "..=" |
1948 | RANGE_EXPR@[3306; 3512) | 1948 | RANGE_EXPR@[3306; 3512) |
1949 | DOTDOT@[3306; 3308) ".." | 1949 | DOT2@[3306; 3308) ".." |
1950 | WHITESPACE@[3308; 3309) " " | 1950 | WHITESPACE@[3308; 3309) " " |
1951 | RANGE_EXPR@[3309; 3512) | 1951 | RANGE_EXPR@[3309; 3512) |
1952 | DOTDOT@[3309; 3311) ".." | 1952 | DOT2@[3309; 3311) ".." |
1953 | WHITESPACE@[3311; 3312) " " | 1953 | WHITESPACE@[3311; 3312) " " |
1954 | RANGE_EXPR@[3312; 3512) | 1954 | RANGE_EXPR@[3312; 3512) |
1955 | DOTDOT@[3312; 3314) ".." | 1955 | DOT2@[3312; 3314) ".." |
1956 | WHITESPACE@[3314; 3318) " " | 1956 | WHITESPACE@[3314; 3318) " " |
1957 | RANGE_EXPR@[3318; 3512) | 1957 | RANGE_EXPR@[3318; 3512) |
1958 | DOTDOT@[3318; 3320) ".." | 1958 | DOT2@[3318; 3320) ".." |
1959 | WHITESPACE@[3320; 3321) " " | 1959 | WHITESPACE@[3320; 3321) " " |
1960 | RANGE_EXPR@[3321; 3512) | 1960 | RANGE_EXPR@[3321; 3512) |
1961 | DOTDOTEQ@[3321; 3324) "..=" | 1961 | DOT2EQ@[3321; 3324) "..=" |
1962 | RANGE_EXPR@[3324; 3512) | 1962 | RANGE_EXPR@[3324; 3512) |
1963 | DOTDOT@[3324; 3326) ".." | 1963 | DOT2@[3324; 3326) ".." |
1964 | WHITESPACE@[3326; 3327) " " | 1964 | WHITESPACE@[3326; 3327) " " |
1965 | RANGE_EXPR@[3327; 3512) | 1965 | RANGE_EXPR@[3327; 3512) |
1966 | DOTDOT@[3327; 3329) ".." | 1966 | DOT2@[3327; 3329) ".." |
1967 | WHITESPACE@[3329; 3334) "\n " | 1967 | WHITESPACE@[3329; 3334) "\n " |
1968 | RANGE_EXPR@[3334; 3512) | 1968 | RANGE_EXPR@[3334; 3512) |
1969 | DOTDOTEQ@[3334; 3337) "..=" | 1969 | DOT2EQ@[3334; 3337) "..=" |
1970 | RANGE_EXPR@[3337; 3512) | 1970 | RANGE_EXPR@[3337; 3512) |
1971 | DOTDOT@[3337; 3339) ".." | 1971 | DOT2@[3337; 3339) ".." |
1972 | WHITESPACE@[3339; 3340) " " | 1972 | WHITESPACE@[3339; 3340) " " |
1973 | RANGE_EXPR@[3340; 3512) | 1973 | RANGE_EXPR@[3340; 3512) |
1974 | DOTDOTEQ@[3340; 3343) "..=" | 1974 | DOT2EQ@[3340; 3343) "..=" |
1975 | RANGE_EXPR@[3343; 3512) | 1975 | RANGE_EXPR@[3343; 3512) |
1976 | DOTDOT@[3343; 3345) ".." | 1976 | DOT2@[3343; 3345) ".." |
1977 | WHITESPACE@[3345; 3349) " " | 1977 | WHITESPACE@[3345; 3349) " " |
1978 | RANGE_EXPR@[3349; 3512) | 1978 | RANGE_EXPR@[3349; 3512) |
1979 | DOTDOTEQ@[3349; 3352) "..=" | 1979 | DOT2EQ@[3349; 3352) "..=" |
1980 | RANGE_EXPR@[3352; 3512) | 1980 | RANGE_EXPR@[3352; 3512) |
1981 | DOTDOT@[3352; 3354) ".." | 1981 | DOT2@[3352; 3354) ".." |
1982 | WHITESPACE@[3354; 3355) " " | 1982 | WHITESPACE@[3354; 3355) " " |
1983 | RANGE_EXPR@[3355; 3512) | 1983 | RANGE_EXPR@[3355; 3512) |
1984 | DOTDOTEQ@[3355; 3358) "..=" | 1984 | DOT2EQ@[3355; 3358) "..=" |
1985 | RANGE_EXPR@[3358; 3512) | 1985 | RANGE_EXPR@[3358; 3512) |
1986 | DOTDOT@[3358; 3360) ".." | 1986 | DOT2@[3358; 3360) ".." |
1987 | WHITESPACE@[3360; 3364) " " | 1987 | WHITESPACE@[3360; 3364) " " |
1988 | RANGE_EXPR@[3364; 3512) | 1988 | RANGE_EXPR@[3364; 3512) |
1989 | DOTDOT@[3364; 3366) ".." | 1989 | DOT2@[3364; 3366) ".." |
1990 | WHITESPACE@[3366; 3367) " " | 1990 | WHITESPACE@[3366; 3367) " " |
1991 | RANGE_EXPR@[3367; 3512) | 1991 | RANGE_EXPR@[3367; 3512) |
1992 | DOTDOTEQ@[3367; 3370) "..=" | 1992 | DOT2EQ@[3367; 3370) "..=" |
1993 | RANGE_EXPR@[3370; 3512) | 1993 | RANGE_EXPR@[3370; 3512) |
1994 | DOTDOT@[3370; 3372) ".." | 1994 | DOT2@[3370; 3372) ".." |
1995 | WHITESPACE@[3372; 3373) " " | 1995 | WHITESPACE@[3372; 3373) " " |
1996 | RANGE_EXPR@[3373; 3512) | 1996 | RANGE_EXPR@[3373; 3512) |
1997 | DOTDOT@[3373; 3375) ".." | 1997 | DOT2@[3373; 3375) ".." |
1998 | WHITESPACE@[3375; 3379) " " | 1998 | WHITESPACE@[3375; 3379) " " |
1999 | RANGE_EXPR@[3379; 3512) | 1999 | RANGE_EXPR@[3379; 3512) |
2000 | DOTDOT@[3379; 3381) ".." | 2000 | DOT2@[3379; 3381) ".." |
2001 | WHITESPACE@[3381; 3382) " " | 2001 | WHITESPACE@[3381; 3382) " " |
2002 | RANGE_EXPR@[3382; 3512) | 2002 | RANGE_EXPR@[3382; 3512) |
2003 | DOTDOTEQ@[3382; 3385) "..=" | 2003 | DOT2EQ@[3382; 3385) "..=" |
2004 | RANGE_EXPR@[3385; 3512) | 2004 | RANGE_EXPR@[3385; 3512) |
2005 | DOTDOT@[3385; 3387) ".." | 2005 | DOT2@[3385; 3387) ".." |
2006 | WHITESPACE@[3387; 3388) " " | 2006 | WHITESPACE@[3387; 3388) " " |
2007 | RANGE_EXPR@[3388; 3512) | 2007 | RANGE_EXPR@[3388; 3512) |
2008 | DOTDOT@[3388; 3390) ".." | 2008 | DOT2@[3388; 3390) ".." |
2009 | WHITESPACE@[3390; 3395) "\n " | 2009 | WHITESPACE@[3390; 3395) "\n " |
2010 | RANGE_EXPR@[3395; 3512) | 2010 | RANGE_EXPR@[3395; 3512) |
2011 | DOTDOTEQ@[3395; 3398) "..=" | 2011 | DOT2EQ@[3395; 3398) "..=" |
2012 | RANGE_EXPR@[3398; 3512) | 2012 | RANGE_EXPR@[3398; 3512) |
2013 | DOTDOT@[3398; 3400) ".." | 2013 | DOT2@[3398; 3400) ".." |
2014 | WHITESPACE@[3400; 3401) " " | 2014 | WHITESPACE@[3400; 3401) " " |
2015 | RANGE_EXPR@[3401; 3512) | 2015 | RANGE_EXPR@[3401; 3512) |
2016 | DOTDOTEQ@[3401; 3404) "..=" | 2016 | DOT2EQ@[3401; 3404) "..=" |
2017 | RANGE_EXPR@[3404; 3512) | 2017 | RANGE_EXPR@[3404; 3512) |
2018 | DOTDOT@[3404; 3406) ".." | 2018 | DOT2@[3404; 3406) ".." |
2019 | WHITESPACE@[3406; 3410) " " | 2019 | WHITESPACE@[3406; 3410) " " |
2020 | RANGE_EXPR@[3410; 3512) | 2020 | RANGE_EXPR@[3410; 3512) |
2021 | DOTDOTEQ@[3410; 3413) "..=" | 2021 | DOT2EQ@[3410; 3413) "..=" |
2022 | RANGE_EXPR@[3413; 3512) | 2022 | RANGE_EXPR@[3413; 3512) |
2023 | DOTDOT@[3413; 3415) ".." | 2023 | DOT2@[3413; 3415) ".." |
2024 | WHITESPACE@[3415; 3416) " " | 2024 | WHITESPACE@[3415; 3416) " " |
2025 | RANGE_EXPR@[3416; 3512) | 2025 | RANGE_EXPR@[3416; 3512) |
2026 | DOTDOTEQ@[3416; 3419) "..=" | 2026 | DOT2EQ@[3416; 3419) "..=" |
2027 | RANGE_EXPR@[3419; 3512) | 2027 | RANGE_EXPR@[3419; 3512) |
2028 | DOTDOT@[3419; 3421) ".." | 2028 | DOT2@[3419; 3421) ".." |
2029 | WHITESPACE@[3421; 3425) " " | 2029 | WHITESPACE@[3421; 3425) " " |
2030 | RANGE_EXPR@[3425; 3512) | 2030 | RANGE_EXPR@[3425; 3512) |
2031 | DOTDOT@[3425; 3427) ".." | 2031 | DOT2@[3425; 3427) ".." |
2032 | WHITESPACE@[3427; 3428) " " | 2032 | WHITESPACE@[3427; 3428) " " |
2033 | RANGE_EXPR@[3428; 3512) | 2033 | RANGE_EXPR@[3428; 3512) |
2034 | DOTDOT@[3428; 3430) ".." | 2034 | DOT2@[3428; 3430) ".." |
2035 | WHITESPACE@[3430; 3431) " " | 2035 | WHITESPACE@[3430; 3431) " " |
2036 | RANGE_EXPR@[3431; 3512) | 2036 | RANGE_EXPR@[3431; 3512) |
2037 | DOTDOTEQ@[3431; 3434) "..=" | 2037 | DOT2EQ@[3431; 3434) "..=" |
2038 | RANGE_EXPR@[3434; 3512) | 2038 | RANGE_EXPR@[3434; 3512) |
2039 | DOTDOT@[3434; 3436) ".." | 2039 | DOT2@[3434; 3436) ".." |
2040 | WHITESPACE@[3436; 3440) " " | 2040 | WHITESPACE@[3436; 3440) " " |
2041 | RANGE_EXPR@[3440; 3512) | 2041 | RANGE_EXPR@[3440; 3512) |
2042 | DOTDOT@[3440; 3442) ".." | 2042 | DOT2@[3440; 3442) ".." |
2043 | WHITESPACE@[3442; 3443) " " | 2043 | WHITESPACE@[3442; 3443) " " |
2044 | RANGE_EXPR@[3443; 3512) | 2044 | RANGE_EXPR@[3443; 3512) |
2045 | DOTDOTEQ@[3443; 3446) "..=" | 2045 | DOT2EQ@[3443; 3446) "..=" |
2046 | RANGE_EXPR@[3446; 3512) | 2046 | RANGE_EXPR@[3446; 3512) |
2047 | DOTDOT@[3446; 3448) ".." | 2047 | DOT2@[3446; 3448) ".." |
2048 | WHITESPACE@[3448; 3449) " " | 2048 | WHITESPACE@[3448; 3449) " " |
2049 | RANGE_EXPR@[3449; 3512) | 2049 | RANGE_EXPR@[3449; 3512) |
2050 | DOTDOT@[3449; 3451) ".." | 2050 | DOT2@[3449; 3451) ".." |
2051 | WHITESPACE@[3451; 3456) "\n " | 2051 | WHITESPACE@[3451; 3456) "\n " |
2052 | RANGE_EXPR@[3456; 3512) | 2052 | RANGE_EXPR@[3456; 3512) |
2053 | DOTDOTEQ@[3456; 3459) "..=" | 2053 | DOT2EQ@[3456; 3459) "..=" |
2054 | RANGE_EXPR@[3459; 3512) | 2054 | RANGE_EXPR@[3459; 3512) |
2055 | DOTDOT@[3459; 3461) ".." | 2055 | DOT2@[3459; 3461) ".." |
2056 | WHITESPACE@[3461; 3462) " " | 2056 | WHITESPACE@[3461; 3462) " " |
2057 | RANGE_EXPR@[3462; 3512) | 2057 | RANGE_EXPR@[3462; 3512) |
2058 | DOTDOTEQ@[3462; 3465) "..=" | 2058 | DOT2EQ@[3462; 3465) "..=" |
2059 | RANGE_EXPR@[3465; 3512) | 2059 | RANGE_EXPR@[3465; 3512) |
2060 | DOTDOT@[3465; 3467) ".." | 2060 | DOT2@[3465; 3467) ".." |
2061 | WHITESPACE@[3467; 3471) " " | 2061 | WHITESPACE@[3467; 3471) " " |
2062 | RANGE_EXPR@[3471; 3512) | 2062 | RANGE_EXPR@[3471; 3512) |
2063 | DOTDOT@[3471; 3473) ".." | 2063 | DOT2@[3471; 3473) ".." |
2064 | WHITESPACE@[3473; 3474) " " | 2064 | WHITESPACE@[3473; 3474) " " |
2065 | RANGE_EXPR@[3474; 3512) | 2065 | RANGE_EXPR@[3474; 3512) |
2066 | DOTDOTEQ@[3474; 3477) "..=" | 2066 | DOT2EQ@[3474; 3477) "..=" |
2067 | RANGE_EXPR@[3477; 3512) | 2067 | RANGE_EXPR@[3477; 3512) |
2068 | DOTDOTEQ@[3477; 3480) "..=" | 2068 | DOT2EQ@[3477; 3480) "..=" |
2069 | RANGE_EXPR@[3480; 3512) | 2069 | RANGE_EXPR@[3480; 3512) |
2070 | DOTDOT@[3480; 3482) ".." | 2070 | DOT2@[3480; 3482) ".." |
2071 | WHITESPACE@[3482; 3486) " " | 2071 | WHITESPACE@[3482; 3486) " " |
2072 | RANGE_EXPR@[3486; 3512) | 2072 | RANGE_EXPR@[3486; 3512) |
2073 | DOTDOTEQ@[3486; 3489) "..=" | 2073 | DOT2EQ@[3486; 3489) "..=" |
2074 | RANGE_EXPR@[3489; 3512) | 2074 | RANGE_EXPR@[3489; 3512) |
2075 | DOTDOTEQ@[3489; 3492) "..=" | 2075 | DOT2EQ@[3489; 3492) "..=" |
2076 | RANGE_EXPR@[3492; 3512) | 2076 | RANGE_EXPR@[3492; 3512) |
2077 | DOTDOT@[3492; 3494) ".." | 2077 | DOT2@[3492; 3494) ".." |
2078 | WHITESPACE@[3494; 3495) " " | 2078 | WHITESPACE@[3494; 3495) " " |
2079 | RANGE_EXPR@[3495; 3512) | 2079 | RANGE_EXPR@[3495; 3512) |
2080 | DOTDOT@[3495; 3497) ".." | 2080 | DOT2@[3495; 3497) ".." |
2081 | WHITESPACE@[3497; 3501) " " | 2081 | WHITESPACE@[3497; 3501) " " |
2082 | RANGE_EXPR@[3501; 3512) | 2082 | RANGE_EXPR@[3501; 3512) |
2083 | DOTDOT@[3501; 3503) ".." | 2083 | DOT2@[3501; 3503) ".." |
2084 | WHITESPACE@[3503; 3504) " " | 2084 | WHITESPACE@[3503; 3504) " " |
2085 | RANGE_EXPR@[3504; 3512) | 2085 | RANGE_EXPR@[3504; 3512) |
2086 | DOTDOTEQ@[3504; 3507) "..=" | 2086 | DOT2EQ@[3504; 3507) "..=" |
2087 | RANGE_EXPR@[3507; 3512) | 2087 | RANGE_EXPR@[3507; 3512) |
2088 | DOTDOT@[3507; 3509) ".." | 2088 | DOT2@[3507; 3509) ".." |
2089 | WHITESPACE@[3509; 3510) " " | 2089 | WHITESPACE@[3509; 3510) " " |
2090 | RANGE_EXPR@[3510; 3512) | 2090 | RANGE_EXPR@[3510; 3512) |
2091 | DOTDOT@[3510; 3512) ".." | 2091 | DOT2@[3510; 3512) ".." |
2092 | WHITESPACE@[3512; 3513) "\n" | 2092 | WHITESPACE@[3512; 3513) "\n" |
2093 | R_CURLY@[3513; 3514) "}" | 2093 | R_CURLY@[3513; 3514) "}" |
2094 | WHITESPACE@[3514; 3516) "\n\n" | 2094 | WHITESPACE@[3514; 3516) "\n\n" |
@@ -2105,22 +2105,22 @@ SOURCE_FILE@[0; 3813) | |||
2105 | BLOCK@[3528; 3552) | 2105 | BLOCK@[3528; 3552) |
2106 | L_CURLY@[3528; 3529) "{" | 2106 | L_CURLY@[3528; 3529) "{" |
2107 | WHITESPACE@[3529; 3534) "\n " | 2107 | WHITESPACE@[3529; 3534) "\n " |
2108 | SEMI@[3534; 3535) ";" | 2108 | SEMICOLON@[3534; 3535) ";" |
2109 | SEMI@[3535; 3536) ";" | 2109 | SEMICOLON@[3535; 3536) ";" |
2110 | SEMI@[3536; 3537) ";" | 2110 | SEMICOLON@[3536; 3537) ";" |
2111 | EXPR_STMT@[3537; 3540) | 2111 | EXPR_STMT@[3537; 3540) |
2112 | TUPLE_EXPR@[3537; 3539) | 2112 | TUPLE_EXPR@[3537; 3539) |
2113 | L_PAREN@[3537; 3538) "(" | 2113 | L_PAREN@[3537; 3538) "(" |
2114 | R_PAREN@[3538; 3539) ")" | 2114 | R_PAREN@[3538; 3539) ")" |
2115 | SEMI@[3539; 3540) ";" | 2115 | SEMICOLON@[3539; 3540) ";" |
2116 | SEMI@[3540; 3541) ";" | 2116 | SEMICOLON@[3540; 3541) ";" |
2117 | SEMI@[3541; 3542) ";" | 2117 | SEMICOLON@[3541; 3542) ";" |
2118 | SEMI@[3542; 3543) ";" | 2118 | SEMICOLON@[3542; 3543) ";" |
2119 | SEMI@[3543; 3544) ";" | 2119 | SEMICOLON@[3543; 3544) ";" |
2120 | SEMI@[3544; 3545) ";" | 2120 | SEMICOLON@[3544; 3545) ";" |
2121 | SEMI@[3545; 3546) ";" | 2121 | SEMICOLON@[3545; 3546) ";" |
2122 | SEMI@[3546; 3547) ";" | 2122 | SEMICOLON@[3546; 3547) ";" |
2123 | SEMI@[3547; 3548) ";" | 2123 | SEMICOLON@[3547; 3548) ";" |
2124 | TUPLE_EXPR@[3548; 3550) | 2124 | TUPLE_EXPR@[3548; 3550) |
2125 | L_PAREN@[3548; 3549) "(" | 2125 | L_PAREN@[3548; 3549) "(" |
2126 | R_PAREN@[3549; 3550) ")" | 2126 | R_PAREN@[3549; 3550) ")" |
@@ -2153,7 +2153,7 @@ SOURCE_FILE@[0; 3813) | |||
2153 | ARG_LIST@[3581; 3583) | 2153 | ARG_LIST@[3581; 3583) |
2154 | L_PAREN@[3581; 3582) "(" | 2154 | L_PAREN@[3581; 3582) "(" |
2155 | R_PAREN@[3582; 3583) ")" | 2155 | R_PAREN@[3582; 3583) ")" |
2156 | SEMI@[3583; 3584) ";" | 2156 | SEMICOLON@[3583; 3584) ";" |
2157 | WHITESPACE@[3584; 3589) "\n " | 2157 | WHITESPACE@[3584; 3589) "\n " |
2158 | EXPR_STMT@[3589; 3597) | 2158 | EXPR_STMT@[3589; 3597) |
2159 | CALL_EXPR@[3589; 3596) | 2159 | CALL_EXPR@[3589; 3596) |
@@ -2165,7 +2165,7 @@ SOURCE_FILE@[0; 3813) | |||
2165 | ARG_LIST@[3594; 3596) | 2165 | ARG_LIST@[3594; 3596) |
2166 | L_PAREN@[3594; 3595) "(" | 2166 | L_PAREN@[3594; 3595) "(" |
2167 | R_PAREN@[3595; 3596) ")" | 2167 | R_PAREN@[3595; 3596) ")" |
2168 | SEMI@[3596; 3597) ";" | 2168 | SEMICOLON@[3596; 3597) ";" |
2169 | WHITESPACE@[3597; 3602) "\n " | 2169 | WHITESPACE@[3597; 3602) "\n " |
2170 | EXPR_STMT@[3602; 3609) | 2170 | EXPR_STMT@[3602; 3609) |
2171 | CALL_EXPR@[3602; 3608) | 2171 | CALL_EXPR@[3602; 3608) |
@@ -2177,7 +2177,7 @@ SOURCE_FILE@[0; 3813) | |||
2177 | ARG_LIST@[3606; 3608) | 2177 | ARG_LIST@[3606; 3608) |
2178 | L_PAREN@[3606; 3607) "(" | 2178 | L_PAREN@[3606; 3607) "(" |
2179 | R_PAREN@[3607; 3608) ")" | 2179 | R_PAREN@[3607; 3608) ")" |
2180 | SEMI@[3608; 3609) ";" | 2180 | SEMICOLON@[3608; 3609) ";" |
2181 | WHITESPACE@[3609; 3614) "\n " | 2181 | WHITESPACE@[3609; 3614) "\n " |
2182 | EXPR_STMT@[3614; 3628) | 2182 | EXPR_STMT@[3614; 3628) |
2183 | CALL_EXPR@[3614; 3627) | 2183 | CALL_EXPR@[3614; 3627) |
@@ -2189,7 +2189,7 @@ SOURCE_FILE@[0; 3813) | |||
2189 | ARG_LIST@[3625; 3627) | 2189 | ARG_LIST@[3625; 3627) |
2190 | L_PAREN@[3625; 3626) "(" | 2190 | L_PAREN@[3625; 3626) "(" |
2191 | R_PAREN@[3626; 3627) ")" | 2191 | R_PAREN@[3626; 3627) ")" |
2192 | SEMI@[3627; 3628) ";" | 2192 | SEMICOLON@[3627; 3628) ";" |
2193 | WHITESPACE@[3628; 3633) "\n " | 2193 | WHITESPACE@[3628; 3633) "\n " |
2194 | EXPR_STMT@[3633; 3643) | 2194 | EXPR_STMT@[3633; 3643) |
2195 | CALL_EXPR@[3633; 3642) | 2195 | CALL_EXPR@[3633; 3642) |
@@ -2201,7 +2201,7 @@ SOURCE_FILE@[0; 3813) | |||
2201 | ARG_LIST@[3640; 3642) | 2201 | ARG_LIST@[3640; 3642) |
2202 | L_PAREN@[3640; 3641) "(" | 2202 | L_PAREN@[3640; 3641) "(" |
2203 | R_PAREN@[3641; 3642) ")" | 2203 | R_PAREN@[3641; 3642) ")" |
2204 | SEMI@[3642; 3643) ";" | 2204 | SEMICOLON@[3642; 3643) ";" |
2205 | WHITESPACE@[3643; 3648) "\n " | 2205 | WHITESPACE@[3643; 3648) "\n " |
2206 | EXPR_STMT@[3648; 3664) | 2206 | EXPR_STMT@[3648; 3664) |
2207 | CALL_EXPR@[3648; 3663) | 2207 | CALL_EXPR@[3648; 3663) |
@@ -2213,7 +2213,7 @@ SOURCE_FILE@[0; 3813) | |||
2213 | ARG_LIST@[3661; 3663) | 2213 | ARG_LIST@[3661; 3663) |
2214 | L_PAREN@[3661; 3662) "(" | 2214 | L_PAREN@[3661; 3662) "(" |
2215 | R_PAREN@[3662; 3663) ")" | 2215 | R_PAREN@[3662; 3663) ")" |
2216 | SEMI@[3663; 3664) ";" | 2216 | SEMICOLON@[3663; 3664) ";" |
2217 | WHITESPACE@[3664; 3669) "\n " | 2217 | WHITESPACE@[3664; 3669) "\n " |
2218 | EXPR_STMT@[3669; 3681) | 2218 | EXPR_STMT@[3669; 3681) |
2219 | CALL_EXPR@[3669; 3680) | 2219 | CALL_EXPR@[3669; 3680) |
@@ -2225,7 +2225,7 @@ SOURCE_FILE@[0; 3813) | |||
2225 | ARG_LIST@[3678; 3680) | 2225 | ARG_LIST@[3678; 3680) |
2226 | L_PAREN@[3678; 3679) "(" | 2226 | L_PAREN@[3678; 3679) "(" |
2227 | R_PAREN@[3679; 3680) ")" | 2227 | R_PAREN@[3679; 3680) ")" |
2228 | SEMI@[3680; 3681) ";" | 2228 | SEMICOLON@[3680; 3681) ";" |
2229 | WHITESPACE@[3681; 3686) "\n " | 2229 | WHITESPACE@[3681; 3686) "\n " |
2230 | EXPR_STMT@[3686; 3701) | 2230 | EXPR_STMT@[3686; 3701) |
2231 | CALL_EXPR@[3686; 3700) | 2231 | CALL_EXPR@[3686; 3700) |
@@ -2237,7 +2237,7 @@ SOURCE_FILE@[0; 3813) | |||
2237 | ARG_LIST@[3698; 3700) | 2237 | ARG_LIST@[3698; 3700) |
2238 | L_PAREN@[3698; 3699) "(" | 2238 | L_PAREN@[3698; 3699) "(" |
2239 | R_PAREN@[3699; 3700) ")" | 2239 | R_PAREN@[3699; 3700) ")" |
2240 | SEMI@[3700; 3701) ";" | 2240 | SEMICOLON@[3700; 3701) ";" |
2241 | WHITESPACE@[3701; 3706) "\n " | 2241 | WHITESPACE@[3701; 3706) "\n " |
2242 | EXPR_STMT@[3706; 3713) | 2242 | EXPR_STMT@[3706; 3713) |
2243 | CALL_EXPR@[3706; 3712) | 2243 | CALL_EXPR@[3706; 3712) |
@@ -2249,7 +2249,7 @@ SOURCE_FILE@[0; 3813) | |||
2249 | ARG_LIST@[3710; 3712) | 2249 | ARG_LIST@[3710; 3712) |
2250 | L_PAREN@[3710; 3711) "(" | 2250 | L_PAREN@[3710; 3711) "(" |
2251 | R_PAREN@[3711; 3712) ")" | 2251 | R_PAREN@[3711; 3712) ")" |
2252 | SEMI@[3712; 3713) ";" | 2252 | SEMICOLON@[3712; 3713) ";" |
2253 | WHITESPACE@[3713; 3718) "\n " | 2253 | WHITESPACE@[3713; 3718) "\n " |
2254 | EXPR_STMT@[3718; 3726) | 2254 | EXPR_STMT@[3718; 3726) |
2255 | CALL_EXPR@[3718; 3725) | 2255 | CALL_EXPR@[3718; 3725) |
@@ -2263,7 +2263,7 @@ SOURCE_FILE@[0; 3813) | |||
2263 | LITERAL@[3721; 3724) | 2263 | LITERAL@[3721; 3724) |
2264 | INT_NUMBER@[3721; 3724) "8u8" | 2264 | INT_NUMBER@[3721; 3724) "8u8" |
2265 | R_PAREN@[3724; 3725) ")" | 2265 | R_PAREN@[3724; 3725) ")" |
2266 | SEMI@[3725; 3726) ";" | 2266 | SEMICOLON@[3725; 3726) ";" |
2267 | WHITESPACE@[3726; 3731) "\n " | 2267 | WHITESPACE@[3726; 3731) "\n " |
2268 | EXPR_STMT@[3731; 3739) | 2268 | EXPR_STMT@[3731; 3739) |
2269 | CALL_EXPR@[3731; 3738) | 2269 | CALL_EXPR@[3731; 3738) |
@@ -2275,7 +2275,7 @@ SOURCE_FILE@[0; 3813) | |||
2275 | ARG_LIST@[3736; 3738) | 2275 | ARG_LIST@[3736; 3738) |
2276 | L_PAREN@[3736; 3737) "(" | 2276 | L_PAREN@[3736; 3737) "(" |
2277 | R_PAREN@[3737; 3738) ")" | 2277 | R_PAREN@[3737; 3738) ")" |
2278 | SEMI@[3738; 3739) ";" | 2278 | SEMICOLON@[3738; 3739) ";" |
2279 | WHITESPACE@[3739; 3744) "\n " | 2279 | WHITESPACE@[3739; 3744) "\n " |
2280 | EXPR_STMT@[3744; 3752) | 2280 | EXPR_STMT@[3744; 3752) |
2281 | CALL_EXPR@[3744; 3751) | 2281 | CALL_EXPR@[3744; 3751) |
@@ -2287,7 +2287,7 @@ SOURCE_FILE@[0; 3813) | |||
2287 | ARG_LIST@[3749; 3751) | 2287 | ARG_LIST@[3749; 3751) |
2288 | L_PAREN@[3749; 3750) "(" | 2288 | L_PAREN@[3749; 3750) "(" |
2289 | R_PAREN@[3750; 3751) ")" | 2289 | R_PAREN@[3750; 3751) ")" |
2290 | SEMI@[3751; 3752) ";" | 2290 | SEMICOLON@[3751; 3752) ";" |
2291 | WHITESPACE@[3752; 3757) "\n " | 2291 | WHITESPACE@[3752; 3757) "\n " |
2292 | EXPR_STMT@[3757; 3778) | 2292 | EXPR_STMT@[3757; 3778) |
2293 | CALL_EXPR@[3757; 3777) | 2293 | CALL_EXPR@[3757; 3777) |
@@ -2299,7 +2299,7 @@ SOURCE_FILE@[0; 3813) | |||
2299 | ARG_LIST@[3775; 3777) | 2299 | ARG_LIST@[3775; 3777) |
2300 | L_PAREN@[3775; 3776) "(" | 2300 | L_PAREN@[3775; 3776) "(" |
2301 | R_PAREN@[3776; 3777) ")" | 2301 | R_PAREN@[3776; 3777) ")" |
2302 | SEMI@[3777; 3778) ";" | 2302 | SEMICOLON@[3777; 3778) ";" |
2303 | WHITESPACE@[3778; 3783) "\n " | 2303 | WHITESPACE@[3778; 3783) "\n " |
2304 | EXPR_STMT@[3783; 3796) | 2304 | EXPR_STMT@[3783; 3796) |
2305 | CALL_EXPR@[3783; 3795) | 2305 | CALL_EXPR@[3783; 3795) |
@@ -2311,7 +2311,7 @@ SOURCE_FILE@[0; 3813) | |||
2311 | ARG_LIST@[3793; 3795) | 2311 | ARG_LIST@[3793; 3795) |
2312 | L_PAREN@[3793; 3794) "(" | 2312 | L_PAREN@[3793; 3794) "(" |
2313 | R_PAREN@[3794; 3795) ")" | 2313 | R_PAREN@[3794; 3795) ")" |
2314 | SEMI@[3795; 3796) ";" | 2314 | SEMICOLON@[3795; 3796) ";" |
2315 | WHITESPACE@[3796; 3801) "\n " | 2315 | WHITESPACE@[3796; 3801) "\n " |
2316 | EXPR_STMT@[3801; 3810) | 2316 | EXPR_STMT@[3801; 3810) |
2317 | CALL_EXPR@[3801; 3809) | 2317 | CALL_EXPR@[3801; 3809) |
@@ -2323,7 +2323,7 @@ SOURCE_FILE@[0; 3813) | |||
2323 | ARG_LIST@[3807; 3809) | 2323 | ARG_LIST@[3807; 3809) |
2324 | L_PAREN@[3807; 3808) "(" | 2324 | L_PAREN@[3807; 3808) "(" |
2325 | R_PAREN@[3808; 3809) ")" | 2325 | R_PAREN@[3808; 3809) ")" |
2326 | SEMI@[3809; 3810) ";" | 2326 | SEMICOLON@[3809; 3810) ";" |
2327 | WHITESPACE@[3810; 3811) "\n" | 2327 | WHITESPACE@[3810; 3811) "\n" |
2328 | R_CURLY@[3811; 3812) "}" | 2328 | R_CURLY@[3811; 3812) "}" |
2329 | WHITESPACE@[3812; 3813) "\n" | 2329 | WHITESPACE@[3812; 3813) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0036_fully_qualified.rast b/crates/ra_syntax/test_data/parser/ok/0036_fully_qualified.rast index ac5444087..4df6703f4 100644 --- a/crates/ra_syntax/test_data/parser/ok/0036_fully_qualified.rast +++ b/crates/ra_syntax/test_data/parser/ok/0036_fully_qualified.rast | |||
@@ -60,7 +60,7 @@ SOURCE_FILE@[0; 157) | |||
60 | NAME_REF@[114; 122) | 60 | NAME_REF@[114; 122) |
61 | IDENT@[114; 122) "Iterator" | 61 | IDENT@[114; 122) "Iterator" |
62 | R_ANGLE@[122; 123) ">" | 62 | R_ANGLE@[122; 123) ">" |
63 | COLONCOLON@[123; 125) "::" | 63 | COLON2@[123; 125) "::" |
64 | PATH_SEGMENT@[125; 129) | 64 | PATH_SEGMENT@[125; 129) |
65 | NAME_REF@[125; 129) | 65 | NAME_REF@[125; 129) |
66 | IDENT@[125; 129) "Item" | 66 | IDENT@[125; 129) "Item" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0041_raw_keywords.rast b/crates/ra_syntax/test_data/parser/ok/0041_raw_keywords.rast index 64c70e196..825518eda 100644 --- a/crates/ra_syntax/test_data/parser/ok/0041_raw_keywords.rast +++ b/crates/ra_syntax/test_data/parser/ok/0041_raw_keywords.rast | |||
@@ -23,7 +23,7 @@ SOURCE_FILE@[0; 59) | |||
23 | WHITESPACE@[25; 26) " " | 23 | WHITESPACE@[25; 26) " " |
24 | LITERAL@[26; 28) | 24 | LITERAL@[26; 28) |
25 | INT_NUMBER@[26; 28) "92" | 25 | INT_NUMBER@[26; 28) "92" |
26 | SEMI@[28; 29) ";" | 26 | SEMICOLON@[28; 29) ";" |
27 | WHITESPACE@[29; 30) " " | 27 | WHITESPACE@[29; 30) " " |
28 | LET_STMT@[30; 57) | 28 | LET_STMT@[30; 57) |
29 | LET_KW@[30; 33) "let" | 29 | LET_KW@[30; 33) "let" |
@@ -45,6 +45,6 @@ SOURCE_FILE@[0; 59) | |||
45 | WHITESPACE@[54; 55) " " | 45 | WHITESPACE@[54; 55) " " |
46 | LITERAL@[55; 56) | 46 | LITERAL@[55; 56) |
47 | INT_NUMBER@[55; 56) "2" | 47 | INT_NUMBER@[55; 56) "2" |
48 | SEMI@[56; 57) ";" | 48 | SEMICOLON@[56; 57) ";" |
49 | WHITESPACE@[57; 58) " " | 49 | WHITESPACE@[57; 58) " " |
50 | R_CURLY@[58; 59) "}" | 50 | R_CURLY@[58; 59) "}" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.rast b/crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.rast index 341e02704..420a62639 100644 --- a/crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.rast +++ b/crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.rast | |||
@@ -6,7 +6,7 @@ SOURCE_FILE@[0; 199) | |||
6 | WHITESPACE@[68; 69) " " | 6 | WHITESPACE@[68; 69) " " |
7 | NAME@[69; 72) | 7 | NAME@[69; 72) |
8 | IDENT@[69; 72) "Foo" | 8 | IDENT@[69; 72) "Foo" |
9 | SEMI@[72; 73) ";" | 9 | SEMICOLON@[72; 73) ";" |
10 | WHITESPACE@[73; 75) "\n\n" | 10 | WHITESPACE@[73; 75) "\n\n" |
11 | IMPL_DEF@[75; 141) | 11 | IMPL_DEF@[75; 141) |
12 | IMPL_KW@[75; 79) "impl" | 12 | IMPL_KW@[75; 79) "impl" |
@@ -47,7 +47,7 @@ SOURCE_FILE@[0; 199) | |||
47 | PATH_SEGMENT@[117; 130) | 47 | PATH_SEGMENT@[117; 130) |
48 | NAME_REF@[117; 130) | 48 | NAME_REF@[117; 130) |
49 | IDENT@[117; 130) "unimplemented" | 49 | IDENT@[117; 130) "unimplemented" |
50 | EXCL@[130; 131) "!" | 50 | BANG@[130; 131) "!" |
51 | TOKEN_TREE@[131; 133) | 51 | TOKEN_TREE@[131; 133) |
52 | L_PAREN@[131; 132) "(" | 52 | L_PAREN@[131; 132) "(" |
53 | R_PAREN@[132; 133) ")" | 53 | R_PAREN@[132; 133) ")" |
@@ -113,7 +113,7 @@ SOURCE_FILE@[0; 199) | |||
113 | NAME_REF@[184; 187) | 113 | NAME_REF@[184; 187) |
114 | IDENT@[184; 187) "Foo" | 114 | IDENT@[184; 187) "Foo" |
115 | R_ANGLE@[187; 188) ">" | 115 | R_ANGLE@[187; 188) ">" |
116 | COLONCOLON@[188; 190) "::" | 116 | COLON2@[188; 190) "::" |
117 | PATH_SEGMENT@[190; 193) | 117 | PATH_SEGMENT@[190; 193) |
118 | NAME_REF@[190; 193) | 118 | NAME_REF@[190; 193) |
119 | IDENT@[190; 193) "bar" | 119 | IDENT@[190; 193) "bar" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.rast b/crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.rast index c5821afd0..3bc0ddbde 100644 --- a/crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.rast +++ b/crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.rast | |||
@@ -22,7 +22,7 @@ SOURCE_FILE@[0; 160) | |||
22 | PATH_SEGMENT@[82; 84) | 22 | PATH_SEGMENT@[82; 84) |
23 | NAME_REF@[82; 84) | 23 | NAME_REF@[82; 84) |
24 | IDENT@[82; 84) "u8" | 24 | IDENT@[82; 84) "u8" |
25 | SEMI@[84; 85) ";" | 25 | SEMICOLON@[84; 85) ";" |
26 | WHITESPACE@[85; 86) " " | 26 | WHITESPACE@[85; 86) " " |
27 | LITERAL@[86; 87) | 27 | LITERAL@[86; 87) |
28 | INT_NUMBER@[86; 87) "1" | 28 | INT_NUMBER@[86; 87) "1" |
@@ -80,7 +80,7 @@ SOURCE_FILE@[0; 160) | |||
80 | WHITESPACE@[133; 134) " " | 80 | WHITESPACE@[133; 134) " " |
81 | LITERAL@[134; 135) | 81 | LITERAL@[134; 135) |
82 | INT_NUMBER@[134; 135) "0" | 82 | INT_NUMBER@[134; 135) "0" |
83 | SEMI@[135; 136) ";" | 83 | SEMICOLON@[135; 136) ";" |
84 | WHITESPACE@[136; 141) "\n " | 84 | WHITESPACE@[136; 141) "\n " |
85 | EXPR_STMT@[141; 157) | 85 | EXPR_STMT@[141; 157) |
86 | CALL_EXPR@[141; 156) | 86 | CALL_EXPR@[141; 156) |
@@ -104,7 +104,7 @@ SOURCE_FILE@[0; 160) | |||
104 | ARG_LIST@[154; 156) | 104 | ARG_LIST@[154; 156) |
105 | L_PAREN@[154; 155) "(" | 105 | L_PAREN@[154; 155) "(" |
106 | R_PAREN@[155; 156) ")" | 106 | R_PAREN@[155; 156) ")" |
107 | SEMI@[156; 157) ";" | 107 | SEMICOLON@[156; 157) ";" |
108 | WHITESPACE@[157; 158) "\n" | 108 | WHITESPACE@[157; 158) "\n" |
109 | R_CURLY@[158; 159) "}" | 109 | R_CURLY@[158; 159) "}" |
110 | WHITESPACE@[159; 160) "\n" | 110 | WHITESPACE@[159; 160) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast b/crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast index bfc793dc1..4b2593147 100644 --- a/crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast +++ b/crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast | |||
@@ -47,7 +47,7 @@ SOURCE_FILE@[0; 166) | |||
47 | PATH_SEGMENT@[127; 132) | 47 | PATH_SEGMENT@[127; 132) |
48 | NAME_REF@[127; 132) | 48 | NAME_REF@[127; 132) |
49 | IDENT@[127; 132) "panic" | 49 | IDENT@[127; 132) "panic" |
50 | COLONCOLON@[132; 134) "::" | 50 | COLON2@[132; 134) "::" |
51 | PATH_SEGMENT@[134; 146) | 51 | PATH_SEGMENT@[134; 146) |
52 | NAME_REF@[134; 146) | 52 | NAME_REF@[134; 146) |
53 | IDENT@[134; 146) "catch_unwind" | 53 | IDENT@[134; 146) "catch_unwind" |
@@ -70,7 +70,7 @@ SOURCE_FILE@[0; 166) | |||
70 | L_PAREN@[159; 160) "(" | 70 | L_PAREN@[159; 160) "(" |
71 | R_PAREN@[160; 161) ")" | 71 | R_PAREN@[160; 161) ")" |
72 | R_PAREN@[161; 162) ")" | 72 | R_PAREN@[161; 162) ")" |
73 | SEMI@[162; 163) ";" | 73 | SEMICOLON@[162; 163) ";" |
74 | WHITESPACE@[163; 164) "\n" | 74 | WHITESPACE@[163; 164) "\n" |
75 | R_CURLY@[164; 165) "}" | 75 | R_CURLY@[164; 165) "}" |
76 | WHITESPACE@[165; 166) "\n" | 76 | WHITESPACE@[165; 166) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast b/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast index e15447ca7..954b3bc2a 100644 --- a/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast +++ b/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast | |||
@@ -14,7 +14,7 @@ SOURCE_FILE@[0; 686) | |||
14 | WHITESPACE@[12; 17) "\n " | 14 | WHITESPACE@[12; 17) "\n " |
15 | ATTR@[17; 57) | 15 | ATTR@[17; 57) |
16 | POUND@[17; 18) "#" | 16 | POUND@[17; 18) "#" |
17 | EXCL@[18; 19) "!" | 17 | BANG@[18; 19) "!" |
18 | L_BRACK@[19; 20) "[" | 18 | L_BRACK@[19; 20) "[" |
19 | PATH@[20; 23) | 19 | PATH@[20; 23) |
20 | PATH_SEGMENT@[20; 23) | 20 | PATH_SEGMENT@[20; 23) |
@@ -35,7 +35,7 @@ SOURCE_FILE@[0; 686) | |||
35 | WHITESPACE@[103; 112) "\n " | 35 | WHITESPACE@[103; 112) "\n " |
36 | ATTR@[112; 180) | 36 | ATTR@[112; 180) |
37 | POUND@[112; 113) "#" | 37 | POUND@[112; 113) "#" |
38 | EXCL@[113; 114) "!" | 38 | BANG@[113; 114) "!" |
39 | L_BRACK@[114; 115) "[" | 39 | L_BRACK@[114; 115) "[" |
40 | PATH@[115; 118) | 40 | PATH@[115; 118) |
41 | PATH_SEGMENT@[115; 118) | 41 | PATH_SEGMENT@[115; 118) |
@@ -49,7 +49,7 @@ SOURCE_FILE@[0; 686) | |||
49 | WHITESPACE@[180; 189) "\n " | 49 | WHITESPACE@[180; 189) "\n " |
50 | ATTR@[189; 244) | 50 | ATTR@[189; 244) |
51 | POUND@[189; 190) "#" | 51 | POUND@[189; 190) "#" |
52 | EXCL@[190; 191) "!" | 52 | BANG@[190; 191) "!" |
53 | L_BRACK@[191; 192) "[" | 53 | L_BRACK@[191; 192) "[" |
54 | PATH@[192; 195) | 54 | PATH@[192; 195) |
55 | PATH_SEGMENT@[192; 195) | 55 | PATH_SEGMENT@[192; 195) |
@@ -64,7 +64,7 @@ SOURCE_FILE@[0; 686) | |||
64 | COMMENT@[253; 288) "//! As are ModuleDoc ..." | 64 | COMMENT@[253; 288) "//! As are ModuleDoc ..." |
65 | WHITESPACE@[288; 293) "\n " | 65 | WHITESPACE@[288; 293) "\n " |
66 | R_CURLY@[293; 294) "}" | 66 | R_CURLY@[293; 294) "}" |
67 | SEMI@[294; 295) ";" | 67 | SEMICOLON@[294; 295) ";" |
68 | WHITESPACE@[295; 300) "\n " | 68 | WHITESPACE@[295; 300) "\n " |
69 | BLOCK_EXPR@[300; 459) | 69 | BLOCK_EXPR@[300; 459) |
70 | BLOCK@[300; 459) | 70 | BLOCK@[300; 459) |
@@ -72,7 +72,7 @@ SOURCE_FILE@[0; 686) | |||
72 | WHITESPACE@[301; 310) "\n " | 72 | WHITESPACE@[301; 310) "\n " |
73 | ATTR@[310; 409) | 73 | ATTR@[310; 409) |
74 | POUND@[310; 311) "#" | 74 | POUND@[310; 311) "#" |
75 | EXCL@[311; 312) "!" | 75 | BANG@[311; 312) "!" |
76 | L_BRACK@[312; 313) "[" | 76 | L_BRACK@[312; 313) "[" |
77 | PATH@[313; 316) | 77 | PATH@[313; 316) |
78 | PATH_SEGMENT@[313; 316) | 78 | PATH_SEGMENT@[313; 316) |
@@ -161,7 +161,7 @@ SOURCE_FILE@[0; 686) | |||
161 | WHITESPACE@[603; 612) "\n " | 161 | WHITESPACE@[603; 612) "\n " |
162 | ATTR@[612; 639) | 162 | ATTR@[612; 639) |
163 | POUND@[612; 613) "#" | 163 | POUND@[612; 613) "#" |
164 | EXCL@[613; 614) "!" | 164 | BANG@[613; 614) "!" |
165 | L_BRACK@[614; 615) "[" | 165 | L_BRACK@[614; 615) "[" |
166 | PATH@[615; 620) | 166 | PATH@[615; 620) |
167 | PATH_SEGMENT@[615; 620) | 167 | PATH_SEGMENT@[615; 620) |
diff --git a/crates/ra_syntax/test_data/parser/ok/0046_extern_inner_attributes.rast b/crates/ra_syntax/test_data/parser/ok/0046_extern_inner_attributes.rast index 8f192124b..92c8df2d6 100644 --- a/crates/ra_syntax/test_data/parser/ok/0046_extern_inner_attributes.rast +++ b/crates/ra_syntax/test_data/parser/ok/0046_extern_inner_attributes.rast | |||
@@ -12,7 +12,7 @@ SOURCE_FILE@[0; 87) | |||
12 | WHITESPACE@[42; 47) "\n " | 12 | WHITESPACE@[42; 47) "\n " |
13 | ATTR@[47; 84) | 13 | ATTR@[47; 84) |
14 | POUND@[47; 48) "#" | 14 | POUND@[47; 48) "#" |
15 | EXCL@[48; 49) "!" | 15 | BANG@[48; 49) "!" |
16 | L_BRACK@[49; 50) "[" | 16 | L_BRACK@[49; 50) "[" |
17 | PATH@[50; 53) | 17 | PATH@[50; 53) |
18 | PATH_SEGMENT@[50; 53) | 18 | PATH_SEGMENT@[50; 53) |
diff --git a/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast b/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast index 07a5fbf2d..de703328a 100644 --- a/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast +++ b/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast | |||
@@ -151,7 +151,7 @@ SOURCE_FILE@[0; 395) | |||
151 | PATH_SEGMENT@[234; 235) | 151 | PATH_SEGMENT@[234; 235) |
152 | NAME_REF@[234; 235) | 152 | NAME_REF@[234; 235) |
153 | IDENT@[234; 235) "A" | 153 | IDENT@[234; 235) "A" |
154 | COLONCOLON@[235; 237) "::" | 154 | COLON2@[235; 237) "::" |
155 | PATH_SEGMENT@[237; 238) | 155 | PATH_SEGMENT@[237; 238) |
156 | NAME_REF@[237; 238) | 156 | NAME_REF@[237; 238) |
157 | IDENT@[237; 238) "B" | 157 | IDENT@[237; 238) "B" |
@@ -179,7 +179,7 @@ SOURCE_FILE@[0; 395) | |||
179 | PATH_SEGMENT@[257; 258) | 179 | PATH_SEGMENT@[257; 258) |
180 | NAME_REF@[257; 258) | 180 | NAME_REF@[257; 258) |
181 | IDENT@[257; 258) "A" | 181 | IDENT@[257; 258) "A" |
182 | COLONCOLON@[258; 260) "::" | 182 | COLON2@[258; 260) "::" |
183 | PATH_SEGMENT@[260; 261) | 183 | PATH_SEGMENT@[260; 261) |
184 | NAME_REF@[260; 261) | 184 | NAME_REF@[260; 261) |
185 | IDENT@[260; 261) "B" | 185 | IDENT@[260; 261) "B" |
@@ -303,7 +303,7 @@ SOURCE_FILE@[0; 395) | |||
303 | MINUS@[376; 377) "-" | 303 | MINUS@[376; 377) "-" |
304 | LITERAL@[377; 380) | 304 | LITERAL@[377; 380) |
305 | INT_NUMBER@[377; 380) "128" | 305 | INT_NUMBER@[377; 380) "128" |
306 | DOTDOTEQ@[380; 383) "..=" | 306 | DOT2EQ@[380; 383) "..=" |
307 | LITERAL_PAT@[383; 386) | 307 | LITERAL_PAT@[383; 386) |
308 | LITERAL@[383; 386) | 308 | LITERAL@[383; 386) |
309 | INT_NUMBER@[383; 386) "127" | 309 | INT_NUMBER@[383; 386) "127" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0048_compound_assignment.rast b/crates/ra_syntax/test_data/parser/ok/0048_compound_assignment.rast index c9cf84ffd..849d8a445 100644 --- a/crates/ra_syntax/test_data/parser/ok/0048_compound_assignment.rast +++ b/crates/ra_syntax/test_data/parser/ok/0048_compound_assignment.rast | |||
@@ -27,7 +27,7 @@ SOURCE_FILE@[0; 257) | |||
27 | WHITESPACE@[102; 103) " " | 27 | WHITESPACE@[102; 103) " " |
28 | LITERAL@[103; 104) | 28 | LITERAL@[103; 104) |
29 | INT_NUMBER@[103; 104) "0" | 29 | INT_NUMBER@[103; 104) "0" |
30 | SEMI@[104; 105) ";" | 30 | SEMICOLON@[104; 105) ";" |
31 | WHITESPACE@[105; 110) "\n " | 31 | WHITESPACE@[105; 110) "\n " |
32 | EXPR_STMT@[110; 117) | 32 | EXPR_STMT@[110; 117) |
33 | BIN_EXPR@[110; 116) | 33 | BIN_EXPR@[110; 116) |
@@ -41,7 +41,7 @@ SOURCE_FILE@[0; 257) | |||
41 | WHITESPACE@[114; 115) " " | 41 | WHITESPACE@[114; 115) " " |
42 | LITERAL@[115; 116) | 42 | LITERAL@[115; 116) |
43 | INT_NUMBER@[115; 116) "1" | 43 | INT_NUMBER@[115; 116) "1" |
44 | SEMI@[116; 117) ";" | 44 | SEMICOLON@[116; 117) ";" |
45 | WHITESPACE@[117; 122) "\n " | 45 | WHITESPACE@[117; 122) "\n " |
46 | EXPR_STMT@[122; 129) | 46 | EXPR_STMT@[122; 129) |
47 | BIN_EXPR@[122; 128) | 47 | BIN_EXPR@[122; 128) |
@@ -55,7 +55,7 @@ SOURCE_FILE@[0; 257) | |||
55 | WHITESPACE@[126; 127) " " | 55 | WHITESPACE@[126; 127) " " |
56 | LITERAL@[127; 128) | 56 | LITERAL@[127; 128) |
57 | INT_NUMBER@[127; 128) "2" | 57 | INT_NUMBER@[127; 128) "2" |
58 | SEMI@[128; 129) ";" | 58 | SEMICOLON@[128; 129) ";" |
59 | WHITESPACE@[129; 134) "\n " | 59 | WHITESPACE@[129; 134) "\n " |
60 | EXPR_STMT@[134; 141) | 60 | EXPR_STMT@[134; 141) |
61 | BIN_EXPR@[134; 140) | 61 | BIN_EXPR@[134; 140) |
@@ -69,7 +69,7 @@ SOURCE_FILE@[0; 257) | |||
69 | WHITESPACE@[138; 139) " " | 69 | WHITESPACE@[138; 139) " " |
70 | LITERAL@[139; 140) | 70 | LITERAL@[139; 140) |
71 | INT_NUMBER@[139; 140) "3" | 71 | INT_NUMBER@[139; 140) "3" |
72 | SEMI@[140; 141) ";" | 72 | SEMICOLON@[140; 141) ";" |
73 | WHITESPACE@[141; 146) "\n " | 73 | WHITESPACE@[141; 146) "\n " |
74 | EXPR_STMT@[146; 153) | 74 | EXPR_STMT@[146; 153) |
75 | BIN_EXPR@[146; 152) | 75 | BIN_EXPR@[146; 152) |
@@ -83,7 +83,7 @@ SOURCE_FILE@[0; 257) | |||
83 | WHITESPACE@[150; 151) " " | 83 | WHITESPACE@[150; 151) " " |
84 | LITERAL@[151; 152) | 84 | LITERAL@[151; 152) |
85 | INT_NUMBER@[151; 152) "4" | 85 | INT_NUMBER@[151; 152) "4" |
86 | SEMI@[152; 153) ";" | 86 | SEMICOLON@[152; 153) ";" |
87 | WHITESPACE@[153; 158) "\n " | 87 | WHITESPACE@[153; 158) "\n " |
88 | EXPR_STMT@[158; 165) | 88 | EXPR_STMT@[158; 165) |
89 | BIN_EXPR@[158; 164) | 89 | BIN_EXPR@[158; 164) |
@@ -97,7 +97,7 @@ SOURCE_FILE@[0; 257) | |||
97 | WHITESPACE@[162; 163) " " | 97 | WHITESPACE@[162; 163) " " |
98 | LITERAL@[163; 164) | 98 | LITERAL@[163; 164) |
99 | INT_NUMBER@[163; 164) "5" | 99 | INT_NUMBER@[163; 164) "5" |
100 | SEMI@[164; 165) ";" | 100 | SEMICOLON@[164; 165) ";" |
101 | WHITESPACE@[165; 170) "\n " | 101 | WHITESPACE@[165; 170) "\n " |
102 | EXPR_STMT@[170; 177) | 102 | EXPR_STMT@[170; 177) |
103 | BIN_EXPR@[170; 176) | 103 | BIN_EXPR@[170; 176) |
@@ -111,7 +111,7 @@ SOURCE_FILE@[0; 257) | |||
111 | WHITESPACE@[174; 175) " " | 111 | WHITESPACE@[174; 175) " " |
112 | LITERAL@[175; 176) | 112 | LITERAL@[175; 176) |
113 | INT_NUMBER@[175; 176) "6" | 113 | INT_NUMBER@[175; 176) "6" |
114 | SEMI@[176; 177) ";" | 114 | SEMICOLON@[176; 177) ";" |
115 | WHITESPACE@[177; 182) "\n " | 115 | WHITESPACE@[177; 182) "\n " |
116 | EXPR_STMT@[182; 189) | 116 | EXPR_STMT@[182; 189) |
117 | BIN_EXPR@[182; 188) | 117 | BIN_EXPR@[182; 188) |
@@ -125,7 +125,7 @@ SOURCE_FILE@[0; 257) | |||
125 | WHITESPACE@[186; 187) " " | 125 | WHITESPACE@[186; 187) " " |
126 | LITERAL@[187; 188) | 126 | LITERAL@[187; 188) |
127 | INT_NUMBER@[187; 188) "7" | 127 | INT_NUMBER@[187; 188) "7" |
128 | SEMI@[188; 189) ";" | 128 | SEMICOLON@[188; 189) ";" |
129 | WHITESPACE@[189; 194) "\n " | 129 | WHITESPACE@[189; 194) "\n " |
130 | EXPR_STMT@[194; 201) | 130 | EXPR_STMT@[194; 201) |
131 | BIN_EXPR@[194; 200) | 131 | BIN_EXPR@[194; 200) |
@@ -139,7 +139,7 @@ SOURCE_FILE@[0; 257) | |||
139 | WHITESPACE@[198; 199) " " | 139 | WHITESPACE@[198; 199) " " |
140 | LITERAL@[199; 200) | 140 | LITERAL@[199; 200) |
141 | INT_NUMBER@[199; 200) "8" | 141 | INT_NUMBER@[199; 200) "8" |
142 | SEMI@[200; 201) ";" | 142 | SEMICOLON@[200; 201) ";" |
143 | WHITESPACE@[201; 206) "\n " | 143 | WHITESPACE@[201; 206) "\n " |
144 | EXPR_STMT@[206; 213) | 144 | EXPR_STMT@[206; 213) |
145 | BIN_EXPR@[206; 212) | 145 | BIN_EXPR@[206; 212) |
@@ -153,7 +153,7 @@ SOURCE_FILE@[0; 257) | |||
153 | WHITESPACE@[210; 211) " " | 153 | WHITESPACE@[210; 211) " " |
154 | LITERAL@[211; 212) | 154 | LITERAL@[211; 212) |
155 | INT_NUMBER@[211; 212) "9" | 155 | INT_NUMBER@[211; 212) "9" |
156 | SEMI@[212; 213) ";" | 156 | SEMICOLON@[212; 213) ";" |
157 | WHITESPACE@[213; 218) "\n " | 157 | WHITESPACE@[213; 218) "\n " |
158 | EXPR_STMT@[218; 226) | 158 | EXPR_STMT@[218; 226) |
159 | BIN_EXPR@[218; 225) | 159 | BIN_EXPR@[218; 225) |
@@ -167,7 +167,7 @@ SOURCE_FILE@[0; 257) | |||
167 | WHITESPACE@[222; 223) " " | 167 | WHITESPACE@[222; 223) " " |
168 | LITERAL@[223; 225) | 168 | LITERAL@[223; 225) |
169 | INT_NUMBER@[223; 225) "10" | 169 | INT_NUMBER@[223; 225) "10" |
170 | SEMI@[225; 226) ";" | 170 | SEMICOLON@[225; 226) ";" |
171 | WHITESPACE@[226; 231) "\n " | 171 | WHITESPACE@[226; 231) "\n " |
172 | EXPR_STMT@[231; 240) | 172 | EXPR_STMT@[231; 240) |
173 | BIN_EXPR@[231; 239) | 173 | BIN_EXPR@[231; 239) |
@@ -181,7 +181,7 @@ SOURCE_FILE@[0; 257) | |||
181 | WHITESPACE@[236; 237) " " | 181 | WHITESPACE@[236; 237) " " |
182 | LITERAL@[237; 239) | 182 | LITERAL@[237; 239) |
183 | INT_NUMBER@[237; 239) "11" | 183 | INT_NUMBER@[237; 239) "11" |
184 | SEMI@[239; 240) ";" | 184 | SEMICOLON@[239; 240) ";" |
185 | WHITESPACE@[240; 245) "\n " | 185 | WHITESPACE@[240; 245) "\n " |
186 | EXPR_STMT@[245; 254) | 186 | EXPR_STMT@[245; 254) |
187 | BIN_EXPR@[245; 253) | 187 | BIN_EXPR@[245; 253) |
@@ -195,7 +195,7 @@ SOURCE_FILE@[0; 257) | |||
195 | WHITESPACE@[250; 251) " " | 195 | WHITESPACE@[250; 251) " " |
196 | LITERAL@[251; 253) | 196 | LITERAL@[251; 253) |
197 | INT_NUMBER@[251; 253) "12" | 197 | INT_NUMBER@[251; 253) "12" |
198 | SEMI@[253; 254) ";" | 198 | SEMICOLON@[253; 254) ";" |
199 | WHITESPACE@[254; 255) "\n" | 199 | WHITESPACE@[254; 255) "\n" |
200 | R_CURLY@[255; 256) "}" | 200 | R_CURLY@[255; 256) "}" |
201 | WHITESPACE@[256; 257) "\n" | 201 | WHITESPACE@[256; 257) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0049_async_block.rast b/crates/ra_syntax/test_data/parser/ok/0049_async_block.rast index aa6daff7d..0d32f0115 100644 --- a/crates/ra_syntax/test_data/parser/ok/0049_async_block.rast +++ b/crates/ra_syntax/test_data/parser/ok/0049_async_block.rast | |||
@@ -19,7 +19,7 @@ SOURCE_FILE@[0; 47) | |||
19 | BLOCK@[21; 23) | 19 | BLOCK@[21; 23) |
20 | L_CURLY@[21; 22) "{" | 20 | L_CURLY@[21; 22) "{" |
21 | R_CURLY@[22; 23) "}" | 21 | R_CURLY@[22; 23) "}" |
22 | SEMI@[23; 24) ";" | 22 | SEMICOLON@[23; 24) ";" |
23 | WHITESPACE@[24; 29) "\n " | 23 | WHITESPACE@[24; 29) "\n " |
24 | EXPR_STMT@[29; 43) | 24 | EXPR_STMT@[29; 43) |
25 | BLOCK_EXPR@[29; 42) | 25 | BLOCK_EXPR@[29; 42) |
@@ -30,7 +30,7 @@ SOURCE_FILE@[0; 47) | |||
30 | BLOCK@[40; 42) | 30 | BLOCK@[40; 42) |
31 | L_CURLY@[40; 41) "{" | 31 | L_CURLY@[40; 41) "{" |
32 | R_CURLY@[41; 42) "}" | 32 | R_CURLY@[41; 42) "}" |
33 | SEMI@[42; 43) ";" | 33 | SEMICOLON@[42; 43) ";" |
34 | WHITESPACE@[43; 44) "\n" | 34 | WHITESPACE@[43; 44) "\n" |
35 | R_CURLY@[44; 45) "}" | 35 | R_CURLY@[44; 45) "}" |
36 | WHITESPACE@[45; 47) "\n\n" | 36 | WHITESPACE@[45; 47) "\n\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0050_async_block_as_argument.rast b/crates/ra_syntax/test_data/parser/ok/0050_async_block_as_argument.rast index 435f27970..17591d99f 100644 --- a/crates/ra_syntax/test_data/parser/ok/0050_async_block_as_argument.rast +++ b/crates/ra_syntax/test_data/parser/ok/0050_async_block_as_argument.rast | |||
@@ -24,11 +24,11 @@ SOURCE_FILE@[0; 95) | |||
24 | PATH_SEGMENT@[15; 18) | 24 | PATH_SEGMENT@[15; 18) |
25 | NAME_REF@[15; 18) | 25 | NAME_REF@[15; 18) |
26 | IDENT@[15; 18) "std" | 26 | IDENT@[15; 18) "std" |
27 | COLONCOLON@[18; 20) "::" | 27 | COLON2@[18; 20) "::" |
28 | PATH_SEGMENT@[20; 26) | 28 | PATH_SEGMENT@[20; 26) |
29 | NAME_REF@[20; 26) | 29 | NAME_REF@[20; 26) |
30 | IDENT@[20; 26) "future" | 30 | IDENT@[20; 26) "future" |
31 | COLONCOLON@[26; 28) "::" | 31 | COLON2@[26; 28) "::" |
32 | PATH_SEGMENT@[28; 48) | 32 | PATH_SEGMENT@[28; 48) |
33 | NAME_REF@[28; 34) | 33 | NAME_REF@[28; 34) |
34 | IDENT@[28; 34) "Future" | 34 | IDENT@[28; 34) "Future" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast b/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast index 254eafc36..8fd28427c 100644 --- a/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast +++ b/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast | |||
@@ -119,7 +119,7 @@ SOURCE_FILE@[0; 519) | |||
119 | R_BRACK@[112; 113) "]" | 119 | R_BRACK@[112; 113) "]" |
120 | WHITESPACE@[113; 114) " " | 120 | WHITESPACE@[113; 114) " " |
121 | PARAM@[114; 117) | 121 | PARAM@[114; 117) |
122 | DOTDOTDOT@[114; 117) "..." | 122 | DOT3@[114; 117) "..." |
123 | R_PAREN@[117; 118) ")" | 123 | R_PAREN@[117; 118) ")" |
124 | WHITESPACE@[118; 119) " " | 124 | WHITESPACE@[118; 119) " " |
125 | RET_TYPE@[119; 125) | 125 | RET_TYPE@[119; 125) |
@@ -130,7 +130,7 @@ SOURCE_FILE@[0; 519) | |||
130 | PATH_SEGMENT@[122; 125) | 130 | PATH_SEGMENT@[122; 125) |
131 | NAME_REF@[122; 125) | 131 | NAME_REF@[122; 125) |
132 | IDENT@[122; 125) "i32" | 132 | IDENT@[122; 125) "i32" |
133 | SEMI@[125; 126) ";" | 133 | SEMICOLON@[125; 126) ";" |
134 | WHITESPACE@[126; 127) " " | 134 | WHITESPACE@[126; 127) " " |
135 | R_CURLY@[127; 128) "}" | 135 | R_CURLY@[127; 128) "}" |
136 | WHITESPACE@[128; 130) "\n\n" | 136 | WHITESPACE@[128; 130) "\n\n" |
@@ -250,7 +250,7 @@ SOURCE_FILE@[0; 519) | |||
250 | NAME_REF@[229; 232) | 250 | NAME_REF@[229; 232) |
251 | IDENT@[229; 232) "i32" | 251 | IDENT@[229; 232) "i32" |
252 | R_PAREN@[232; 233) ")" | 252 | R_PAREN@[232; 233) ")" |
253 | SEMI@[233; 234) ";" | 253 | SEMICOLON@[233; 234) ";" |
254 | WHITESPACE@[234; 235) "\n" | 254 | WHITESPACE@[234; 235) "\n" |
255 | R_CURLY@[235; 236) "}" | 255 | R_CURLY@[235; 236) "}" |
256 | WHITESPACE@[236; 238) "\n\n" | 256 | WHITESPACE@[236; 238) "\n\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rast b/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rast index 374c58670..473966cd4 100644 --- a/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rast +++ b/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rast | |||
@@ -25,7 +25,7 @@ SOURCE_FILE@[0; 80) | |||
25 | LITERAL@[24; 25) | 25 | LITERAL@[24; 25) |
26 | INT_NUMBER@[24; 25) "0" | 26 | INT_NUMBER@[24; 25) "0" |
27 | WHITESPACE@[25; 26) " " | 27 | WHITESPACE@[25; 26) " " |
28 | DOTDOT@[26; 28) ".." | 28 | DOT2@[26; 28) ".." |
29 | WHITESPACE@[28; 29) " " | 29 | WHITESPACE@[28; 29) " " |
30 | METHOD_CALL_EXPR@[29; 56) | 30 | METHOD_CALL_EXPR@[29; 56) |
31 | PAREN_EXPR@[29; 43) | 31 | PAREN_EXPR@[29; 43) |
@@ -34,7 +34,7 @@ SOURCE_FILE@[0; 80) | |||
34 | LITERAL@[30; 31) | 34 | LITERAL@[30; 31) |
35 | INT_NUMBER@[30; 31) "0" | 35 | INT_NUMBER@[30; 31) "0" |
36 | WHITESPACE@[31; 32) " " | 36 | WHITESPACE@[31; 32) " " |
37 | DOTDOT@[32; 34) ".." | 37 | DOT2@[32; 34) ".." |
38 | WHITESPACE@[34; 35) " " | 38 | WHITESPACE@[34; 35) " " |
39 | BLOCK_EXPR@[35; 42) | 39 | BLOCK_EXPR@[35; 42) |
40 | BLOCK@[35; 42) | 40 | BLOCK@[35; 42) |
@@ -53,7 +53,7 @@ SOURCE_FILE@[0; 80) | |||
53 | NAME_REF@[44; 47) | 53 | NAME_REF@[44; 47) |
54 | IDENT@[44; 47) "sum" | 54 | IDENT@[44; 47) "sum" |
55 | TYPE_ARG_LIST@[47; 54) | 55 | TYPE_ARG_LIST@[47; 54) |
56 | COLONCOLON@[47; 49) "::" | 56 | COLON2@[47; 49) "::" |
57 | L_ANGLE@[49; 50) "<" | 57 | L_ANGLE@[49; 50) "<" |
58 | TYPE_ARG@[50; 53) | 58 | TYPE_ARG@[50; 53) |
59 | PATH_TYPE@[50; 53) | 59 | PATH_TYPE@[50; 53) |
@@ -73,7 +73,7 @@ SOURCE_FILE@[0; 80) | |||
73 | EXPR_STMT@[66; 72) | 73 | EXPR_STMT@[66; 72) |
74 | BREAK_EXPR@[66; 71) | 74 | BREAK_EXPR@[66; 71) |
75 | BREAK_KW@[66; 71) "break" | 75 | BREAK_KW@[66; 71) "break" |
76 | SEMI@[71; 72) ";" | 76 | SEMICOLON@[71; 72) ";" |
77 | WHITESPACE@[72; 76) "\n " | 77 | WHITESPACE@[72; 76) "\n " |
78 | R_CURLY@[76; 77) "}" | 78 | R_CURLY@[76; 77) "}" |
79 | WHITESPACE@[77; 78) "\n" | 79 | WHITESPACE@[77; 78) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0053_outer_attribute_on_macro_rules.rast b/crates/ra_syntax/test_data/parser/ok/0053_outer_attribute_on_macro_rules.rast index 04ff0e2ff..60a491853 100644 --- a/crates/ra_syntax/test_data/parser/ok/0053_outer_attribute_on_macro_rules.rast +++ b/crates/ra_syntax/test_data/parser/ok/0053_outer_attribute_on_macro_rules.rast | |||
@@ -15,7 +15,7 @@ SOURCE_FILE@[0; 65) | |||
15 | PATH_SEGMENT@[30; 41) | 15 | PATH_SEGMENT@[30; 41) |
16 | NAME_REF@[30; 41) | 16 | NAME_REF@[30; 41) |
17 | IDENT@[30; 41) "macro_rules" | 17 | IDENT@[30; 41) "macro_rules" |
18 | EXCL@[41; 42) "!" | 18 | BANG@[41; 42) "!" |
19 | WHITESPACE@[42; 43) " " | 19 | WHITESPACE@[42; 43) " " |
20 | NAME@[43; 46) | 20 | NAME@[43; 46) |
21 | IDENT@[43; 46) "foo" | 21 | IDENT@[43; 46) "foo" |
@@ -33,7 +33,7 @@ SOURCE_FILE@[0; 65) | |||
33 | TOKEN_TREE@[59; 61) | 33 | TOKEN_TREE@[59; 61) |
34 | L_CURLY@[59; 60) "{" | 34 | L_CURLY@[59; 60) "{" |
35 | R_CURLY@[60; 61) "}" | 35 | R_CURLY@[60; 61) "}" |
36 | SEMI@[61; 62) ";" | 36 | SEMICOLON@[61; 62) ";" |
37 | WHITESPACE@[62; 63) "\n" | 37 | WHITESPACE@[62; 63) "\n" |
38 | R_CURLY@[63; 64) "}" | 38 | R_CURLY@[63; 64) "}" |
39 | WHITESPACE@[64; 65) "\n" | 39 | WHITESPACE@[64; 65) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast b/crates/ra_syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast index 7e1af254c..fabf88e8f 100644 --- a/crates/ra_syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast +++ b/crates/ra_syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast | |||
@@ -25,7 +25,7 @@ SOURCE_FILE@[0; 88) | |||
25 | PATH_SEGMENT@[14; 17) | 25 | PATH_SEGMENT@[14; 17) |
26 | NAME_REF@[14; 17) | 26 | NAME_REF@[14; 17) |
27 | IDENT@[14; 17) "bar" | 27 | IDENT@[14; 17) "bar" |
28 | COLONCOLON@[17; 19) "::" | 28 | COLON2@[17; 19) "::" |
29 | PATH_SEGMENT@[19; 22) | 29 | PATH_SEGMENT@[19; 22) |
30 | NAME_REF@[19; 22) | 30 | NAME_REF@[19; 22) |
31 | IDENT@[19; 22) "Baz" | 31 | IDENT@[19; 22) "Baz" |
@@ -67,7 +67,7 @@ SOURCE_FILE@[0; 88) | |||
67 | PATH_SEGMENT@[47; 48) | 67 | PATH_SEGMENT@[47; 48) |
68 | NAME_REF@[47; 48) | 68 | NAME_REF@[47; 48) |
69 | IDENT@[47; 48) "x" | 69 | IDENT@[47; 48) "x" |
70 | COLONCOLON@[48; 50) "::" | 70 | COLON2@[48; 50) "::" |
71 | PATH_SEGMENT@[50; 51) | 71 | PATH_SEGMENT@[50; 51) |
72 | NAME_REF@[50; 51) | 72 | NAME_REF@[50; 51) |
73 | IDENT@[50; 51) "Y" | 73 | IDENT@[50; 51) "Y" |
@@ -112,7 +112,7 @@ SOURCE_FILE@[0; 88) | |||
112 | PATH_SEGMENT@[78; 79) | 112 | PATH_SEGMENT@[78; 79) |
113 | NAME_REF@[78; 79) | 113 | NAME_REF@[78; 79) |
114 | IDENT@[78; 79) "x" | 114 | IDENT@[78; 79) "x" |
115 | COLONCOLON@[79; 81) "::" | 115 | COLON2@[79; 81) "::" |
116 | PATH_SEGMENT@[81; 82) | 116 | PATH_SEGMENT@[81; 82) |
117 | NAME_REF@[81; 82) | 117 | NAME_REF@[81; 82) |
118 | IDENT@[81; 82) "Y" | 118 | IDENT@[81; 82) "Y" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0055_dot_dot_dot.rast b/crates/ra_syntax/test_data/parser/ok/0055_dot_dot_dot.rast index d656e74b1..6ac3f1458 100644 --- a/crates/ra_syntax/test_data/parser/ok/0055_dot_dot_dot.rast +++ b/crates/ra_syntax/test_data/parser/ok/0055_dot_dot_dot.rast | |||
@@ -10,7 +10,7 @@ SOURCE_FILE@[0; 49) | |||
10 | TUPLE_TYPE@[9; 11) | 10 | TUPLE_TYPE@[9; 11) |
11 | L_PAREN@[9; 10) "(" | 11 | L_PAREN@[9; 10) "(" |
12 | R_PAREN@[10; 11) ")" | 12 | R_PAREN@[10; 11) ")" |
13 | SEMI@[11; 12) ";" | 13 | SEMICOLON@[11; 12) ";" |
14 | WHITESPACE@[12; 14) "\n\n" | 14 | WHITESPACE@[12; 14) "\n\n" |
15 | FN_DEF@[14; 48) | 15 | FN_DEF@[14; 48) |
16 | FN_KW@[14; 16) "fn" | 16 | FN_KW@[14; 16) "fn" |
@@ -35,7 +35,7 @@ SOURCE_FILE@[0; 49) | |||
35 | PATH_TYPE@[37; 40) | 35 | PATH_TYPE@[37; 40) |
36 | PATH@[37; 40) | 36 | PATH@[37; 40) |
37 | PATH_SEGMENT@[37; 40) | 37 | PATH_SEGMENT@[37; 40) |
38 | COLONCOLON@[37; 39) "::" | 38 | COLON2@[37; 39) "::" |
39 | NAME_REF@[39; 40) | 39 | NAME_REF@[39; 40) |
40 | IDENT@[39; 40) "X" | 40 | IDENT@[39; 40) "X" |
41 | WHITESPACE@[40; 41) " " | 41 | WHITESPACE@[40; 41) " " |
@@ -44,7 +44,7 @@ SOURCE_FILE@[0; 49) | |||
44 | TUPLE_EXPR@[43; 45) | 44 | TUPLE_EXPR@[43; 45) |
45 | L_PAREN@[43; 44) "(" | 45 | L_PAREN@[43; 44) "(" |
46 | R_PAREN@[44; 45) ")" | 46 | R_PAREN@[44; 45) ")" |
47 | SEMI@[45; 46) ";" | 47 | SEMICOLON@[45; 46) ";" |
48 | WHITESPACE@[46; 47) "\n" | 48 | WHITESPACE@[46; 47) "\n" |
49 | R_CURLY@[47; 48) "}" | 49 | R_CURLY@[47; 48) "}" |
50 | WHITESPACE@[48; 49) "\n" | 50 | WHITESPACE@[48; 49) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0057_loop_in_call.rast b/crates/ra_syntax/test_data/parser/ok/0057_loop_in_call.rast index cc8c3f7ec..2c07bde43 100644 --- a/crates/ra_syntax/test_data/parser/ok/0057_loop_in_call.rast +++ b/crates/ra_syntax/test_data/parser/ok/0057_loop_in_call.rast | |||
@@ -54,6 +54,6 @@ SOURCE_FILE@[0; 50) | |||
54 | L_CURLY@[44; 45) "{" | 54 | L_CURLY@[44; 45) "{" |
55 | R_CURLY@[45; 46) "}" | 55 | R_CURLY@[45; 46) "}" |
56 | R_PAREN@[46; 47) ")" | 56 | R_PAREN@[46; 47) ")" |
57 | SEMI@[47; 48) ";" | 57 | SEMICOLON@[47; 48) ";" |
58 | WHITESPACE@[48; 49) "\n" | 58 | WHITESPACE@[48; 49) "\n" |
59 | R_CURLY@[49; 50) "}" | 59 | R_CURLY@[49; 50) "}" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0058_unary_expr_precedence.rast b/crates/ra_syntax/test_data/parser/ok/0058_unary_expr_precedence.rast index d30cb63ff..9de9efbad 100644 --- a/crates/ra_syntax/test_data/parser/ok/0058_unary_expr_precedence.rast +++ b/crates/ra_syntax/test_data/parser/ok/0058_unary_expr_precedence.rast | |||
@@ -31,7 +31,7 @@ SOURCE_FILE@[0; 79) | |||
31 | WHITESPACE@[24; 25) " " | 31 | WHITESPACE@[24; 25) " " |
32 | LITERAL@[25; 26) | 32 | LITERAL@[25; 26) |
33 | INT_NUMBER@[25; 26) "3" | 33 | INT_NUMBER@[25; 26) "3" |
34 | SEMI@[26; 27) ";" | 34 | SEMICOLON@[26; 27) ";" |
35 | WHITESPACE@[27; 32) "\n " | 35 | WHITESPACE@[27; 32) "\n " |
36 | EXPR_STMT@[32; 43) | 36 | EXPR_STMT@[32; 43) |
37 | CAST_EXPR@[32; 42) | 37 | CAST_EXPR@[32; 42) |
@@ -49,7 +49,7 @@ SOURCE_FILE@[0; 79) | |||
49 | PATH_SEGMENT@[39; 42) | 49 | PATH_SEGMENT@[39; 42) |
50 | NAME_REF@[39; 42) | 50 | NAME_REF@[39; 42) |
51 | IDENT@[39; 42) "u64" | 51 | IDENT@[39; 42) "u64" |
52 | SEMI@[42; 43) ";" | 52 | SEMICOLON@[42; 43) ";" |
53 | WHITESPACE@[43; 48) "\n " | 53 | WHITESPACE@[43; 48) "\n " |
54 | EXPR_STMT@[48; 54) | 54 | EXPR_STMT@[48; 54) |
55 | PREFIX_EXPR@[48; 53) | 55 | PREFIX_EXPR@[48; 53) |
@@ -65,7 +65,7 @@ SOURCE_FILE@[0; 79) | |||
65 | LITERAL@[51; 52) | 65 | LITERAL@[51; 52) |
66 | INT_NUMBER@[51; 52) "1" | 66 | INT_NUMBER@[51; 52) "1" |
67 | R_PAREN@[52; 53) ")" | 67 | R_PAREN@[52; 53) ")" |
68 | SEMI@[53; 54) ";" | 68 | SEMICOLON@[53; 54) ";" |
69 | WHITESPACE@[54; 59) "\n " | 69 | WHITESPACE@[54; 59) "\n " |
70 | EXPR_STMT@[59; 65) | 70 | EXPR_STMT@[59; 65) |
71 | REF_EXPR@[59; 64) | 71 | REF_EXPR@[59; 64) |
@@ -80,7 +80,7 @@ SOURCE_FILE@[0; 79) | |||
80 | LITERAL@[62; 63) | 80 | LITERAL@[62; 63) |
81 | INT_NUMBER@[62; 63) "1" | 81 | INT_NUMBER@[62; 63) "1" |
82 | R_BRACK@[63; 64) "]" | 82 | R_BRACK@[63; 64) "]" |
83 | SEMI@[64; 65) ";" | 83 | SEMICOLON@[64; 65) ";" |
84 | WHITESPACE@[65; 70) "\n " | 84 | WHITESPACE@[65; 70) "\n " |
85 | EXPR_STMT@[70; 76) | 85 | EXPR_STMT@[70; 76) |
86 | RANGE_EXPR@[70; 75) | 86 | RANGE_EXPR@[70; 75) |
@@ -88,10 +88,10 @@ SOURCE_FILE@[0; 79) | |||
88 | MINUS@[70; 71) "-" | 88 | MINUS@[70; 71) "-" |
89 | LITERAL@[71; 72) | 89 | LITERAL@[71; 72) |
90 | INT_NUMBER@[71; 72) "1" | 90 | INT_NUMBER@[71; 72) "1" |
91 | DOTDOT@[72; 74) ".." | 91 | DOT2@[72; 74) ".." |
92 | LITERAL@[74; 75) | 92 | LITERAL@[74; 75) |
93 | INT_NUMBER@[74; 75) "2" | 93 | INT_NUMBER@[74; 75) "2" |
94 | SEMI@[75; 76) ";" | 94 | SEMICOLON@[75; 76) ";" |
95 | WHITESPACE@[76; 77) "\n" | 95 | WHITESPACE@[76; 77) "\n" |
96 | R_CURLY@[77; 78) "}" | 96 | R_CURLY@[77; 78) "}" |
97 | WHITESPACE@[78; 79) "\n" | 97 | WHITESPACE@[78; 79) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0059_loops_in_parens.rast b/crates/ra_syntax/test_data/parser/ok/0059_loops_in_parens.rast index c011187ea..101478ce1 100644 --- a/crates/ra_syntax/test_data/parser/ok/0059_loops_in_parens.rast +++ b/crates/ra_syntax/test_data/parser/ok/0059_loops_in_parens.rast | |||
@@ -47,7 +47,7 @@ SOURCE_FILE@[0; 105) | |||
47 | L_CURLY@[46; 47) "{" | 47 | L_CURLY@[46; 47) "{" |
48 | R_CURLY@[47; 48) "}" | 48 | R_CURLY@[47; 48) "}" |
49 | R_PAREN@[48; 49) ")" | 49 | R_PAREN@[48; 49) ")" |
50 | SEMI@[49; 50) ";" | 50 | SEMICOLON@[49; 50) ";" |
51 | WHITESPACE@[50; 55) "\n " | 51 | WHITESPACE@[50; 55) "\n " |
52 | EXPR_STMT@[55; 77) | 52 | EXPR_STMT@[55; 77) |
53 | CALL_EXPR@[55; 76) | 53 | CALL_EXPR@[55; 76) |
@@ -68,11 +68,11 @@ SOURCE_FILE@[0; 105) | |||
68 | EXPR_STMT@[67; 73) | 68 | EXPR_STMT@[67; 73) |
69 | BREAK_EXPR@[67; 72) | 69 | BREAK_EXPR@[67; 72) |
70 | BREAK_KW@[67; 72) "break" | 70 | BREAK_KW@[67; 72) "break" |
71 | SEMI@[72; 73) ";" | 71 | SEMICOLON@[72; 73) ";" |
72 | WHITESPACE@[73; 74) " " | 72 | WHITESPACE@[73; 74) " " |
73 | R_CURLY@[74; 75) "}" | 73 | R_CURLY@[74; 75) "}" |
74 | R_PAREN@[75; 76) ")" | 74 | R_PAREN@[75; 76) ")" |
75 | SEMI@[76; 77) ";" | 75 | SEMICOLON@[76; 77) ";" |
76 | WHITESPACE@[77; 82) "\n " | 76 | WHITESPACE@[77; 82) "\n " |
77 | EXPR_STMT@[82; 102) | 77 | EXPR_STMT@[82; 102) |
78 | CALL_EXPR@[82; 101) | 78 | CALL_EXPR@[82; 101) |
@@ -95,7 +95,7 @@ SOURCE_FILE@[0; 105) | |||
95 | L_CURLY@[98; 99) "{" | 95 | L_CURLY@[98; 99) "{" |
96 | R_CURLY@[99; 100) "}" | 96 | R_CURLY@[99; 100) "}" |
97 | R_PAREN@[100; 101) ")" | 97 | R_PAREN@[100; 101) ")" |
98 | SEMI@[101; 102) ";" | 98 | SEMICOLON@[101; 102) ";" |
99 | WHITESPACE@[102; 103) "\n" | 99 | WHITESPACE@[102; 103) "\n" |
100 | R_CURLY@[103; 104) "}" | 100 | R_CURLY@[103; 104) "}" |
101 | WHITESPACE@[104; 105) "\n" | 101 | WHITESPACE@[104; 105) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0060_as_range.rast b/crates/ra_syntax/test_data/parser/ok/0060_as_range.rast index ad0c4a3fe..6bff57505 100644 --- a/crates/ra_syntax/test_data/parser/ok/0060_as_range.rast +++ b/crates/ra_syntax/test_data/parser/ok/0060_as_range.rast | |||
@@ -26,8 +26,8 @@ SOURCE_FILE@[0; 56) | |||
26 | NAME_REF@[21; 26) | 26 | NAME_REF@[21; 26) |
27 | IDENT@[21; 26) "usize" | 27 | IDENT@[21; 26) "usize" |
28 | WHITESPACE@[26; 27) " " | 28 | WHITESPACE@[26; 27) " " |
29 | DOTDOT@[27; 29) ".." | 29 | DOT2@[27; 29) ".." |
30 | SEMI@[29; 30) ";" | 30 | SEMICOLON@[29; 30) ";" |
31 | WHITESPACE@[30; 35) "\n " | 31 | WHITESPACE@[30; 35) "\n " |
32 | EXPR_STMT@[35; 53) | 32 | EXPR_STMT@[35; 53) |
33 | RANGE_EXPR@[35; 52) | 33 | RANGE_EXPR@[35; 52) |
@@ -49,8 +49,8 @@ SOURCE_FILE@[0; 56) | |||
49 | NAME_REF@[44; 49) | 49 | NAME_REF@[44; 49) |
50 | IDENT@[44; 49) "usize" | 50 | IDENT@[44; 49) "usize" |
51 | WHITESPACE@[49; 50) " " | 51 | WHITESPACE@[49; 50) " " |
52 | DOTDOT@[50; 52) ".." | 52 | DOT2@[50; 52) ".." |
53 | SEMI@[52; 53) ";" | 53 | SEMICOLON@[52; 53) ";" |
54 | WHITESPACE@[53; 54) "\n" | 54 | WHITESPACE@[53; 54) "\n" |
55 | R_CURLY@[54; 55) "}" | 55 | R_CURLY@[54; 55) "}" |
56 | WHITESPACE@[55; 56) "\n" | 56 | WHITESPACE@[55; 56) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0061_match_full_range.rast b/crates/ra_syntax/test_data/parser/ok/0061_match_full_range.rast index bdfac9b76..be6774199 100644 --- a/crates/ra_syntax/test_data/parser/ok/0061_match_full_range.rast +++ b/crates/ra_syntax/test_data/parser/ok/0061_match_full_range.rast | |||
@@ -16,7 +16,7 @@ SOURCE_FILE@[0; 35) | |||
16 | MATCH_KW@[16; 21) "match" | 16 | MATCH_KW@[16; 21) "match" |
17 | WHITESPACE@[21; 22) " " | 17 | WHITESPACE@[21; 22) " " |
18 | RANGE_EXPR@[22; 24) | 18 | RANGE_EXPR@[22; 24) |
19 | DOTDOT@[22; 24) ".." | 19 | DOT2@[22; 24) ".." |
20 | WHITESPACE@[24; 25) " " | 20 | WHITESPACE@[24; 25) " " |
21 | MATCH_ARM_LIST@[25; 32) | 21 | MATCH_ARM_LIST@[25; 32) |
22 | L_CURLY@[25; 26) "{" | 22 | L_CURLY@[25; 26) "{" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rast b/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rast index 2be523fc3..f89d7c0d9 100644 --- a/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rast +++ b/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rast | |||
@@ -30,7 +30,7 @@ SOURCE_FILE@[0; 349) | |||
30 | L_CURLY@[42; 43) "{" | 30 | L_CURLY@[42; 43) "{" |
31 | WHITESPACE@[43; 48) "\n " | 31 | WHITESPACE@[43; 48) "\n " |
32 | IDENT@[48; 51) "vec" | 32 | IDENT@[48; 51) "vec" |
33 | EXCL@[51; 52) "!" | 33 | BANG@[51; 52) "!" |
34 | TOKEN_TREE@[52; 91) | 34 | TOKEN_TREE@[52; 91) |
35 | L_BRACK@[52; 53) "[" | 35 | L_BRACK@[52; 53) "[" |
36 | WHITESPACE@[53; 62) "\n " | 36 | WHITESPACE@[53; 62) "\n " |
@@ -129,7 +129,7 @@ SOURCE_FILE@[0; 349) | |||
129 | L_CURLY@[204; 205) "{" | 129 | L_CURLY@[204; 205) "{" |
130 | WHITESPACE@[205; 214) "\n " | 130 | WHITESPACE@[205; 214) "\n " |
131 | IDENT@[214; 223) "assert_eq" | 131 | IDENT@[214; 223) "assert_eq" |
132 | EXCL@[223; 224) "!" | 132 | BANG@[223; 224) "!" |
133 | TOKEN_TREE@[224; 339) | 133 | TOKEN_TREE@[224; 339) |
134 | L_PAREN@[224; 225) "(" | 134 | L_PAREN@[224; 225) "(" |
135 | WHITESPACE@[225; 238) "\n " | 135 | WHITESPACE@[225; 238) "\n " |
@@ -137,7 +137,7 @@ SOURCE_FILE@[0; 349) | |||
137 | TOKEN_TREE@[253; 284) | 137 | TOKEN_TREE@[253; 284) |
138 | L_PAREN@[253; 254) "(" | 138 | L_PAREN@[253; 254) "(" |
139 | IDENT@[254; 269) "parse_use_trees" | 139 | IDENT@[254; 269) "parse_use_trees" |
140 | EXCL@[269; 270) "!" | 140 | BANG@[269; 270) "!" |
141 | TOKEN_TREE@[270; 283) | 141 | TOKEN_TREE@[270; 283) |
142 | L_PAREN@[270; 271) "(" | 142 | L_PAREN@[270; 271) "(" |
143 | DOLLAR@[271; 272) "$" | 143 | DOLLAR@[271; 272) "$" |
@@ -153,7 +153,7 @@ SOURCE_FILE@[0; 349) | |||
153 | COMMA@[284; 285) "," | 153 | COMMA@[284; 285) "," |
154 | WHITESPACE@[285; 298) "\n " | 154 | WHITESPACE@[285; 298) "\n " |
155 | IDENT@[298; 313) "parse_use_trees" | 155 | IDENT@[298; 313) "parse_use_trees" |
156 | EXCL@[313; 314) "!" | 156 | BANG@[313; 314) "!" |
157 | TOKEN_TREE@[314; 328) | 157 | TOKEN_TREE@[314; 328) |
158 | L_PAREN@[314; 315) "(" | 158 | L_PAREN@[314; 315) "(" |
159 | DOLLAR@[315; 316) "$" | 159 | DOLLAR@[315; 316) "$" |
@@ -168,7 +168,7 @@ SOURCE_FILE@[0; 349) | |||
168 | COMMA@[328; 329) "," | 168 | COMMA@[328; 329) "," |
169 | WHITESPACE@[329; 338) "\n " | 169 | WHITESPACE@[329; 338) "\n " |
170 | R_PAREN@[338; 339) ")" | 170 | R_PAREN@[338; 339) ")" |
171 | SEMI@[339; 340) ";" | 171 | SEMICOLON@[339; 340) ";" |
172 | WHITESPACE@[340; 345) "\n " | 172 | WHITESPACE@[340; 345) "\n " |
173 | R_CURLY@[345; 346) "}" | 173 | R_CURLY@[345; 346) "}" |
174 | WHITESPACE@[346; 347) "\n" | 174 | WHITESPACE@[346; 347) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast b/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast index eb2e3a503..9b5954ebd 100644 --- a/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast +++ b/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast | |||
@@ -190,7 +190,7 @@ SOURCE_FILE@[0; 170) | |||
190 | NAME_REF@[162; 165) | 190 | NAME_REF@[162; 165) |
191 | IDENT@[162; 165) "i32" | 191 | IDENT@[162; 165) "i32" |
192 | R_PAREN@[165; 166) ")" | 192 | R_PAREN@[165; 166) ")" |
193 | SEMI@[166; 167) ";" | 193 | SEMICOLON@[166; 167) ";" |
194 | WHITESPACE@[167; 168) "\n" | 194 | WHITESPACE@[167; 168) "\n" |
195 | R_CURLY@[168; 169) "}" | 195 | R_CURLY@[168; 169) "}" |
196 | WHITESPACE@[169; 170) "\n" | 196 | WHITESPACE@[169; 170) "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.rast b/crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.rast index 186f03626..17b08197b 100644 --- a/crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.rast +++ b/crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.rast | |||
@@ -32,10 +32,10 @@ SOURCE_FILE@[0; 126) | |||
32 | COMMA@[32; 33) "," | 32 | COMMA@[32; 33) "," |
33 | WHITESPACE@[33; 34) " " | 33 | WHITESPACE@[33; 34) " " |
34 | PARAM@[34; 37) | 34 | PARAM@[34; 37) |
35 | DOTDOTDOT@[34; 37) "..." | 35 | DOT3@[34; 37) "..." |
36 | COMMA@[37; 38) "," | 36 | COMMA@[37; 38) "," |
37 | R_PAREN@[38; 39) ")" | 37 | R_PAREN@[38; 39) ")" |
38 | SEMI@[39; 40) ";" | 38 | SEMICOLON@[39; 40) ";" |
39 | WHITESPACE@[40; 45) "\n " | 39 | WHITESPACE@[40; 45) "\n " |
40 | FN_DEF@[45; 70) | 40 | FN_DEF@[45; 70) |
41 | FN_KW@[45; 47) "fn" | 41 | FN_KW@[45; 47) "fn" |
@@ -65,9 +65,9 @@ SOURCE_FILE@[0; 126) | |||
65 | UNDERSCORE@[62; 63) "_" | 65 | UNDERSCORE@[62; 63) "_" |
66 | COLON@[63; 64) ":" | 66 | COLON@[63; 64) ":" |
67 | WHITESPACE@[64; 65) " " | 67 | WHITESPACE@[64; 65) " " |
68 | DOTDOTDOT@[65; 68) "..." | 68 | DOT3@[65; 68) "..." |
69 | R_PAREN@[68; 69) ")" | 69 | R_PAREN@[68; 69) ")" |
70 | SEMI@[69; 70) ";" | 70 | SEMICOLON@[69; 70) ";" |
71 | WHITESPACE@[70; 75) "\n " | 71 | WHITESPACE@[70; 75) "\n " |
72 | FN_DEF@[75; 123) | 72 | FN_DEF@[75; 123) |
73 | FN_KW@[75; 77) "fn" | 73 | FN_KW@[75; 77) "fn" |
@@ -124,10 +124,10 @@ SOURCE_FILE@[0; 126) | |||
124 | R_BRACK@[114; 115) "]" | 124 | R_BRACK@[114; 115) "]" |
125 | COLON@[115; 116) ":" | 125 | COLON@[115; 116) ":" |
126 | WHITESPACE@[116; 117) " " | 126 | WHITESPACE@[116; 117) " " |
127 | DOTDOTDOT@[117; 120) "..." | 127 | DOT3@[117; 120) "..." |
128 | COMMA@[120; 121) "," | 128 | COMMA@[120; 121) "," |
129 | R_PAREN@[121; 122) ")" | 129 | R_PAREN@[121; 122) ")" |
130 | SEMI@[122; 123) ";" | 130 | SEMICOLON@[122; 123) ";" |
131 | WHITESPACE@[123; 124) "\n" | 131 | WHITESPACE@[123; 124) "\n" |
132 | R_CURLY@[124; 125) "}" | 132 | R_CURLY@[124; 125) "}" |
133 | WHITESPACE@[125; 126) "\n" | 133 | WHITESPACE@[125; 126) "\n" |
diff --git a/crates/ra_tt/src/lib.rs b/crates/ra_tt/src/lib.rs index bd484aa30..5248e026c 100644 --- a/crates/ra_tt/src/lib.rs +++ b/crates/ra_tt/src/lib.rs | |||
@@ -57,7 +57,7 @@ pub enum Leaf { | |||
57 | } | 57 | } |
58 | impl_froms!(Leaf: Literal, Punct, Ident); | 58 | impl_froms!(Leaf: Literal, Punct, Ident); |
59 | 59 | ||
60 | #[derive(Debug, Clone, PartialEq, Eq, Hash, Default)] | 60 | #[derive(Clone, PartialEq, Eq, Hash, Default)] |
61 | pub struct Subtree { | 61 | pub struct Subtree { |
62 | pub delimiter: Option<Delimiter>, | 62 | pub delimiter: Option<Delimiter>, |
63 | pub token_trees: Vec<TokenTree>, | 63 | pub token_trees: Vec<TokenTree>, |
@@ -101,6 +101,61 @@ pub struct Ident { | |||
101 | pub id: TokenId, | 101 | pub id: TokenId, |
102 | } | 102 | } |
103 | 103 | ||
104 | fn print_debug_subtree(f: &mut fmt::Formatter<'_>, subtree: &Subtree, level: usize) -> fmt::Result { | ||
105 | let align = std::iter::repeat(" ").take(level).collect::<String>(); | ||
106 | |||
107 | let aux = match subtree.delimiter.map(|it| (it.kind, it.id.0)) { | ||
108 | None => "$".to_string(), | ||
109 | Some((DelimiterKind::Parenthesis, id)) => format!("() {}", id), | ||
110 | Some((DelimiterKind::Brace, id)) => format!("{{}} {}", id), | ||
111 | Some((DelimiterKind::Bracket, id)) => format!("[] {}", id), | ||
112 | }; | ||
113 | |||
114 | if subtree.token_trees.is_empty() { | ||
115 | write!(f, "{}SUBTREE {}", align, aux)?; | ||
116 | } else { | ||
117 | writeln!(f, "{}SUBTREE {}", align, aux)?; | ||
118 | for (idx, child) in subtree.token_trees.iter().enumerate() { | ||
119 | print_debug_token(f, child, level + 1)?; | ||
120 | if idx != subtree.token_trees.len() - 1 { | ||
121 | writeln!(f, "")?; | ||
122 | } | ||
123 | } | ||
124 | } | ||
125 | |||
126 | Ok(()) | ||
127 | } | ||
128 | |||
129 | fn print_debug_token(f: &mut fmt::Formatter<'_>, tkn: &TokenTree, level: usize) -> fmt::Result { | ||
130 | let align = std::iter::repeat(" ").take(level).collect::<String>(); | ||
131 | |||
132 | match tkn { | ||
133 | TokenTree::Leaf(leaf) => match leaf { | ||
134 | Leaf::Literal(lit) => write!(f, "{}LITERAL {} {}", align, lit.text, lit.id.0)?, | ||
135 | Leaf::Punct(punct) => write!( | ||
136 | f, | ||
137 | "{}PUNCH {} [{}] {}", | ||
138 | align, | ||
139 | punct.char, | ||
140 | if punct.spacing == Spacing::Alone { "alone" } else { "joint" }, | ||
141 | punct.id.0 | ||
142 | )?, | ||
143 | Leaf::Ident(ident) => write!(f, "{}IDENT {} {}", align, ident.text, ident.id.0)?, | ||
144 | }, | ||
145 | TokenTree::Subtree(subtree) => { | ||
146 | print_debug_subtree(f, subtree, level)?; | ||
147 | } | ||
148 | } | ||
149 | |||
150 | Ok(()) | ||
151 | } | ||
152 | |||
153 | impl Debug for Subtree { | ||
154 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
155 | print_debug_subtree(f, self, 0) | ||
156 | } | ||
157 | } | ||
158 | |||
104 | impl fmt::Display for TokenTree { | 159 | impl fmt::Display for TokenTree { |
105 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | 160 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
106 | match self { | 161 | match self { |
diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs index 75cf2dae5..e9ee0b888 100644 --- a/crates/rust-analyzer/src/cli/analysis_stats.rs +++ b/crates/rust-analyzer/src/cli/analysis_stats.rs | |||
@@ -163,10 +163,7 @@ pub fn analysis_stats( | |||
163 | if let Ok(src) = src { | 163 | if let Ok(src) = src { |
164 | let original_file = src.file_id.original_file(db); | 164 | let original_file = src.file_id.original_file(db); |
165 | let line_index = host.analysis().file_line_index(original_file).unwrap(); | 165 | let line_index = host.analysis().file_line_index(original_file).unwrap(); |
166 | let text_range = src.value.either( | 166 | let text_range = src.value.syntax_node_ptr().range(); |
167 | |it| it.syntax_node_ptr().range(), | ||
168 | |it| it.syntax_node_ptr().range(), | ||
169 | ); | ||
170 | let (start, end) = ( | 167 | let (start, end) = ( |
171 | line_index.line_col(text_range.start()), | 168 | line_index.line_col(text_range.start()), |
172 | line_index.line_col(text_range.end()), | 169 | line_index.line_col(text_range.end()), |
@@ -192,12 +189,7 @@ pub fn analysis_stats( | |||
192 | // FIXME: it might be nice to have a function (on Analysis?) that goes from Source<T> -> (LineCol, LineCol) directly | 189 | // FIXME: it might be nice to have a function (on Analysis?) that goes from Source<T> -> (LineCol, LineCol) directly |
193 | // But also, we should just turn the type mismatches into diagnostics and provide these | 190 | // But also, we should just turn the type mismatches into diagnostics and provide these |
194 | let root = db.parse_or_expand(src.file_id).unwrap(); | 191 | let root = db.parse_or_expand(src.file_id).unwrap(); |
195 | let node = src.map(|e| { | 192 | let node = src.map(|e| e.to_node(&root).syntax().clone()); |
196 | e.either( | ||
197 | |p| p.to_node(&root).syntax().clone(), | ||
198 | |p| p.to_node(&root).syntax().clone(), | ||
199 | ) | ||
200 | }); | ||
201 | let original_range = original_range(db, node.as_ref()); | 193 | let original_range = original_range(db, node.as_ref()); |
202 | let path = db.file_relative_path(original_range.file_id); | 194 | let path = db.file_relative_path(original_range.file_id); |
203 | let line_index = | 195 | let line_index = |
diff --git a/crates/rust-analyzer/src/cli/load_cargo.rs b/crates/rust-analyzer/src/cli/load_cargo.rs index 69133e4e4..43062ea10 100644 --- a/crates/rust-analyzer/src/cli/load_cargo.rs +++ b/crates/rust-analyzer/src/cli/load_cargo.rs | |||
@@ -152,7 +152,9 @@ pub(crate) fn load( | |||
152 | &extern_source_roots, | 152 | &extern_source_roots, |
153 | proc_macro_client, | 153 | proc_macro_client, |
154 | &mut |path: &Path| { | 154 | &mut |path: &Path| { |
155 | let vfs_file = vfs.load(path); | 155 | // Some path from metadata will be non canonicalized, e.g. /foo/../bar/lib.rs |
156 | let path = path.canonicalize().ok()?; | ||
157 | let vfs_file = vfs.load(&path); | ||
156 | log::debug!("vfs file {:?} -> {:?}", path, vfs_file); | 158 | log::debug!("vfs file {:?} -> {:?}", path, vfs_file); |
157 | vfs_file.map(vfs_file_to_id) | 159 | vfs_file.map(vfs_file_to_id) |
158 | }, | 160 | }, |
diff --git a/crates/rust-analyzer/src/world.rs b/crates/rust-analyzer/src/world.rs index 365f57d8c..6c42e1d76 100644 --- a/crates/rust-analyzer/src/world.rs +++ b/crates/rust-analyzer/src/world.rs | |||
@@ -139,7 +139,9 @@ impl WorldState { | |||
139 | // Create crate graph from all the workspaces | 139 | // Create crate graph from all the workspaces |
140 | let mut crate_graph = CrateGraph::default(); | 140 | let mut crate_graph = CrateGraph::default(); |
141 | let mut load = |path: &std::path::Path| { | 141 | let mut load = |path: &std::path::Path| { |
142 | let vfs_file = vfs.load(path); | 142 | // Some path from metadata will be non canonicalized, e.g. /foo/../bar/lib.rs |
143 | let path = path.canonicalize().ok()?; | ||
144 | let vfs_file = vfs.load(&path); | ||
143 | vfs_file.map(|f| FileId(f.0)) | 145 | vfs_file.map(|f| FileId(f.0)) |
144 | }; | 146 | }; |
145 | 147 | ||
diff --git a/crates/stdx/src/lib.rs b/crates/stdx/src/lib.rs index 401a568bd..01cdf452c 100644 --- a/crates/stdx/src/lib.rs +++ b/crates/stdx/src/lib.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! Missing batteries for standard libraries. | 1 | //! Missing batteries for standard libraries. |
2 | 2 | ||
3 | use std::{cell::Cell, fmt}; | 3 | use std::{cell::Cell, fmt, time::Instant}; |
4 | 4 | ||
5 | #[inline(always)] | 5 | #[inline(always)] |
6 | pub fn is_ci() -> bool { | 6 | pub fn is_ci() -> bool { |
@@ -88,3 +88,17 @@ where | |||
88 | Ok(()) | 88 | Ok(()) |
89 | } | 89 | } |
90 | } | 90 | } |
91 | pub fn timeit(label: &'static str) -> impl Drop { | ||
92 | struct Guard { | ||
93 | label: &'static str, | ||
94 | start: Instant, | ||
95 | } | ||
96 | |||
97 | impl Drop for Guard { | ||
98 | fn drop(&mut self) { | ||
99 | eprintln!("{}: {:?}", self.label, self.start.elapsed()) | ||
100 | } | ||
101 | } | ||
102 | |||
103 | Guard { label, start: Instant::now() } | ||
104 | } | ||
diff --git a/docs/user/assists.md b/docs/user/assists.md index 754131f6f..1d9510423 100644 --- a/docs/user/assists.md +++ b/docs/user/assists.md | |||
@@ -175,7 +175,7 @@ trait Trait<T> { | |||
175 | } | 175 | } |
176 | 176 | ||
177 | impl Trait<u32> for () { | 177 | impl Trait<u32> for () { |
178 | fn foo(&self) -> u32 { unimplemented!() } | 178 | fn foo(&self) -> u32 { todo!() } |
179 | 179 | ||
180 | } | 180 | } |
181 | ``` | 181 | ``` |
@@ -582,6 +582,21 @@ impl Walrus { | |||
582 | } | 582 | } |
583 | ``` | 583 | ``` |
584 | 584 | ||
585 | ## `reorder_fields` | ||
586 | |||
587 | Reorder the fields of record literals and record patterns in the same order as in | ||
588 | the definition. | ||
589 | |||
590 | ```rust | ||
591 | // BEFORE | ||
592 | struct Foo {foo: i32, bar: i32}; | ||
593 | const test: Foo = ┃Foo {bar: 0, foo: 1} | ||
594 | |||
595 | // AFTER | ||
596 | struct Foo {foo: i32, bar: i32}; | ||
597 | const test: Foo = Foo {foo: 1, bar: 0} | ||
598 | ``` | ||
599 | |||
585 | ## `replace_if_let_with_match` | 600 | ## `replace_if_let_with_match` |
586 | 601 | ||
587 | Replaces `if let` with an else branch with a `match` expression. | 602 | Replaces `if let` with an else branch with a `match` expression. |
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index 21c1c9f23..35a05131c 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts | |||
@@ -66,23 +66,44 @@ export class Config { | |||
66 | return vscode.workspace.getConfiguration(this.rootSection); | 66 | return vscode.workspace.getConfiguration(this.rootSection); |
67 | } | 67 | } |
68 | 68 | ||
69 | get serverPath() { return this.cfg.get<null | string>("serverPath")!; } | 69 | /** |
70 | get channel() { return this.cfg.get<UpdatesChannel>("updates.channel")!; } | 70 | * Beware that postfix `!` operator erases both `null` and `undefined`. |
71 | get askBeforeDownload() { return this.cfg.get<boolean>("updates.askBeforeDownload")!; } | 71 | * This is why the following doesn't work as expected: |
72 | get traceExtension() { return this.cfg.get<boolean>("trace.extension")!; } | 72 | * |
73 | * ```ts | ||
74 | * const nullableNum = vscode | ||
75 | * .workspace | ||
76 | * .getConfiguration | ||
77 | * .getConfiguration("rust-analyer") | ||
78 | * .get<number | null>(path)!; | ||
79 | * | ||
80 | * // What happens is that type of `nullableNum` is `number` but not `null | number`: | ||
81 | * const fullFledgedNum: number = nullableNum; | ||
82 | * ``` | ||
83 | * So this getter handles this quirk by not requiring the caller to use postfix `!` | ||
84 | */ | ||
85 | private get<T>(path: string): T { | ||
86 | return this.cfg.get<T>(path)!; | ||
87 | } | ||
88 | |||
89 | get serverPath() { return this.get<null | string>("serverPath"); } | ||
90 | get channel() { return this.get<UpdatesChannel>("updates.channel"); } | ||
91 | get askBeforeDownload() { return this.get<boolean>("updates.askBeforeDownload"); } | ||
92 | get traceExtension() { return this.get<boolean>("trace.extension"); } | ||
93 | |||
73 | 94 | ||
74 | get inlayHints() { | 95 | get inlayHints() { |
75 | return { | 96 | return { |
76 | typeHints: this.cfg.get<boolean>("inlayHints.typeHints")!, | 97 | typeHints: this.get<boolean>("inlayHints.typeHints"), |
77 | parameterHints: this.cfg.get<boolean>("inlayHints.parameterHints")!, | 98 | parameterHints: this.get<boolean>("inlayHints.parameterHints"), |
78 | chainingHints: this.cfg.get<boolean>("inlayHints.chainingHints")!, | 99 | chainingHints: this.get<boolean>("inlayHints.chainingHints"), |
79 | maxLength: this.cfg.get<null | number>("inlayHints.maxLength")!, | 100 | maxLength: this.get<null | number>("inlayHints.maxLength"), |
80 | }; | 101 | }; |
81 | } | 102 | } |
82 | 103 | ||
83 | get checkOnSave() { | 104 | get checkOnSave() { |
84 | return { | 105 | return { |
85 | command: this.cfg.get<string>("checkOnSave.command")!, | 106 | command: this.get<string>("checkOnSave.command"), |
86 | }; | 107 | }; |
87 | } | 108 | } |
88 | } | 109 | } |
diff --git a/editors/code/src/inlay_hints.ts b/editors/code/src/inlay_hints.ts index 6a8bd942e..da74f03d2 100644 --- a/editors/code/src/inlay_hints.ts +++ b/editors/code/src/inlay_hints.ts | |||
@@ -229,13 +229,13 @@ interface InlaysDecorations { | |||
229 | } | 229 | } |
230 | 230 | ||
231 | interface RustSourceFile { | 231 | interface RustSourceFile { |
232 | /* | 232 | /** |
233 | * Source of the token to cancel in-flight inlay hints request if any. | 233 | * Source of the token to cancel in-flight inlay hints request if any. |
234 | */ | 234 | */ |
235 | inlaysRequest: null | vscode.CancellationTokenSource; | 235 | inlaysRequest: null | vscode.CancellationTokenSource; |
236 | /** | 236 | /** |
237 | * Last applied decorations. | 237 | * Last applied decorations. |
238 | */ | 238 | */ |
239 | cachedDecorations: null | InlaysDecorations; | 239 | cachedDecorations: null | InlaysDecorations; |
240 | 240 | ||
241 | document: RustDocument; | 241 | document: RustDocument; |
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index eba66ff4d..69cba9168 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs | |||
@@ -11,7 +11,7 @@ pub(crate) struct KindsSrc<'a> { | |||
11 | 11 | ||
12 | pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | 12 | pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { |
13 | punct: &[ | 13 | punct: &[ |
14 | (";", "SEMI"), | 14 | (";", "SEMICOLON"), |
15 | (",", "COMMA"), | 15 | (",", "COMMA"), |
16 | ("(", "L_PAREN"), | 16 | ("(", "L_PAREN"), |
17 | (")", "R_PAREN"), | 17 | (")", "R_PAREN"), |
@@ -35,15 +35,15 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
35 | ("%", "PERCENT"), | 35 | ("%", "PERCENT"), |
36 | ("_", "UNDERSCORE"), | 36 | ("_", "UNDERSCORE"), |
37 | (".", "DOT"), | 37 | (".", "DOT"), |
38 | ("..", "DOTDOT"), | 38 | ("..", "DOT2"), |
39 | ("...", "DOTDOTDOT"), | 39 | ("...", "DOT3"), |
40 | ("..=", "DOTDOTEQ"), | 40 | ("..=", "DOT2EQ"), |
41 | (":", "COLON"), | 41 | (":", "COLON"), |
42 | ("::", "COLONCOLON"), | 42 | ("::", "COLON2"), |
43 | ("=", "EQ"), | 43 | ("=", "EQ"), |
44 | ("==", "EQEQ"), | 44 | ("==", "EQ2"), |
45 | ("=>", "FAT_ARROW"), | 45 | ("=>", "FAT_ARROW"), |
46 | ("!", "EXCL"), | 46 | ("!", "BANG"), |
47 | ("!=", "NEQ"), | 47 | ("!=", "NEQ"), |
48 | ("-", "MINUS"), | 48 | ("-", "MINUS"), |
49 | ("->", "THIN_ARROW"), | 49 | ("->", "THIN_ARROW"), |
@@ -57,8 +57,8 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
57 | ("/=", "SLASHEQ"), | 57 | ("/=", "SLASHEQ"), |
58 | ("*=", "STAREQ"), | 58 | ("*=", "STAREQ"), |
59 | ("%=", "PERCENTEQ"), | 59 | ("%=", "PERCENTEQ"), |
60 | ("&&", "AMPAMP"), | 60 | ("&&", "AMP2"), |
61 | ("||", "PIPEPIPE"), | 61 | ("||", "PIPE2"), |
62 | ("<<", "SHL"), | 62 | ("<<", "SHL"), |
63 | (">>", "SHR"), | 63 | (">>", "SHR"), |
64 | ("<<=", "SHLEQ"), | 64 | ("<<=", "SHLEQ"), |
@@ -225,21 +225,26 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
225 | }; | 225 | }; |
226 | 226 | ||
227 | pub(crate) struct AstSrc<'a> { | 227 | pub(crate) struct AstSrc<'a> { |
228 | pub(crate) tokens: &'a [&'a str], | ||
228 | pub(crate) nodes: &'a [AstNodeSrc<'a>], | 229 | pub(crate) nodes: &'a [AstNodeSrc<'a>], |
229 | pub(crate) enums: &'a [AstEnumSrc<'a>], | 230 | pub(crate) enums: &'a [AstEnumSrc<'a>], |
230 | pub(crate) token_enums: &'a [AstEnumSrc<'a>], | ||
231 | } | 231 | } |
232 | 232 | ||
233 | pub(crate) struct AstNodeSrc<'a> { | 233 | pub(crate) struct AstNodeSrc<'a> { |
234 | pub(crate) name: &'a str, | 234 | pub(crate) name: &'a str, |
235 | pub(crate) traits: &'a [&'a str], | 235 | pub(crate) traits: &'a [&'a str], |
236 | pub(crate) fields: &'a [(&'a str, FieldSrc<&'a str>)], | 236 | pub(crate) fields: &'a [Field<'a>], |
237 | } | ||
238 | |||
239 | pub(crate) enum Field<'a> { | ||
240 | Token(&'a str), | ||
241 | Node { name: &'a str, src: FieldSrc<'a> }, | ||
237 | } | 242 | } |
238 | 243 | ||
239 | pub(crate) enum FieldSrc<T> { | 244 | pub(crate) enum FieldSrc<'a> { |
240 | Shorthand, | 245 | Shorthand, |
241 | Optional(T), | 246 | Optional(&'a str), |
242 | Many(T), | 247 | Many(&'a str), |
243 | } | 248 | } |
244 | 249 | ||
245 | pub(crate) struct AstEnumSrc<'a> { | 250 | pub(crate) struct AstEnumSrc<'a> { |
@@ -251,31 +256,34 @@ pub(crate) struct AstEnumSrc<'a> { | |||
251 | macro_rules! ast_nodes { | 256 | macro_rules! ast_nodes { |
252 | ($( | 257 | ($( |
253 | struct $name:ident$(: $($trait:ident),*)? { | 258 | struct $name:ident$(: $($trait:ident),*)? { |
254 | $($field_name:ident $(: $ty:tt)?),*$(,)? | 259 | $($field_name:ident $(![$token:tt])? $(: $ty:tt)?),*$(,)? |
255 | } | 260 | } |
256 | )*) => { | 261 | )*) => { |
257 | [$( | 262 | [$( |
258 | AstNodeSrc { | 263 | AstNodeSrc { |
259 | name: stringify!($name), | 264 | name: stringify!($name), |
260 | traits: &[$($(stringify!($trait)),*)?], | 265 | traits: &[$($(stringify!($trait)),*)?], |
261 | fields: &[$( | 266 | fields: &[ |
262 | (stringify!($field_name), field_ty!($field_name $($ty)?)) | 267 | $(field!($(T![$token])? $field_name $($ty)?)),* |
263 | ),*], | 268 | ], |
264 | 269 | ||
265 | } | 270 | } |
266 | ),*] | 271 | ),*] |
267 | }; | 272 | }; |
268 | } | 273 | } |
269 | 274 | ||
270 | macro_rules! field_ty { | 275 | macro_rules! field { |
276 | (T![$token:tt] T) => { | ||
277 | Field::Token(stringify!($token)) | ||
278 | }; | ||
271 | ($field_name:ident) => { | 279 | ($field_name:ident) => { |
272 | FieldSrc::Shorthand | 280 | Field::Node { name: stringify!($field_name), src: FieldSrc::Shorthand } |
273 | }; | 281 | }; |
274 | ($field_name:ident [$ty:ident]) => { | 282 | ($field_name:ident [$ty:ident]) => { |
275 | FieldSrc::Many(stringify!($ty)) | 283 | Field::Node { name: stringify!($field_name), src: FieldSrc::Many(stringify!($ty)) } |
276 | }; | 284 | }; |
277 | ($field_name:ident $ty:ident) => { | 285 | ($field_name:ident $ty:ident) => { |
278 | FieldSrc::Optional(stringify!($ty)) | 286 | Field::Node { name: stringify!($field_name), src: FieldSrc::Optional(stringify!($ty)) } |
279 | }; | 287 | }; |
280 | } | 288 | } |
281 | 289 | ||
@@ -290,330 +298,331 @@ macro_rules! ast_enums { | |||
290 | name: stringify!($name), | 298 | name: stringify!($name), |
291 | traits: &[$($(stringify!($trait)),*)?], | 299 | traits: &[$($(stringify!($trait)),*)?], |
292 | variants: &[$(stringify!($variant)),*], | 300 | variants: &[$(stringify!($variant)),*], |
293 | |||
294 | } | 301 | } |
295 | ),*] | 302 | ),*] |
296 | }; | 303 | }; |
297 | } | 304 | } |
298 | 305 | ||
299 | pub(crate) const AST_SRC: AstSrc = AstSrc { | 306 | pub(crate) const AST_SRC: AstSrc = AstSrc { |
307 | tokens: &["Whitespace", "Comment", "String", "RawString"], | ||
300 | nodes: &ast_nodes! { | 308 | nodes: &ast_nodes! { |
301 | struct SourceFile: ModuleItemOwner, FnDefOwner, AttrsOwner { | 309 | struct SourceFile: ModuleItemOwner, AttrsOwner { |
302 | modules: [Module], | 310 | modules: [Module], |
303 | } | 311 | } |
304 | 312 | ||
305 | struct FnDef: VisibilityOwner, NameOwner, TypeParamsOwner, DocCommentsOwner, AttrsOwner { | 313 | struct FnDef: VisibilityOwner, NameOwner, TypeParamsOwner, DocCommentsOwner, AttrsOwner { |
306 | Abi, | 314 | Abi, |
307 | ConstKw, | 315 | T![const], |
308 | DefaultKw, | 316 | T![default], |
309 | AsyncKw, | 317 | T![async], |
310 | UnsafeKw, | 318 | T![unsafe], |
311 | FnKw, | 319 | T![fn], |
312 | ParamList, | 320 | ParamList, |
313 | RetType, | 321 | RetType, |
314 | body: BlockExpr, | 322 | body: BlockExpr, |
315 | Semi | 323 | T![;] |
316 | } | 324 | } |
317 | 325 | ||
318 | struct RetType { ThinArrow, TypeRef } | 326 | struct RetType { T![->], TypeRef } |
319 | 327 | ||
320 | struct StructDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner { | 328 | struct StructDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner { |
321 | StructKw, | 329 | T![struct], |
322 | FieldDefList, | 330 | FieldDefList, |
323 | Semi | 331 | T![;] |
324 | } | 332 | } |
325 | 333 | ||
326 | struct UnionDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner { | 334 | struct UnionDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner { |
327 | UnionKw, | 335 | T![union], |
328 | RecordFieldDefList, | 336 | RecordFieldDefList, |
329 | } | 337 | } |
330 | 338 | ||
331 | struct RecordFieldDefList { LCurly, fields: [RecordFieldDef], RCurly } | 339 | struct RecordFieldDefList { T!['{'], fields: [RecordFieldDef], T!['}'] } |
332 | struct RecordFieldDef: VisibilityOwner, NameOwner, AttrsOwner, DocCommentsOwner, TypeAscriptionOwner { } | 340 | struct RecordFieldDef: VisibilityOwner, NameOwner, AttrsOwner, DocCommentsOwner, TypeAscriptionOwner { } |
333 | 341 | ||
334 | struct TupleFieldDefList { LParen, fields: [TupleFieldDef], RParen } | 342 | struct TupleFieldDefList { T!['('], fields: [TupleFieldDef], T![')'] } |
335 | struct TupleFieldDef: VisibilityOwner, AttrsOwner { | 343 | struct TupleFieldDef: VisibilityOwner, AttrsOwner { |
336 | TypeRef, | 344 | TypeRef, |
337 | } | 345 | } |
338 | 346 | ||
339 | struct EnumDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner { | 347 | struct EnumDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner { |
340 | EnumKw, | 348 | T![enum], |
341 | variant_list: EnumVariantList, | 349 | variant_list: EnumVariantList, |
342 | } | 350 | } |
343 | struct EnumVariantList { | 351 | struct EnumVariantList { |
344 | LCurly, | 352 | T!['{'], |
345 | variants: [EnumVariant], | 353 | variants: [EnumVariant], |
346 | RCurly | 354 | T!['}'] |
347 | } | 355 | } |
348 | struct EnumVariant: VisibilityOwner, NameOwner, DocCommentsOwner, AttrsOwner { | 356 | struct EnumVariant: VisibilityOwner, NameOwner, DocCommentsOwner, AttrsOwner { |
349 | FieldDefList, | 357 | FieldDefList, |
350 | Eq, | 358 | T![=], |
351 | Expr | 359 | Expr |
352 | } | 360 | } |
353 | 361 | ||
354 | struct TraitDef: VisibilityOwner, NameOwner, AttrsOwner, DocCommentsOwner, TypeParamsOwner, TypeBoundsOwner { | 362 | struct TraitDef: VisibilityOwner, NameOwner, AttrsOwner, DocCommentsOwner, TypeParamsOwner, TypeBoundsOwner { |
355 | UnsafeKw, | 363 | T![unsafe], |
356 | AutoKw, | 364 | T![auto], |
357 | TraitKw, | 365 | T![trait], |
358 | ItemList, | 366 | ItemList, |
359 | } | 367 | } |
360 | 368 | ||
361 | struct Module: VisibilityOwner, NameOwner, AttrsOwner, DocCommentsOwner { | 369 | struct Module: VisibilityOwner, NameOwner, AttrsOwner, DocCommentsOwner { |
362 | ModKw, | 370 | T![mod], |
363 | ItemList, | 371 | ItemList, |
364 | Semi | 372 | T![;] |
365 | } | 373 | } |
366 | 374 | ||
367 | struct ItemList: FnDefOwner, ModuleItemOwner { | 375 | struct ItemList: ModuleItemOwner { |
368 | LCurly, | 376 | T!['{'], |
369 | impl_items: [ImplItem], | 377 | impl_items: [ImplItem], |
370 | RCurly | 378 | T!['}'] |
371 | } | 379 | } |
372 | 380 | ||
373 | struct ConstDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner, TypeAscriptionOwner { | 381 | struct ConstDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner, TypeAscriptionOwner { |
374 | DefaultKw, | 382 | T![default], |
375 | ConstKw, | 383 | T![const], |
376 | Eq, | 384 | T![=], |
377 | body: Expr, | 385 | body: Expr, |
378 | Semi | 386 | T![;] |
379 | } | 387 | } |
380 | 388 | ||
381 | struct StaticDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner, TypeAscriptionOwner { | 389 | struct StaticDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner, TypeAscriptionOwner { |
382 | StaticKw, | 390 | T![static], |
383 | MutKw, | 391 | T![mut], |
384 | Eq, | 392 | T![=], |
385 | body: Expr, | 393 | body: Expr, |
386 | Semi | 394 | T![;] |
387 | } | 395 | } |
388 | 396 | ||
389 | struct TypeAliasDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner, TypeBoundsOwner { | 397 | struct TypeAliasDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner, TypeBoundsOwner { |
390 | DefaultKw, | 398 | T![default], |
391 | TypeKw, | 399 | T![type], |
392 | Eq, | 400 | T![=], |
393 | TypeRef, | 401 | TypeRef, |
394 | Semi | 402 | T![;] |
395 | } | 403 | } |
396 | 404 | ||
397 | struct ImplDef: TypeParamsOwner, AttrsOwner { | 405 | struct ImplDef: TypeParamsOwner, AttrsOwner { |
398 | DefaultKw, | 406 | T![default], |
399 | ConstKw, | 407 | T![const], |
400 | UnsafeKw, | 408 | T![unsafe], |
401 | ImplKw, | 409 | T![impl], |
402 | Excl, | 410 | T![!], |
403 | ForKw, | 411 | T![for], |
404 | ItemList, | 412 | ItemList, |
405 | } | 413 | } |
406 | 414 | ||
407 | struct ParenType { LParen, TypeRef, RParen } | 415 | struct ParenType { T!['('], TypeRef, T![')'] } |
408 | struct TupleType { LParen, fields: [TypeRef], RParen } | 416 | struct TupleType { T!['('], fields: [TypeRef], T![')'] } |
409 | struct NeverType { Excl } | 417 | struct NeverType { T![!] } |
410 | struct PathType { Path } | 418 | struct PathType { Path } |
411 | struct PointerType { Star, ConstKw, TypeRef } | 419 | struct PointerType { T![*], T![const], T![mut], TypeRef } |
412 | struct ArrayType { LBrack, TypeRef, Semi, Expr, RBrack } | 420 | struct ArrayType { T!['['], TypeRef, T![;], Expr, T![']'] } |
413 | struct SliceType { LBrack, TypeRef, RBrack } | 421 | struct SliceType { T!['['], TypeRef, T![']'] } |
414 | struct ReferenceType { Amp, Lifetime, MutKw, TypeRef } | 422 | struct ReferenceType { T![&], T![lifetime], T![mut], TypeRef } |
415 | struct PlaceholderType { Underscore } | 423 | struct PlaceholderType { T![_] } |
416 | struct FnPointerType { Abi, UnsafeKw, FnKw, ParamList, RetType } | 424 | struct FnPointerType { Abi, T![unsafe], T![fn], ParamList, RetType } |
417 | struct ForType { ForKw, TypeParamList, TypeRef } | 425 | struct ForType { T![for], TypeParamList, TypeRef } |
418 | struct ImplTraitType: TypeBoundsOwner { ImplKw } | 426 | struct ImplTraitType: TypeBoundsOwner { T![impl] } |
419 | struct DynTraitType: TypeBoundsOwner { DynKw } | 427 | struct DynTraitType: TypeBoundsOwner { T![dyn] } |
420 | 428 | ||
421 | struct TupleExpr: AttrsOwner { LParen, exprs: [Expr], RParen } | 429 | struct TupleExpr: AttrsOwner { T!['('], exprs: [Expr], T![')'] } |
422 | struct ArrayExpr: AttrsOwner { LBrack, exprs: [Expr], Semi, RBrack } | 430 | struct ArrayExpr: AttrsOwner { T!['['], exprs: [Expr], T![;], T![']'] } |
423 | struct ParenExpr: AttrsOwner { LParen, Expr, RParen } | 431 | struct ParenExpr: AttrsOwner { T!['('], Expr, T![')'] } |
424 | struct PathExpr { Path } | 432 | struct PathExpr { Path } |
425 | struct LambdaExpr: AttrsOwner { | 433 | struct LambdaExpr: AttrsOwner { |
426 | StaticKw, | 434 | T![static], |
427 | AsyncKw, | 435 | T![async], |
428 | MoveKw, | 436 | T![move], |
429 | ParamList, | 437 | ParamList, |
430 | RetType, | 438 | RetType, |
431 | body: Expr, | 439 | body: Expr, |
432 | } | 440 | } |
433 | struct IfExpr: AttrsOwner { IfKw, Condition } | 441 | struct IfExpr: AttrsOwner { T![if], Condition } |
434 | struct LoopExpr: AttrsOwner, LoopBodyOwner { LoopKw } | 442 | struct LoopExpr: AttrsOwner, LoopBodyOwner { T![loop] } |
435 | struct TryBlockExpr: AttrsOwner { TryKw, body: BlockExpr } | 443 | struct TryBlockExpr: AttrsOwner { T![try], body: BlockExpr } |
436 | struct ForExpr: AttrsOwner, LoopBodyOwner { | 444 | struct ForExpr: AttrsOwner, LoopBodyOwner { |
437 | ForKw, | 445 | T![for], |
438 | Pat, | 446 | Pat, |
439 | InKw, | 447 | T![in], |
440 | iterable: Expr, | 448 | iterable: Expr, |
441 | } | 449 | } |
442 | struct WhileExpr: AttrsOwner, LoopBodyOwner { WhileKw, Condition } | 450 | struct WhileExpr: AttrsOwner, LoopBodyOwner { T![while], Condition } |
443 | struct ContinueExpr: AttrsOwner { ContinueKw, Lifetime } | 451 | struct ContinueExpr: AttrsOwner { T![continue], T![lifetime] } |
444 | struct BreakExpr: AttrsOwner { BreakKw, Lifetime, Expr } | 452 | struct BreakExpr: AttrsOwner { T![break], T![lifetime], Expr } |
445 | struct Label { Lifetime } | 453 | struct Label { T![lifetime] } |
446 | struct BlockExpr: AttrsOwner { Label, UnsafeKw, Block } | 454 | struct BlockExpr: AttrsOwner { Label, T![unsafe], Block } |
447 | struct ReturnExpr: AttrsOwner { Expr } | 455 | struct ReturnExpr: AttrsOwner { Expr } |
448 | struct CallExpr: ArgListOwner { Expr } | 456 | struct CallExpr: ArgListOwner { Expr } |
449 | struct MethodCallExpr: AttrsOwner, ArgListOwner { | 457 | struct MethodCallExpr: AttrsOwner, ArgListOwner { |
450 | Expr, Dot, NameRef, TypeArgList, | 458 | Expr, T![.], NameRef, TypeArgList, |
451 | } | 459 | } |
452 | struct IndexExpr: AttrsOwner { LBrack, RBrack } | 460 | struct IndexExpr: AttrsOwner { T!['['], T![']'] } |
453 | struct FieldExpr: AttrsOwner { Expr, Dot, NameRef } | 461 | struct FieldExpr: AttrsOwner { Expr, T![.], NameRef } |
454 | struct AwaitExpr: AttrsOwner { Expr, Dot, AwaitKw } | 462 | struct AwaitExpr: AttrsOwner { Expr, T![.], T![await] } |
455 | struct TryExpr: AttrsOwner { TryKw, Expr } | 463 | struct TryExpr: AttrsOwner { T![try], Expr } |
456 | struct CastExpr: AttrsOwner { Expr, AsKw, TypeRef } | 464 | struct CastExpr: AttrsOwner { Expr, T![as], TypeRef } |
457 | struct RefExpr: AttrsOwner { Amp, RawKw, MutKw, Expr } | 465 | struct RefExpr: AttrsOwner { T![&], T![raw], T![mut], Expr } |
458 | struct PrefixExpr: AttrsOwner { PrefixOp, Expr } | 466 | struct PrefixExpr: AttrsOwner { /*PrefixOp,*/ Expr } |
459 | struct BoxExpr: AttrsOwner { BoxKw, Expr } | 467 | struct BoxExpr: AttrsOwner { T![box], Expr } |
460 | struct RangeExpr: AttrsOwner { RangeOp } | 468 | struct RangeExpr: AttrsOwner { /*RangeOp*/ } |
461 | struct BinExpr: AttrsOwner { BinOp } | 469 | struct BinExpr: AttrsOwner { /*BinOp*/ } |
462 | struct Literal { LiteralToken } | 470 | struct Literal { /*LiteralToken*/ } |
463 | 471 | ||
464 | struct MatchExpr: AttrsOwner { MatchKw, Expr, MatchArmList } | 472 | struct MatchExpr: AttrsOwner { T![match], Expr, MatchArmList } |
465 | struct MatchArmList: AttrsOwner { LCurly, arms: [MatchArm], RCurly } | 473 | struct MatchArmList: AttrsOwner { T!['{'], arms: [MatchArm], T!['}'] } |
466 | struct MatchArm: AttrsOwner { | 474 | struct MatchArm: AttrsOwner { |
467 | pat: Pat, | 475 | pat: Pat, |
468 | guard: MatchGuard, | 476 | guard: MatchGuard, |
469 | FatArrow, | 477 | T![=>], |
470 | Expr, | 478 | Expr, |
471 | } | 479 | } |
472 | struct MatchGuard { IfKw, Expr } | 480 | struct MatchGuard { T![if], Expr } |
473 | 481 | ||
474 | struct RecordLit { Path, RecordFieldList} | 482 | struct RecordLit { Path, RecordFieldList} |
475 | struct RecordFieldList { | 483 | struct RecordFieldList { |
476 | LCurly, | 484 | T!['{'], |
477 | fields: [RecordField], | 485 | fields: [RecordField], |
478 | Dotdot, | 486 | T![..], |
479 | spread: Expr, | 487 | spread: Expr, |
480 | RCurly | 488 | T!['}'] |
481 | } | 489 | } |
482 | struct RecordField: AttrsOwner { NameRef, Colon, Expr } | 490 | struct RecordField: AttrsOwner { NameRef, T![:], Expr } |
483 | 491 | ||
484 | struct OrPat { pats: [Pat] } | 492 | struct OrPat { pats: [Pat] } |
485 | struct ParenPat { LParen, Pat, RParen } | 493 | struct ParenPat { T!['('], Pat, T![')'] } |
486 | struct RefPat { Amp, MutKw, Pat } | 494 | struct RefPat { T![&], T![mut], Pat } |
487 | struct BoxPat { BoxKw, Pat } | 495 | struct BoxPat { T![box], Pat } |
488 | struct BindPat: AttrsOwner, NameOwner { RefKw, MutKw, Pat } | 496 | struct BindPat: AttrsOwner, NameOwner { T![ref], T![mut], T![@], Pat } |
489 | struct PlaceholderPat { Underscore } | 497 | struct PlaceholderPat { T![_] } |
490 | struct DotDotPat { Dotdot } | 498 | struct DotDotPat { T![..] } |
491 | struct PathPat { Path } | 499 | struct PathPat { Path } |
492 | struct SlicePat { LBrack, args: [Pat], RBrack } | 500 | struct SlicePat { T!['['], args: [Pat], T![']'] } |
493 | struct RangePat { RangeSeparator } | 501 | struct RangePat { /*RangeSeparator*/ } |
494 | struct LiteralPat { Literal } | 502 | struct LiteralPat { Literal } |
495 | struct MacroPat { MacroCall } | 503 | struct MacroPat { MacroCall } |
496 | 504 | ||
497 | struct RecordPat { RecordFieldPatList, Path } | 505 | struct RecordPat { RecordFieldPatList, Path } |
498 | struct RecordFieldPatList { | 506 | struct RecordFieldPatList { |
499 | LCurly, | 507 | T!['{'], |
500 | pats: [RecordInnerPat], | 508 | pats: [RecordInnerPat], |
501 | record_field_pats: [RecordFieldPat], | 509 | record_field_pats: [RecordFieldPat], |
502 | bind_pats: [BindPat], | 510 | bind_pats: [BindPat], |
503 | Dotdot, | 511 | T![..], |
504 | RCurly | 512 | T!['}'] |
505 | } | 513 | } |
506 | struct RecordFieldPat: AttrsOwner, NameOwner { Colon, Pat } | 514 | struct RecordFieldPat: AttrsOwner, NameOwner { T![:], Pat } |
507 | 515 | ||
508 | struct TupleStructPat { Path, LParen, args: [Pat], RParen } | 516 | struct TupleStructPat { Path, T!['('], args: [Pat], T![')'] } |
509 | struct TuplePat { LParen, args: [Pat], RParen } | 517 | struct TuplePat { T!['('], args: [Pat], T![')'] } |
510 | 518 | ||
511 | struct Visibility { PubKw, SuperKw, SelfKw, CrateKw } | 519 | struct Visibility { T![pub], T![super], T![self], T![crate] } |
512 | struct Name { Ident } | 520 | struct Name { T![ident] } |
513 | struct NameRef { NameRefToken } | 521 | struct NameRef { /*NameRefToken*/ } |
514 | 522 | ||
515 | struct MacroCall: NameOwner, AttrsOwner,DocCommentsOwner { | 523 | struct MacroCall: NameOwner, AttrsOwner,DocCommentsOwner { |
516 | Path, Excl, TokenTree, Semi | 524 | Path, T![!], TokenTree, T![;] |
517 | } | 525 | } |
518 | struct Attr { Pound, Excl, LBrack, Path, Eq, input: AttrInput, RBrack } | 526 | struct Attr { T![#], T![!], T!['['], Path, T![=], input: AttrInput, T![']'] } |
519 | struct TokenTree {} | 527 | struct TokenTree {} |
520 | struct TypeParamList { | 528 | struct TypeParamList { |
521 | LAngle, | 529 | T![<], |
522 | generic_params: [GenericParam], | 530 | generic_params: [GenericParam], |
523 | type_params: [TypeParam], | 531 | type_params: [TypeParam], |
524 | lifetime_params: [LifetimeParam], | 532 | lifetime_params: [LifetimeParam], |
525 | const_params: [ConstParam], | 533 | const_params: [ConstParam], |
526 | RAngle | 534 | T![>] |
527 | } | 535 | } |
528 | struct TypeParam: NameOwner, AttrsOwner, TypeBoundsOwner { | 536 | struct TypeParam: NameOwner, AttrsOwner, TypeBoundsOwner { |
529 | Eq, | 537 | T![=], |
530 | default_type: TypeRef, | 538 | default_type: TypeRef, |
531 | } | 539 | } |
532 | struct ConstParam: NameOwner, AttrsOwner, TypeAscriptionOwner { | 540 | struct ConstParam: NameOwner, AttrsOwner, TypeAscriptionOwner { |
533 | Eq, | 541 | T![=], |
534 | default_val: Expr, | 542 | default_val: Expr, |
535 | } | 543 | } |
536 | struct LifetimeParam: AttrsOwner { Lifetime} | 544 | struct LifetimeParam: AttrsOwner { T![lifetime] } |
537 | struct TypeBound { Lifetime, /* Question, */ ConstKw, /* Question, */ TypeRef} | 545 | struct TypeBound { T![lifetime], /* Question, */ T![const], /* Question, */ TypeRef} |
538 | struct TypeBoundList { bounds: [TypeBound] } | 546 | struct TypeBoundList { bounds: [TypeBound] } |
539 | struct WherePred: TypeBoundsOwner { Lifetime, TypeRef } | 547 | struct WherePred: TypeBoundsOwner { T![lifetime], TypeRef } |
540 | struct WhereClause { WhereKw, predicates: [WherePred] } | 548 | struct WhereClause { T![where], predicates: [WherePred] } |
541 | struct Abi { String } | 549 | struct Abi { /*String*/ } |
542 | struct ExprStmt: AttrsOwner { Expr, Semi } | 550 | struct ExprStmt: AttrsOwner { Expr, T![;] } |
543 | struct LetStmt: AttrsOwner, TypeAscriptionOwner { | 551 | struct LetStmt: AttrsOwner, TypeAscriptionOwner { |
544 | LetKw, | 552 | T![let], |
545 | Pat, | 553 | Pat, |
546 | Eq, | 554 | T![=], |
547 | initializer: Expr, | 555 | initializer: Expr, |
556 | T![;], | ||
548 | } | 557 | } |
549 | struct Condition { LetKw, Pat, Eq, Expr } | 558 | struct Condition { T![let], Pat, T![=], Expr } |
550 | struct Block: AttrsOwner, ModuleItemOwner { | 559 | struct Block: AttrsOwner, ModuleItemOwner { |
551 | LCurly, | 560 | T!['{'], |
552 | statements: [Stmt], | 561 | statements: [Stmt], |
553 | Expr, | 562 | Expr, |
554 | RCurly, | 563 | T!['}'], |
555 | } | 564 | } |
556 | struct ParamList { | 565 | struct ParamList { |
557 | LParen, | 566 | T!['('], |
558 | SelfParam, | 567 | SelfParam, |
559 | params: [Param], | 568 | params: [Param], |
560 | RParen | 569 | T![')'] |
561 | } | 570 | } |
562 | struct SelfParam: TypeAscriptionOwner, AttrsOwner { Amp, Lifetime, SelfKw } | 571 | struct SelfParam: TypeAscriptionOwner, AttrsOwner { T![&], T![mut], T![lifetime], T![self] } |
563 | struct Param: TypeAscriptionOwner, AttrsOwner { | 572 | struct Param: TypeAscriptionOwner, AttrsOwner { |
564 | Pat, | 573 | Pat, |
565 | Dotdotdot | 574 | T![...] |
566 | } | 575 | } |
567 | struct UseItem: AttrsOwner, VisibilityOwner { | 576 | struct UseItem: AttrsOwner, VisibilityOwner { |
568 | UseKw, | 577 | T![use], |
569 | UseTree, | 578 | UseTree, |
570 | } | 579 | } |
571 | struct UseTree { | 580 | struct UseTree { |
572 | Path, Star, UseTreeList, Alias | 581 | Path, T![*], UseTreeList, Alias |
573 | } | 582 | } |
574 | struct Alias: NameOwner { AsKw } | 583 | struct Alias: NameOwner { T![as] } |
575 | struct UseTreeList { LCurly, use_trees: [UseTree], RCurly } | 584 | struct UseTreeList { T!['{'], use_trees: [UseTree], T!['}'] } |
576 | struct ExternCrateItem: AttrsOwner, VisibilityOwner { | 585 | struct ExternCrateItem: AttrsOwner, VisibilityOwner { |
577 | ExternKw, CrateKw, NameRef, Alias, | 586 | T![extern], T![crate], NameRef, Alias, |
578 | } | 587 | } |
579 | struct ArgList { | 588 | struct ArgList { |
580 | LParen, | 589 | T!['('], |
581 | args: [Expr], | 590 | args: [Expr], |
582 | RParen | 591 | T![')'] |
583 | } | 592 | } |
584 | struct Path { | 593 | struct Path { |
585 | segment: PathSegment, | 594 | segment: PathSegment, |
586 | qualifier: Path, | 595 | qualifier: Path, |
587 | } | 596 | } |
588 | struct PathSegment { | 597 | struct PathSegment { |
589 | Coloncolon, LAngle, NameRef, TypeArgList, ParamList, RetType, PathType, RAngle | 598 | T![::], T![<], NameRef, TypeArgList, ParamList, RetType, PathType, T![>] |
590 | } | 599 | } |
591 | struct TypeArgList { | 600 | struct TypeArgList { |
592 | Coloncolon, | 601 | T![::], |
593 | LAngle, | 602 | T![<], |
594 | generic_args: [GenericArg], | 603 | generic_args: [GenericArg], |
595 | type_args: [TypeArg], | 604 | type_args: [TypeArg], |
596 | lifetime_args: [LifetimeArg], | 605 | lifetime_args: [LifetimeArg], |
597 | assoc_type_args: [AssocTypeArg], | 606 | assoc_type_args: [AssocTypeArg], |
598 | const_args: [ConstArg], | 607 | const_args: [ConstArg], |
599 | RAngle | 608 | T![>] |
600 | } | 609 | } |
601 | struct TypeArg { TypeRef } | 610 | struct TypeArg { TypeRef } |
602 | struct AssocTypeArg : TypeBoundsOwner { NameRef, Eq, TypeRef } | 611 | struct AssocTypeArg : TypeBoundsOwner { NameRef, T![=], TypeRef } |
603 | struct LifetimeArg { Lifetime } | 612 | struct LifetimeArg { T![lifetime] } |
604 | struct ConstArg { Literal, Eq, BlockExpr } | 613 | struct ConstArg { Literal, T![=], BlockExpr } |
605 | 614 | ||
606 | struct MacroItems: ModuleItemOwner, FnDefOwner { } | 615 | struct MacroItems: ModuleItemOwner{ } |
607 | 616 | ||
608 | struct MacroStmts { | 617 | struct MacroStmts { |
609 | statements: [Stmt], | 618 | statements: [Stmt], |
610 | Expr, | 619 | Expr, |
611 | } | 620 | } |
612 | 621 | ||
613 | struct ExternItemList: FnDefOwner, ModuleItemOwner { | 622 | struct ExternItemList: ModuleItemOwner { |
614 | LCurly, | 623 | T!['{'], |
615 | extern_items: [ExternItem], | 624 | extern_items: [ExternItem], |
616 | RCurly | 625 | T!['}'] |
617 | } | 626 | } |
618 | 627 | ||
619 | struct ExternBlock { | 628 | struct ExternBlock { |
@@ -622,7 +631,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
622 | } | 631 | } |
623 | 632 | ||
624 | struct MetaItem { | 633 | struct MetaItem { |
625 | Path, Eq, AttrInput, nested_meta_items: [MetaItem] | 634 | Path, T![=], AttrInput, nested_meta_items: [MetaItem] |
626 | } | 635 | } |
627 | 636 | ||
628 | struct MacroDef { | 637 | struct MacroDef { |
@@ -759,71 +768,4 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
759 | TupleFieldDefList, | 768 | TupleFieldDefList, |
760 | } | 769 | } |
761 | }, | 770 | }, |
762 | |||
763 | token_enums: &ast_enums! { | ||
764 | enum LeftDelimiter { LParen, LBrack, LCurly } | ||
765 | enum RightDelimiter { RParen, RBrack, RCurly } | ||
766 | enum RangeSeparator { Dotdot, Dotdotdot, Dotdoteq} | ||
767 | |||
768 | enum BinOp { | ||
769 | Pipepipe, | ||
770 | Ampamp, | ||
771 | Eqeq, | ||
772 | Neq, | ||
773 | Lteq, | ||
774 | Gteq, | ||
775 | LAngle, | ||
776 | RAngle, | ||
777 | Plus, | ||
778 | Star, | ||
779 | Minus, | ||
780 | Slash, | ||
781 | Percent, | ||
782 | Shl, | ||
783 | Shr, | ||
784 | Caret, | ||
785 | Pipe, | ||
786 | Amp, | ||
787 | Eq, | ||
788 | Pluseq, | ||
789 | Slasheq, | ||
790 | Stareq, | ||
791 | Percenteq, | ||
792 | Shreq, | ||
793 | Shleq, | ||
794 | Minuseq, | ||
795 | Pipeeq, | ||
796 | Ampeq, | ||
797 | Careteq, | ||
798 | } | ||
799 | |||
800 | enum PrefixOp { | ||
801 | Minus, | ||
802 | Excl, | ||
803 | Star | ||
804 | } | ||
805 | |||
806 | enum RangeOp { | ||
807 | Dotdot, | ||
808 | Dotdoteq | ||
809 | } | ||
810 | |||
811 | enum LiteralToken { | ||
812 | IntNumber, | ||
813 | FloatNumber, | ||
814 | String, | ||
815 | RawString, | ||
816 | TrueKw, | ||
817 | FalseKw, | ||
818 | ByteString, | ||
819 | RawByteString, | ||
820 | Char, | ||
821 | Byte | ||
822 | } | ||
823 | |||
824 | enum NameRefToken { | ||
825 | Ident, | ||
826 | IntNumber | ||
827 | } | ||
828 | }, | ||
829 | }; | 771 | }; |
diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs index 6657c9fc5..ec1f6ad8a 100644 --- a/xtask/src/codegen/gen_syntax.rs +++ b/xtask/src/codegen/gen_syntax.rs | |||
@@ -3,16 +3,13 @@ | |||
3 | //! Specifically, it generates the `SyntaxKind` enum and a number of newtype | 3 | //! Specifically, it generates the `SyntaxKind` enum and a number of newtype |
4 | //! wrappers around `SyntaxNode` which implement `ra_syntax::AstNode`. | 4 | //! wrappers around `SyntaxNode` which implement `ra_syntax::AstNode`. |
5 | 5 | ||
6 | use std::{ | 6 | use std::collections::HashSet; |
7 | borrow::Cow, | ||
8 | collections::{BTreeSet, HashSet}, | ||
9 | }; | ||
10 | 7 | ||
11 | use proc_macro2::{Punct, Spacing}; | 8 | use proc_macro2::{Punct, Spacing}; |
12 | use quote::{format_ident, quote}; | 9 | use quote::{format_ident, quote}; |
13 | 10 | ||
14 | use crate::{ | 11 | use crate::{ |
15 | ast_src::{AstSrc, FieldSrc, KindsSrc, AST_SRC, KINDS_SRC}, | 12 | ast_src::{AstSrc, Field, FieldSrc, KindsSrc, AST_SRC, KINDS_SRC}, |
16 | codegen::{self, update, Mode}, | 13 | codegen::{self, update, Mode}, |
17 | project_root, Result, | 14 | project_root, Result, |
18 | }; | 15 | }; |
@@ -22,58 +19,31 @@ pub fn generate_syntax(mode: Mode) -> Result<()> { | |||
22 | let syntax_kinds = generate_syntax_kinds(KINDS_SRC)?; | 19 | let syntax_kinds = generate_syntax_kinds(KINDS_SRC)?; |
23 | update(syntax_kinds_file.as_path(), &syntax_kinds, mode)?; | 20 | update(syntax_kinds_file.as_path(), &syntax_kinds, mode)?; |
24 | 21 | ||
22 | let ast_tokens_file = project_root().join(codegen::AST_TOKENS); | ||
23 | let contents = generate_tokens(AST_SRC)?; | ||
24 | update(ast_tokens_file.as_path(), &contents, mode)?; | ||
25 | |||
25 | let ast_nodes_file = project_root().join(codegen::AST_NODES); | 26 | let ast_nodes_file = project_root().join(codegen::AST_NODES); |
26 | let contents = generate_nodes(KINDS_SRC, AST_SRC)?; | 27 | let contents = generate_nodes(KINDS_SRC, AST_SRC)?; |
27 | update(ast_nodes_file.as_path(), &contents, mode)?; | 28 | update(ast_nodes_file.as_path(), &contents, mode)?; |
28 | 29 | ||
29 | let ast_tokens_file = project_root().join(codegen::AST_TOKENS); | ||
30 | let contents = generate_tokens(KINDS_SRC, AST_SRC)?; | ||
31 | update(ast_tokens_file.as_path(), &contents, mode)?; | ||
32 | |||
33 | Ok(()) | 30 | Ok(()) |
34 | } | 31 | } |
35 | 32 | ||
36 | #[derive(Debug, Default, Clone)] | 33 | fn generate_tokens(grammar: AstSrc<'_>) -> Result<String> { |
37 | struct ElementKinds { | 34 | let tokens = grammar.tokens.iter().map(|token| { |
38 | kinds: BTreeSet<proc_macro2::Ident>, | 35 | let name = format_ident!("{}", token); |
39 | has_nodes: bool, | 36 | let kind = format_ident!("{}", to_upper_snake_case(token)); |
40 | has_tokens: bool, | ||
41 | } | ||
42 | |||
43 | fn generate_tokens(kinds: KindsSrc<'_>, grammar: AstSrc<'_>) -> Result<String> { | ||
44 | let all_token_kinds: Vec<_> = kinds | ||
45 | .punct | ||
46 | .into_iter() | ||
47 | .map(|(_, kind)| kind) | ||
48 | .copied() | ||
49 | .map(|x| x.into()) | ||
50 | .chain( | ||
51 | kinds | ||
52 | .keywords | ||
53 | .into_iter() | ||
54 | .chain(kinds.contextual_keywords.into_iter()) | ||
55 | .map(|name| Cow::Owned(format!("{}_KW", to_upper_snake_case(&name)))), | ||
56 | ) | ||
57 | .chain(kinds.literals.into_iter().copied().map(|x| x.into())) | ||
58 | .chain(kinds.tokens.into_iter().copied().map(|x| x.into())) | ||
59 | .collect(); | ||
60 | |||
61 | let tokens = all_token_kinds.iter().map(|kind_str| { | ||
62 | let kind_str = &**kind_str; | ||
63 | let kind = format_ident!("{}", kind_str); | ||
64 | let name = format_ident!("{}", to_pascal_case(kind_str)); | ||
65 | quote! { | 37 | quote! { |
66 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 38 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
67 | pub struct #name { | 39 | pub struct #name { |
68 | pub(crate) syntax: SyntaxToken, | 40 | pub(crate) syntax: SyntaxToken, |
69 | } | 41 | } |
70 | |||
71 | impl std::fmt::Display for #name { | 42 | impl std::fmt::Display for #name { |
72 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 43 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
73 | std::fmt::Display::fmt(&self.syntax, f) | 44 | std::fmt::Display::fmt(&self.syntax, f) |
74 | } | 45 | } |
75 | } | 46 | } |
76 | |||
77 | impl AstToken for #name { | 47 | impl AstToken for #name { |
78 | fn can_cast(kind: SyntaxKind) -> bool { kind == #kind } | 48 | fn can_cast(kind: SyntaxKind) -> bool { kind == #kind } |
79 | fn cast(syntax: SyntaxToken) -> Option<Self> { | 49 | fn cast(syntax: SyntaxToken) -> Option<Self> { |
@@ -84,99 +54,15 @@ fn generate_tokens(kinds: KindsSrc<'_>, grammar: AstSrc<'_>) -> Result<String> { | |||
84 | } | 54 | } |
85 | }); | 55 | }); |
86 | 56 | ||
87 | let enums = grammar.token_enums.iter().map(|en| { | 57 | let pretty = crate::reformat(quote! { |
88 | let variants = en.variants.iter().map(|var| format_ident!("{}", var)).collect::<Vec<_>>(); | 58 | use crate::{SyntaxKind::{self, *}, SyntaxToken, ast::AstToken}; |
89 | let name = format_ident!("{}", en.name); | ||
90 | let kinds = variants | ||
91 | .iter() | ||
92 | .map(|name| format_ident!("{}", to_upper_snake_case(&name.to_string()))) | ||
93 | .collect::<Vec<_>>(); | ||
94 | assert!(en.traits.is_empty()); | ||
95 | |||
96 | quote! { | ||
97 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
98 | pub enum #name { | ||
99 | #(#variants(#variants),)* | ||
100 | } | ||
101 | |||
102 | #( | ||
103 | impl From<#variants> for #name { | ||
104 | fn from(node: #variants) -> #name { | ||
105 | #name::#variants(node) | ||
106 | } | ||
107 | } | ||
108 | )* | ||
109 | |||
110 | impl std::fmt::Display for #name { | ||
111 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
112 | std::fmt::Display::fmt(self.syntax(), f) | ||
113 | } | ||
114 | } | ||
115 | |||
116 | impl AstToken for #name { | ||
117 | fn can_cast(kind: SyntaxKind) -> bool { | ||
118 | match kind { | ||
119 | #(#kinds)|* => true, | ||
120 | _ => false, | ||
121 | } | ||
122 | } | ||
123 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
124 | let res = match syntax.kind() { | ||
125 | #( | ||
126 | #kinds => #name::#variants(#variants { syntax }), | ||
127 | )* | ||
128 | _ => return None, | ||
129 | }; | ||
130 | Some(res) | ||
131 | } | ||
132 | fn syntax(&self) -> &SyntaxToken { | ||
133 | match self { | ||
134 | #( | ||
135 | #name::#variants(it) => &it.syntax, | ||
136 | )* | ||
137 | } | ||
138 | } | ||
139 | } | ||
140 | } | ||
141 | }); | ||
142 | |||
143 | crate::reformat(quote! { | ||
144 | use crate::{SyntaxToken, SyntaxKind::{self, *}, ast::AstToken}; | ||
145 | |||
146 | #(#tokens)* | 59 | #(#tokens)* |
147 | #(#enums)* | 60 | })? |
148 | }) | 61 | .replace("#[derive", "\n#[derive"); |
62 | Ok(pretty) | ||
149 | } | 63 | } |
150 | 64 | ||
151 | fn generate_nodes(kinds: KindsSrc<'_>, grammar: AstSrc<'_>) -> Result<String> { | 65 | fn generate_nodes(kinds: KindsSrc<'_>, grammar: AstSrc<'_>) -> Result<String> { |
152 | let all_token_kinds: Vec<_> = kinds | ||
153 | .punct | ||
154 | .into_iter() | ||
155 | .map(|(_, kind)| kind) | ||
156 | .copied() | ||
157 | .map(|x| x.into()) | ||
158 | .chain( | ||
159 | kinds | ||
160 | .keywords | ||
161 | .into_iter() | ||
162 | .chain(kinds.contextual_keywords.into_iter()) | ||
163 | .map(|name| Cow::Owned(format!("{}_KW", to_upper_snake_case(&name)))), | ||
164 | ) | ||
165 | .chain(kinds.literals.into_iter().copied().map(|x| x.into())) | ||
166 | .chain(kinds.tokens.into_iter().copied().map(|x| x.into())) | ||
167 | .collect(); | ||
168 | |||
169 | let mut token_kinds = HashSet::new(); | ||
170 | for kind in &all_token_kinds { | ||
171 | let kind = &**kind; | ||
172 | let name = to_pascal_case(kind); | ||
173 | token_kinds.insert(name); | ||
174 | } | ||
175 | |||
176 | for en in grammar.token_enums { | ||
177 | token_kinds.insert(en.name.to_string()); | ||
178 | } | ||
179 | |||
180 | let nodes = grammar.nodes.iter().map(|node| { | 66 | let nodes = grammar.nodes.iter().map(|node| { |
181 | let name = format_ident!("{}", node.name); | 67 | let name = format_ident!("{}", node.name); |
182 | let kind = format_ident!("{}", to_upper_snake_case(&name.to_string())); | 68 | let kind = format_ident!("{}", to_upper_snake_case(&name.to_string())); |
@@ -185,39 +71,27 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: AstSrc<'_>) -> Result<String> { | |||
185 | quote!(impl ast::#trait_name for #name {}) | 71 | quote!(impl ast::#trait_name for #name {}) |
186 | }); | 72 | }); |
187 | 73 | ||
188 | let methods = node.fields.iter().map(|(name, field)| { | 74 | let methods = node.fields.iter().map(|field| { |
189 | let method_name = match field { | 75 | let method_name = field.method_name(); |
190 | FieldSrc::Shorthand => format_ident!("{}", to_lower_snake_case(&name)), | 76 | let ty = field.ty(); |
191 | _ => format_ident!("{}", name), | ||
192 | }; | ||
193 | let ty = match field { | ||
194 | FieldSrc::Optional(ty) | FieldSrc::Many(ty) => ty, | ||
195 | FieldSrc::Shorthand => name, | ||
196 | }; | ||
197 | 77 | ||
198 | let ty = format_ident!("{}", ty); | 78 | if field.is_many() { |
199 | 79 | quote! { | |
200 | match field { | 80 | pub fn #method_name(&self) -> AstChildren<#ty> { |
201 | FieldSrc::Many(_) => { | 81 | support::children(&self.syntax) |
202 | quote! { | ||
203 | pub fn #method_name(&self) -> AstChildren<#ty> { | ||
204 | support::children(&self.syntax) | ||
205 | } | ||
206 | } | 82 | } |
207 | } | 83 | } |
208 | FieldSrc::Optional(_) | FieldSrc::Shorthand => { | 84 | } else { |
209 | let is_token = token_kinds.contains(&ty.to_string()); | 85 | if let Some(token_kind) = field.token_kind() { |
210 | if is_token { | 86 | quote! { |
211 | quote! { | 87 | pub fn #method_name(&self) -> Option<#ty> { |
212 | pub fn #method_name(&self) -> Option<#ty> { | 88 | support::token(&self.syntax, #token_kind) |
213 | support::token(&self.syntax) | ||
214 | } | ||
215 | } | 89 | } |
216 | } else { | 90 | } |
217 | quote! { | 91 | } else { |
218 | pub fn #method_name(&self) -> Option<#ty> { | 92 | quote! { |
219 | support::child(&self.syntax) | 93 | pub fn #method_name(&self) -> Option<#ty> { |
220 | } | 94 | support::child(&self.syntax) |
221 | } | 95 | } |
222 | } | 96 | } |
223 | } | 97 | } |
@@ -331,18 +205,18 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: AstSrc<'_>) -> Result<String> { | |||
331 | 205 | ||
332 | let ast = quote! { | 206 | let ast = quote! { |
333 | use crate::{ | 207 | use crate::{ |
334 | SyntaxNode, SyntaxKind::{self, *}, | 208 | SyntaxNode, SyntaxToken, SyntaxKind::{self, *}, |
335 | ast::{self, AstNode, AstChildren, support}, | 209 | ast::{self, AstNode, AstChildren, support}, |
210 | T, | ||
336 | }; | 211 | }; |
337 | 212 | ||
338 | use super::tokens::*; | ||
339 | |||
340 | #(#nodes)* | 213 | #(#nodes)* |
341 | #(#enums)* | 214 | #(#enums)* |
342 | #(#displays)* | 215 | #(#displays)* |
343 | }; | 216 | }; |
344 | 217 | ||
345 | let pretty = crate::reformat(ast)?; | 218 | let ast = ast.to_string().replace("T ! [ ", "T![").replace(" ] )", "])"); |
219 | let pretty = crate::reformat(ast)?.replace("#[derive", "\n#[derive"); | ||
346 | Ok(pretty) | 220 | Ok(pretty) |
347 | } | 221 | } |
348 | 222 | ||
@@ -450,8 +324,10 @@ fn generate_syntax_kinds(grammar: KindsSrc<'_>) -> Result<String> { | |||
450 | 324 | ||
451 | #[macro_export] | 325 | #[macro_export] |
452 | macro_rules! T { | 326 | macro_rules! T { |
453 | #((#punctuation_values) => { $crate::SyntaxKind::#punctuation };)* | 327 | #([#punctuation_values] => { $crate::SyntaxKind::#punctuation };)* |
454 | #((#all_keywords_idents) => { $crate::SyntaxKind::#all_keywords };)* | 328 | #([#all_keywords_idents] => { $crate::SyntaxKind::#all_keywords };)* |
329 | [lifetime] => { $crate::SyntaxKind::LIFETIME }; | ||
330 | [ident] => { $crate::SyntaxKind::IDENT }; | ||
455 | } | 331 | } |
456 | }; | 332 | }; |
457 | 333 | ||
@@ -501,3 +377,68 @@ fn to_pascal_case(s: &str) -> String { | |||
501 | } | 377 | } |
502 | buf | 378 | buf |
503 | } | 379 | } |
380 | |||
381 | impl Field<'_> { | ||
382 | fn is_many(&self) -> bool { | ||
383 | match self { | ||
384 | Field::Node { src: FieldSrc::Many(_), .. } => true, | ||
385 | _ => false, | ||
386 | } | ||
387 | } | ||
388 | fn token_kind(&self) -> Option<proc_macro2::TokenStream> { | ||
389 | let res = match self { | ||
390 | Field::Token(token) => { | ||
391 | let token: proc_macro2::TokenStream = token.parse().unwrap(); | ||
392 | quote! { T![#token] } | ||
393 | } | ||
394 | _ => return None, | ||
395 | }; | ||
396 | Some(res) | ||
397 | } | ||
398 | fn method_name(&self) -> proc_macro2::Ident { | ||
399 | match self { | ||
400 | Field::Token(name) => { | ||
401 | let name = match *name { | ||
402 | ";" => "semicolon", | ||
403 | "->" => "thin_arrow", | ||
404 | "'{'" => "l_curly", | ||
405 | "'}'" => "r_curly", | ||
406 | "'('" => "l_paren", | ||
407 | "')'" => "r_paren", | ||
408 | "'['" => "l_brack", | ||
409 | "']'" => "r_brack", | ||
410 | "<" => "l_angle", | ||
411 | ">" => "r_angle", | ||
412 | "=" => "eq", | ||
413 | "!" => "excl", | ||
414 | "*" => "star", | ||
415 | "&" => "amp", | ||
416 | "_" => "underscore", | ||
417 | "." => "dot", | ||
418 | ".." => "dotdot", | ||
419 | "..." => "dotdotdot", | ||
420 | "=>" => "fat_arrow", | ||
421 | "@" => "at", | ||
422 | ":" => "colon", | ||
423 | "::" => "coloncolon", | ||
424 | "#" => "pound", | ||
425 | _ => name, | ||
426 | }; | ||
427 | format_ident!("{}_token", name) | ||
428 | } | ||
429 | Field::Node { name, src } => match src { | ||
430 | FieldSrc::Shorthand => format_ident!("{}", to_lower_snake_case(name)), | ||
431 | _ => format_ident!("{}", name), | ||
432 | }, | ||
433 | } | ||
434 | } | ||
435 | fn ty(&self) -> proc_macro2::Ident { | ||
436 | match self { | ||
437 | Field::Token(_) => format_ident!("SyntaxToken"), | ||
438 | Field::Node { name, src } => match src { | ||
439 | FieldSrc::Optional(ty) | FieldSrc::Many(ty) => format_ident!("{}", ty), | ||
440 | FieldSrc::Shorthand => format_ident!("{}", name), | ||
441 | }, | ||
442 | } | ||
443 | } | ||
444 | } | ||
diff --git a/xtask/tests/tidy-tests/main.rs b/xtask/tests/tidy-tests/main.rs index 80911a68e..e5247854a 100644 --- a/xtask/tests/tidy-tests/main.rs +++ b/xtask/tests/tidy-tests/main.rs | |||
@@ -20,7 +20,16 @@ fn rust_files_are_tidy() { | |||
20 | } | 20 | } |
21 | 21 | ||
22 | fn check_todo(path: &Path, text: &str) { | 22 | fn check_todo(path: &Path, text: &str) { |
23 | if path.ends_with("tests/cli.rs") { | 23 | let whitelist = &[ |
24 | // This file itself is whitelisted since this test itself contains matches. | ||
25 | "tests/cli.rs", | ||
26 | // Some of our assists generate `todo!()` so those files are whitelisted. | ||
27 | "doc_tests/generated.rs", | ||
28 | "handlers/add_missing_impl_members.rs", | ||
29 | // To support generating `todo!()` in assists, we have `expr_todo()` in ast::make. | ||
30 | "ast/make.rs", | ||
31 | ]; | ||
32 | if whitelist.iter().any(|p| path.ends_with(p)) { | ||
24 | return; | 33 | return; |
25 | } | 34 | } |
26 | if text.contains("TODO") || text.contains("TOOD") || text.contains("todo!") { | 35 | if text.contains("TODO") || text.contains("TOOD") || text.contains("todo!") { |
@@ -37,9 +46,9 @@ fn check_trailing_ws(path: &Path, text: &str) { | |||
37 | if is_exclude_dir(path, &["test_data"]) { | 46 | if is_exclude_dir(path, &["test_data"]) { |
38 | return; | 47 | return; |
39 | } | 48 | } |
40 | for line in text.lines() { | 49 | for (line_number, line) in text.lines().enumerate() { |
41 | if line.chars().last().map(char::is_whitespace) == Some(true) { | 50 | if line.chars().last().map(char::is_whitespace) == Some(true) { |
42 | panic!("Trailing whitespace in {}", path.display()) | 51 | panic!("Trailing whitespace in {} at line {}", path.display(), line_number) |
43 | } | 52 | } |
44 | } | 53 | } |
45 | } | 54 | } |