diff options
Diffstat (limited to 'crates/ra_syntax')
24 files changed, 169 insertions, 53 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index 3aaa5edda..2a3bd27e2 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs | |||
@@ -279,7 +279,7 @@ impl<'a> NameRef<'a> { | |||
279 | } | 279 | } |
280 | } | 280 | } |
281 | 281 | ||
282 | impl<'a> ImplItem<'a> { | 282 | impl<'a> ImplBlock<'a> { |
283 | pub fn target_type(self) -> Option<TypeRef<'a>> { | 283 | pub fn target_type(self) -> Option<TypeRef<'a>> { |
284 | match self.target() { | 284 | match self.target() { |
285 | (Some(t), None) | (_, Some(t)) => Some(t), | 285 | (Some(t), None) | (_, Some(t)) => Some(t), |
@@ -482,6 +482,37 @@ impl<'a> PrefixExpr<'a> { | |||
482 | } | 482 | } |
483 | } | 483 | } |
484 | 484 | ||
485 | #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] | ||
486 | pub enum SelfParamFlavor { | ||
487 | /// self | ||
488 | Owned, | ||
489 | /// &self | ||
490 | Ref, | ||
491 | /// &mut self | ||
492 | MutRef, | ||
493 | } | ||
494 | |||
495 | impl<'a> SelfParam<'a> { | ||
496 | pub fn flavor(&self) -> SelfParamFlavor { | ||
497 | let borrowed = self.syntax().children().any(|n| n.kind() == AMP); | ||
498 | if borrowed { | ||
499 | // check for a `mut` coming after the & -- `mut &self` != `&mut self` | ||
500 | if self | ||
501 | .syntax() | ||
502 | .children() | ||
503 | .skip_while(|n| n.kind() != AMP) | ||
504 | .any(|n| n.kind() == MUT_KW) | ||
505 | { | ||
506 | SelfParamFlavor::MutRef | ||
507 | } else { | ||
508 | SelfParamFlavor::Ref | ||
509 | } | ||
510 | } else { | ||
511 | SelfParamFlavor::Owned | ||
512 | } | ||
513 | } | ||
514 | } | ||
515 | |||
485 | #[test] | 516 | #[test] |
486 | fn test_doc_comment_of_items() { | 517 | fn test_doc_comment_of_items() { |
487 | let file = SourceFileNode::parse( | 518 | let file = SourceFileNode::parse( |
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index c619fc130..7df6a9c46 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -1407,41 +1407,73 @@ impl<'a> IfExpr<'a> { | |||
1407 | } | 1407 | } |
1408 | } | 1408 | } |
1409 | 1409 | ||
1410 | // ImplItem | 1410 | // ImplBlock |
1411 | #[derive(Debug, Clone, Copy,)] | 1411 | #[derive(Debug, Clone, Copy,)] |
1412 | pub struct ImplItemNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1412 | pub struct ImplBlockNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1413 | pub(crate) syntax: SyntaxNode<R>, | 1413 | pub(crate) syntax: SyntaxNode<R>, |
1414 | } | 1414 | } |
1415 | pub type ImplItem<'a> = ImplItemNode<RefRoot<'a>>; | 1415 | pub type ImplBlock<'a> = ImplBlockNode<RefRoot<'a>>; |
1416 | 1416 | ||
1417 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ImplItemNode<R1>> for ImplItemNode<R2> { | 1417 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ImplBlockNode<R1>> for ImplBlockNode<R2> { |
1418 | fn eq(&self, other: &ImplItemNode<R1>) -> bool { self.syntax == other.syntax } | 1418 | fn eq(&self, other: &ImplBlockNode<R1>) -> bool { self.syntax == other.syntax } |
1419 | } | 1419 | } |
1420 | impl<R: TreeRoot<RaTypes>> Eq for ImplItemNode<R> {} | 1420 | impl<R: TreeRoot<RaTypes>> Eq for ImplBlockNode<R> {} |
1421 | impl<R: TreeRoot<RaTypes>> Hash for ImplItemNode<R> { | 1421 | impl<R: TreeRoot<RaTypes>> Hash for ImplBlockNode<R> { |
1422 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | 1422 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } |
1423 | } | 1423 | } |
1424 | 1424 | ||
1425 | impl<'a> AstNode<'a> for ImplItem<'a> { | 1425 | impl<'a> AstNode<'a> for ImplBlock<'a> { |
1426 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1426 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1427 | match syntax.kind() { | 1427 | match syntax.kind() { |
1428 | IMPL_ITEM => Some(ImplItem { syntax }), | 1428 | IMPL_BLOCK => Some(ImplBlock { syntax }), |
1429 | _ => None, | 1429 | _ => None, |
1430 | } | 1430 | } |
1431 | } | 1431 | } |
1432 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | 1432 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } |
1433 | } | 1433 | } |
1434 | 1434 | ||
1435 | impl<R: TreeRoot<RaTypes>> ImplItemNode<R> { | 1435 | impl<R: TreeRoot<RaTypes>> ImplBlockNode<R> { |
1436 | pub fn borrowed(&self) -> ImplItem { | 1436 | pub fn borrowed(&self) -> ImplBlock { |
1437 | ImplItemNode { syntax: self.syntax.borrowed() } | 1437 | ImplBlockNode { syntax: self.syntax.borrowed() } |
1438 | } | 1438 | } |
1439 | pub fn owned(&self) -> ImplItemNode { | 1439 | pub fn owned(&self) -> ImplBlockNode { |
1440 | ImplItemNode { syntax: self.syntax.owned() } | 1440 | ImplBlockNode { syntax: self.syntax.owned() } |
1441 | } | 1441 | } |
1442 | } | 1442 | } |
1443 | 1443 | ||
1444 | 1444 | ||
1445 | impl<'a> ImplBlock<'a> { | ||
1446 | pub fn item_list(self) -> Option<ItemList<'a>> { | ||
1447 | super::child_opt(self) | ||
1448 | } | ||
1449 | } | ||
1450 | |||
1451 | // ImplItem | ||
1452 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
1453 | pub enum ImplItem<'a> { | ||
1454 | FnDef(FnDef<'a>), | ||
1455 | TypeDef(TypeDef<'a>), | ||
1456 | ConstDef(ConstDef<'a>), | ||
1457 | } | ||
1458 | |||
1459 | impl<'a> AstNode<'a> for ImplItem<'a> { | ||
1460 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
1461 | match syntax.kind() { | ||
1462 | FN_DEF => Some(ImplItem::FnDef(FnDef { syntax })), | ||
1463 | TYPE_DEF => Some(ImplItem::TypeDef(TypeDef { syntax })), | ||
1464 | CONST_DEF => Some(ImplItem::ConstDef(ConstDef { syntax })), | ||
1465 | _ => None, | ||
1466 | } | ||
1467 | } | ||
1468 | fn syntax(self) -> SyntaxNodeRef<'a> { | ||
1469 | match self { | ||
1470 | ImplItem::FnDef(inner) => inner.syntax(), | ||
1471 | ImplItem::TypeDef(inner) => inner.syntax(), | ||
1472 | ImplItem::ConstDef(inner) => inner.syntax(), | ||
1473 | } | ||
1474 | } | ||
1475 | } | ||
1476 | |||
1445 | impl<'a> ImplItem<'a> {} | 1477 | impl<'a> ImplItem<'a> {} |
1446 | 1478 | ||
1447 | // ImplTraitType | 1479 | // ImplTraitType |
@@ -1555,7 +1587,11 @@ impl<R: TreeRoot<RaTypes>> ItemListNode<R> { | |||
1555 | 1587 | ||
1556 | impl<'a> ast::FnDefOwner<'a> for ItemList<'a> {} | 1588 | impl<'a> ast::FnDefOwner<'a> for ItemList<'a> {} |
1557 | impl<'a> ast::ModuleItemOwner<'a> for ItemList<'a> {} | 1589 | impl<'a> ast::ModuleItemOwner<'a> for ItemList<'a> {} |
1558 | impl<'a> ItemList<'a> {} | 1590 | impl<'a> ItemList<'a> { |
1591 | pub fn impl_items(self) -> impl Iterator<Item = ImplItem<'a>> + 'a { | ||
1592 | super::children(self) | ||
1593 | } | ||
1594 | } | ||
1559 | 1595 | ||
1560 | // Label | 1596 | // Label |
1561 | #[derive(Debug, Clone, Copy,)] | 1597 | #[derive(Debug, Clone, Copy,)] |
@@ -2157,7 +2193,7 @@ pub enum ModuleItem<'a> { | |||
2157 | FnDef(FnDef<'a>), | 2193 | FnDef(FnDef<'a>), |
2158 | TraitDef(TraitDef<'a>), | 2194 | TraitDef(TraitDef<'a>), |
2159 | TypeDef(TypeDef<'a>), | 2195 | TypeDef(TypeDef<'a>), |
2160 | ImplItem(ImplItem<'a>), | 2196 | ImplBlock(ImplBlock<'a>), |
2161 | UseItem(UseItem<'a>), | 2197 | UseItem(UseItem<'a>), |
2162 | ExternCrateItem(ExternCrateItem<'a>), | 2198 | ExternCrateItem(ExternCrateItem<'a>), |
2163 | ConstDef(ConstDef<'a>), | 2199 | ConstDef(ConstDef<'a>), |
@@ -2173,7 +2209,7 @@ impl<'a> AstNode<'a> for ModuleItem<'a> { | |||
2173 | FN_DEF => Some(ModuleItem::FnDef(FnDef { syntax })), | 2209 | FN_DEF => Some(ModuleItem::FnDef(FnDef { syntax })), |
2174 | TRAIT_DEF => Some(ModuleItem::TraitDef(TraitDef { syntax })), | 2210 | TRAIT_DEF => Some(ModuleItem::TraitDef(TraitDef { syntax })), |
2175 | TYPE_DEF => Some(ModuleItem::TypeDef(TypeDef { syntax })), | 2211 | TYPE_DEF => Some(ModuleItem::TypeDef(TypeDef { syntax })), |
2176 | IMPL_ITEM => Some(ModuleItem::ImplItem(ImplItem { syntax })), | 2212 | IMPL_BLOCK => Some(ModuleItem::ImplBlock(ImplBlock { syntax })), |
2177 | USE_ITEM => Some(ModuleItem::UseItem(UseItem { syntax })), | 2213 | USE_ITEM => Some(ModuleItem::UseItem(UseItem { syntax })), |
2178 | EXTERN_CRATE_ITEM => Some(ModuleItem::ExternCrateItem(ExternCrateItem { syntax })), | 2214 | EXTERN_CRATE_ITEM => Some(ModuleItem::ExternCrateItem(ExternCrateItem { syntax })), |
2179 | CONST_DEF => Some(ModuleItem::ConstDef(ConstDef { syntax })), | 2215 | CONST_DEF => Some(ModuleItem::ConstDef(ConstDef { syntax })), |
@@ -2189,7 +2225,7 @@ impl<'a> AstNode<'a> for ModuleItem<'a> { | |||
2189 | ModuleItem::FnDef(inner) => inner.syntax(), | 2225 | ModuleItem::FnDef(inner) => inner.syntax(), |
2190 | ModuleItem::TraitDef(inner) => inner.syntax(), | 2226 | ModuleItem::TraitDef(inner) => inner.syntax(), |
2191 | ModuleItem::TypeDef(inner) => inner.syntax(), | 2227 | ModuleItem::TypeDef(inner) => inner.syntax(), |
2192 | ModuleItem::ImplItem(inner) => inner.syntax(), | 2228 | ModuleItem::ImplBlock(inner) => inner.syntax(), |
2193 | ModuleItem::UseItem(inner) => inner.syntax(), | 2229 | ModuleItem::UseItem(inner) => inner.syntax(), |
2194 | ModuleItem::ExternCrateItem(inner) => inner.syntax(), | 2230 | ModuleItem::ExternCrateItem(inner) => inner.syntax(), |
2195 | ModuleItem::ConstDef(inner) => inner.syntax(), | 2231 | ModuleItem::ConstDef(inner) => inner.syntax(), |
@@ -3452,6 +3488,43 @@ impl<'a> ReturnExpr<'a> { | |||
3452 | } | 3488 | } |
3453 | } | 3489 | } |
3454 | 3490 | ||
3491 | // SelfKw | ||
3492 | #[derive(Debug, Clone, Copy,)] | ||
3493 | pub struct SelfKwNode<R: TreeRoot<RaTypes> = OwnedRoot> { | ||
3494 | pub(crate) syntax: SyntaxNode<R>, | ||
3495 | } | ||
3496 | pub type SelfKw<'a> = SelfKwNode<RefRoot<'a>>; | ||
3497 | |||
3498 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<SelfKwNode<R1>> for SelfKwNode<R2> { | ||
3499 | fn eq(&self, other: &SelfKwNode<R1>) -> bool { self.syntax == other.syntax } | ||
3500 | } | ||
3501 | impl<R: TreeRoot<RaTypes>> Eq for SelfKwNode<R> {} | ||
3502 | impl<R: TreeRoot<RaTypes>> Hash for SelfKwNode<R> { | ||
3503 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3504 | } | ||
3505 | |||
3506 | impl<'a> AstNode<'a> for SelfKw<'a> { | ||
3507 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
3508 | match syntax.kind() { | ||
3509 | SELF_KW => Some(SelfKw { syntax }), | ||
3510 | _ => None, | ||
3511 | } | ||
3512 | } | ||
3513 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
3514 | } | ||
3515 | |||
3516 | impl<R: TreeRoot<RaTypes>> SelfKwNode<R> { | ||
3517 | pub fn borrowed(&self) -> SelfKw { | ||
3518 | SelfKwNode { syntax: self.syntax.borrowed() } | ||
3519 | } | ||
3520 | pub fn owned(&self) -> SelfKwNode { | ||
3521 | SelfKwNode { syntax: self.syntax.owned() } | ||
3522 | } | ||
3523 | } | ||
3524 | |||
3525 | |||
3526 | impl<'a> SelfKw<'a> {} | ||
3527 | |||
3455 | // SelfParam | 3528 | // SelfParam |
3456 | #[derive(Debug, Clone, Copy,)] | 3529 | #[derive(Debug, Clone, Copy,)] |
3457 | pub struct SelfParamNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3530 | pub struct SelfParamNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
@@ -3487,7 +3560,15 @@ impl<R: TreeRoot<RaTypes>> SelfParamNode<R> { | |||
3487 | } | 3560 | } |
3488 | 3561 | ||
3489 | 3562 | ||
3490 | impl<'a> SelfParam<'a> {} | 3563 | impl<'a> SelfParam<'a> { |
3564 | pub fn type_ref(self) -> Option<TypeRef<'a>> { | ||
3565 | super::child_opt(self) | ||
3566 | } | ||
3567 | |||
3568 | pub fn self_kw(self) -> Option<SelfKw<'a>> { | ||
3569 | super::child_opt(self) | ||
3570 | } | ||
3571 | } | ||
3491 | 3572 | ||
3492 | // SlicePat | 3573 | // SlicePat |
3493 | #[derive(Debug, Clone, Copy,)] | 3574 | #[derive(Debug, Clone, Copy,)] |
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 2abb9da61..c55e9e07a 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron | |||
@@ -128,7 +128,7 @@ Grammar( | |||
128 | "STATIC_DEF", | 128 | "STATIC_DEF", |
129 | "CONST_DEF", | 129 | "CONST_DEF", |
130 | "TRAIT_DEF", | 130 | "TRAIT_DEF", |
131 | "IMPL_ITEM", | 131 | "IMPL_BLOCK", |
132 | "TYPE_DEF", | 132 | "TYPE_DEF", |
133 | "MACRO_CALL", | 133 | "MACRO_CALL", |
134 | "TOKEN_TREE", | 134 | "TOKEN_TREE", |
@@ -284,6 +284,7 @@ Grammar( | |||
284 | options: [ "ItemList" ] | 284 | options: [ "ItemList" ] |
285 | ), | 285 | ), |
286 | "ItemList": ( | 286 | "ItemList": ( |
287 | collections: [["impl_items", "ImplItem"]], | ||
287 | traits: [ "FnDefOwner", "ModuleItemOwner" ], | 288 | traits: [ "FnDefOwner", "ModuleItemOwner" ], |
288 | ), | 289 | ), |
289 | "ConstDef": ( traits: [ | 290 | "ConstDef": ( traits: [ |
@@ -307,7 +308,7 @@ Grammar( | |||
307 | "AttrsOwner", | 308 | "AttrsOwner", |
308 | "DocCommentsOwner" | 309 | "DocCommentsOwner" |
309 | ] ), | 310 | ] ), |
310 | "ImplItem": (), | 311 | "ImplBlock": (options: ["ItemList"]), |
311 | 312 | ||
312 | "ParenType": (options: ["TypeRef"]), | 313 | "ParenType": (options: ["TypeRef"]), |
313 | "TupleType": ( collections: [["fields", "TypeRef"]] ), | 314 | "TupleType": ( collections: [["fields", "TypeRef"]] ), |
@@ -348,9 +349,12 @@ Grammar( | |||
348 | ], | 349 | ], |
349 | ), | 350 | ), |
350 | "ModuleItem": ( | 351 | "ModuleItem": ( |
351 | enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeDef", "ImplItem", | 352 | enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeDef", "ImplBlock", |
352 | "UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ] | 353 | "UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ] |
353 | ), | 354 | ), |
355 | "ImplItem": ( | ||
356 | enum: ["FnDef", "TypeDef", "ConstDef"] | ||
357 | ), | ||
354 | 358 | ||
355 | "TupleExpr": (), | 359 | "TupleExpr": (), |
356 | "ArrayExpr": (), | 360 | "ArrayExpr": (), |
@@ -530,7 +534,8 @@ Grammar( | |||
530 | ["params", "Param"] | 534 | ["params", "Param"] |
531 | ] | 535 | ] |
532 | ), | 536 | ), |
533 | "SelfParam": (), | 537 | "SelfParam": (options: ["TypeRef", "SelfKw"]), |
538 | "SelfKw": (), | ||
534 | "Param": ( | 539 | "Param": ( |
535 | options: [ "Pat", "TypeRef" ], | 540 | options: [ "Pat", "TypeRef" ], |
536 | ), | 541 | ), |
diff --git a/crates/ra_syntax/src/grammar/items.rs b/crates/ra_syntax/src/grammar/items.rs index aa5fe0777..265e84570 100644 --- a/crates/ra_syntax/src/grammar/items.rs +++ b/crates/ra_syntax/src/grammar/items.rs | |||
@@ -151,8 +151,8 @@ pub(super) fn maybe_item(p: &mut Parser, flavor: ItemFlavor) -> MaybeItem { | |||
151 | // test unsafe_default_impl | 151 | // test unsafe_default_impl |
152 | // unsafe default impl Foo {} | 152 | // unsafe default impl Foo {} |
153 | IMPL_KW => { | 153 | IMPL_KW => { |
154 | traits::impl_item(p); | 154 | traits::impl_block(p); |
155 | IMPL_ITEM | 155 | IMPL_BLOCK |
156 | } | 156 | } |
157 | _ => { | 157 | _ => { |
158 | return if has_mods { | 158 | return if has_mods { |
diff --git a/crates/ra_syntax/src/grammar/items/traits.rs b/crates/ra_syntax/src/grammar/items/traits.rs index d4da8b2f7..0a0621753 100644 --- a/crates/ra_syntax/src/grammar/items/traits.rs +++ b/crates/ra_syntax/src/grammar/items/traits.rs | |||
@@ -40,9 +40,9 @@ pub(crate) fn trait_item_list(p: &mut Parser) { | |||
40 | m.complete(p, ITEM_LIST); | 40 | m.complete(p, ITEM_LIST); |
41 | } | 41 | } |
42 | 42 | ||
43 | // test impl_item | 43 | // test impl_block |
44 | // impl Foo {} | 44 | // impl Foo {} |
45 | pub(super) fn impl_item(p: &mut Parser) { | 45 | pub(super) fn impl_block(p: &mut Parser) { |
46 | assert!(p.at(IMPL_KW)); | 46 | assert!(p.at(IMPL_KW)); |
47 | p.bump(); | 47 | p.bump(); |
48 | if choose_type_params_over_qpath(p) { | 48 | if choose_type_params_over_qpath(p) { |
@@ -52,7 +52,7 @@ pub(super) fn impl_item(p: &mut Parser) { | |||
52 | // TODO: never type | 52 | // TODO: never type |
53 | // impl ! {} | 53 | // impl ! {} |
54 | 54 | ||
55 | // test impl_item_neg | 55 | // test impl_block_neg |
56 | // impl !Send for X {} | 56 | // impl !Send for X {} |
57 | p.eat(EXCL); | 57 | p.eat(EXCL); |
58 | impl_type(p); | 58 | impl_type(p); |
diff --git a/crates/ra_syntax/src/reparsing.rs b/crates/ra_syntax/src/reparsing.rs index 208cae5c8..7ee71a1b6 100644 --- a/crates/ra_syntax/src/reparsing.rs +++ b/crates/ra_syntax/src/reparsing.rs | |||
@@ -100,7 +100,7 @@ fn find_reparsable_node( | |||
100 | ITEM_LIST => { | 100 | ITEM_LIST => { |
101 | let parent = node.parent().unwrap(); | 101 | let parent = node.parent().unwrap(); |
102 | match parent.kind() { | 102 | match parent.kind() { |
103 | IMPL_ITEM => grammar::impl_item_list, | 103 | IMPL_BLOCK => grammar::impl_item_list, |
104 | TRAIT_DEF => grammar::trait_item_list, | 104 | TRAIT_DEF => grammar::trait_item_list, |
105 | MODULE => grammar::mod_item_list, | 105 | MODULE => grammar::mod_item_list, |
106 | _ => return None, | 106 | _ => return None, |
diff --git a/crates/ra_syntax/src/syntax_kinds/generated.rs b/crates/ra_syntax/src/syntax_kinds/generated.rs index 3a869ad34..ef4588d93 100644 --- a/crates/ra_syntax/src/syntax_kinds/generated.rs +++ b/crates/ra_syntax/src/syntax_kinds/generated.rs | |||
@@ -128,7 +128,7 @@ pub enum SyntaxKind { | |||
128 | STATIC_DEF, | 128 | STATIC_DEF, |
129 | CONST_DEF, | 129 | CONST_DEF, |
130 | TRAIT_DEF, | 130 | TRAIT_DEF, |
131 | IMPL_ITEM, | 131 | IMPL_BLOCK, |
132 | TYPE_DEF, | 132 | TYPE_DEF, |
133 | MACRO_CALL, | 133 | MACRO_CALL, |
134 | TOKEN_TREE, | 134 | TOKEN_TREE, |
@@ -389,7 +389,7 @@ impl SyntaxKind { | |||
389 | STATIC_DEF => &SyntaxInfo { name: "STATIC_DEF" }, | 389 | STATIC_DEF => &SyntaxInfo { name: "STATIC_DEF" }, |
390 | CONST_DEF => &SyntaxInfo { name: "CONST_DEF" }, | 390 | CONST_DEF => &SyntaxInfo { name: "CONST_DEF" }, |
391 | TRAIT_DEF => &SyntaxInfo { name: "TRAIT_DEF" }, | 391 | TRAIT_DEF => &SyntaxInfo { name: "TRAIT_DEF" }, |
392 | IMPL_ITEM => &SyntaxInfo { name: "IMPL_ITEM" }, | 392 | IMPL_BLOCK => &SyntaxInfo { name: "IMPL_BLOCK" }, |
393 | TYPE_DEF => &SyntaxInfo { name: "TYPE_DEF" }, | 393 | TYPE_DEF => &SyntaxInfo { name: "TYPE_DEF" }, |
394 | MACRO_CALL => &SyntaxInfo { name: "MACRO_CALL" }, | 394 | MACRO_CALL => &SyntaxInfo { name: "MACRO_CALL" }, |
395 | TOKEN_TREE => &SyntaxInfo { name: "TOKEN_TREE" }, | 395 | TOKEN_TREE => &SyntaxInfo { name: "TOKEN_TREE" }, |
diff --git a/crates/ra_syntax/tests/data/parser/err/0018_incomplete_fn.txt b/crates/ra_syntax/tests/data/parser/err/0018_incomplete_fn.txt index 3937be255..262cbba1e 100644 --- a/crates/ra_syntax/tests/data/parser/err/0018_incomplete_fn.txt +++ b/crates/ra_syntax/tests/data/parser/err/0018_incomplete_fn.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 183) | 1 | SOURCE_FILE@[0; 183) |
2 | IMPL_ITEM@[0; 182) | 2 | IMPL_BLOCK@[0; 182) |
3 | IMPL_KW@[0; 4) | 3 | IMPL_KW@[0; 4) |
4 | WHITESPACE@[4; 5) | 4 | WHITESPACE@[4; 5) |
5 | PATH_TYPE@[5; 13) | 5 | PATH_TYPE@[5; 13) |
diff --git a/crates/ra_syntax/tests/data/parser/err/0022_bad_exprs.txt b/crates/ra_syntax/tests/data/parser/err/0022_bad_exprs.txt index 55999c160..da3894133 100644 --- a/crates/ra_syntax/tests/data/parser/err/0022_bad_exprs.txt +++ b/crates/ra_syntax/tests/data/parser/err/0022_bad_exprs.txt | |||
@@ -94,7 +94,7 @@ SOURCE_FILE@[0; 112) | |||
94 | COMMA@[54; 55) | 94 | COMMA@[54; 55) |
95 | err: `expected SEMI` | 95 | err: `expected SEMI` |
96 | WHITESPACE@[55; 56) | 96 | WHITESPACE@[55; 56) |
97 | IMPL_ITEM@[56; 60) | 97 | IMPL_BLOCK@[56; 60) |
98 | IMPL_KW@[56; 60) | 98 | IMPL_KW@[56; 60) |
99 | err: `expected type` | 99 | err: `expected type` |
100 | err: `expected `{`` | 100 | err: `expected `{`` |
diff --git a/crates/ra_syntax/tests/data/parser/err/0026_imp_recovery.txt b/crates/ra_syntax/tests/data/parser/err/0026_imp_recovery.txt index 82683f6ee..9b5fadcf7 100644 --- a/crates/ra_syntax/tests/data/parser/err/0026_imp_recovery.txt +++ b/crates/ra_syntax/tests/data/parser/err/0026_imp_recovery.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 38) | 1 | SOURCE_FILE@[0; 38) |
2 | IMPL_ITEM@[0; 14) | 2 | IMPL_BLOCK@[0; 14) |
3 | IMPL_KW@[0; 4) | 3 | IMPL_KW@[0; 4) |
4 | TYPE_PARAM_LIST@[4; 14) | 4 | TYPE_PARAM_LIST@[4; 14) |
5 | L_ANGLE@[4; 5) | 5 | L_ANGLE@[4; 5) |
@@ -17,7 +17,7 @@ SOURCE_FILE@[0; 38) | |||
17 | err: `expected trait or type` | 17 | err: `expected trait or type` |
18 | err: `expected `{`` | 18 | err: `expected `{`` |
19 | WHITESPACE@[14; 15) | 19 | WHITESPACE@[14; 15) |
20 | IMPL_ITEM@[15; 37) | 20 | IMPL_BLOCK@[15; 37) |
21 | IMPL_KW@[15; 19) | 21 | IMPL_KW@[15; 19) |
22 | TYPE_PARAM_LIST@[19; 22) | 22 | TYPE_PARAM_LIST@[19; 22) |
23 | L_ANGLE@[19; 20) | 23 | L_ANGLE@[19; 20) |
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0002_misplaced_label_err.txt b/crates/ra_syntax/tests/data/parser/inline/err/0002_misplaced_label_err.txt index 75533ecc1..8021aee00 100644 --- a/crates/ra_syntax/tests/data/parser/inline/err/0002_misplaced_label_err.txt +++ b/crates/ra_syntax/tests/data/parser/inline/err/0002_misplaced_label_err.txt | |||
@@ -19,7 +19,7 @@ SOURCE_FILE@[0; 30) | |||
19 | err: `expected a loop` | 19 | err: `expected a loop` |
20 | err: `expected SEMI` | 20 | err: `expected SEMI` |
21 | WHITESPACE@[22; 23) | 21 | WHITESPACE@[22; 23) |
22 | IMPL_ITEM@[23; 27) | 22 | IMPL_BLOCK@[23; 27) |
23 | IMPL_KW@[23; 27) | 23 | IMPL_KW@[23; 27) |
24 | err: `expected type` | 24 | err: `expected type` |
25 | err: `expected `{`` | 25 | err: `expected `{`` |
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0004_impl_type.txt b/crates/ra_syntax/tests/data/parser/inline/err/0004_impl_type.txt index 7279d5cae..6875ed016 100644 --- a/crates/ra_syntax/tests/data/parser/inline/err/0004_impl_type.txt +++ b/crates/ra_syntax/tests/data/parser/inline/err/0004_impl_type.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 87) | 1 | SOURCE_FILE@[0; 87) |
2 | IMPL_ITEM@[0; 12) | 2 | IMPL_BLOCK@[0; 12) |
3 | IMPL_KW@[0; 4) | 3 | IMPL_KW@[0; 4) |
4 | WHITESPACE@[4; 5) | 4 | WHITESPACE@[4; 5) |
5 | PATH_TYPE@[5; 9) | 5 | PATH_TYPE@[5; 9) |
@@ -12,7 +12,7 @@ SOURCE_FILE@[0; 87) | |||
12 | L_CURLY@[10; 11) | 12 | L_CURLY@[10; 11) |
13 | R_CURLY@[11; 12) | 13 | R_CURLY@[11; 12) |
14 | WHITESPACE@[12; 13) | 14 | WHITESPACE@[12; 13) |
15 | IMPL_ITEM@[13; 33) | 15 | IMPL_BLOCK@[13; 33) |
16 | IMPL_KW@[13; 17) | 16 | IMPL_KW@[13; 17) |
17 | WHITESPACE@[17; 18) | 17 | WHITESPACE@[17; 18) |
18 | PATH_TYPE@[18; 24) | 18 | PATH_TYPE@[18; 24) |
@@ -33,12 +33,12 @@ SOURCE_FILE@[0; 87) | |||
33 | L_CURLY@[31; 32) | 33 | L_CURLY@[31; 32) |
34 | R_CURLY@[32; 33) | 34 | R_CURLY@[32; 33) |
35 | WHITESPACE@[33; 34) | 35 | WHITESPACE@[33; 34) |
36 | IMPL_ITEM@[34; 38) | 36 | IMPL_BLOCK@[34; 38) |
37 | IMPL_KW@[34; 38) | 37 | IMPL_KW@[34; 38) |
38 | err: `expected trait or type` | 38 | err: `expected trait or type` |
39 | err: `expected `{`` | 39 | err: `expected `{`` |
40 | WHITESPACE@[38; 39) | 40 | WHITESPACE@[38; 39) |
41 | IMPL_ITEM@[39; 54) | 41 | IMPL_BLOCK@[39; 54) |
42 | IMPL_KW@[39; 43) | 42 | IMPL_KW@[39; 43) |
43 | WHITESPACE@[43; 44) | 43 | WHITESPACE@[43; 44) |
44 | PATH_TYPE@[44; 51) | 44 | PATH_TYPE@[44; 51) |
@@ -51,7 +51,7 @@ SOURCE_FILE@[0; 87) | |||
51 | L_CURLY@[52; 53) | 51 | L_CURLY@[52; 53) |
52 | R_CURLY@[53; 54) | 52 | R_CURLY@[53; 54) |
53 | WHITESPACE@[54; 55) | 53 | WHITESPACE@[54; 55) |
54 | IMPL_ITEM@[55; 70) | 54 | IMPL_BLOCK@[55; 70) |
55 | IMPL_KW@[55; 59) | 55 | IMPL_KW@[55; 59) |
56 | WHITESPACE@[59; 60) | 56 | WHITESPACE@[59; 60) |
57 | PATH_TYPE@[60; 66) | 57 | PATH_TYPE@[60; 66) |
@@ -64,7 +64,7 @@ SOURCE_FILE@[0; 87) | |||
64 | err: `expected trait or type` | 64 | err: `expected trait or type` |
65 | err: `expected `{`` | 65 | err: `expected `{`` |
66 | WHITESPACE@[70; 71) | 66 | WHITESPACE@[70; 71) |
67 | IMPL_ITEM@[71; 86) | 67 | IMPL_BLOCK@[71; 86) |
68 | IMPL_KW@[71; 75) | 68 | IMPL_KW@[71; 75) |
69 | WHITESPACE@[75; 76) | 69 | WHITESPACE@[75; 76) |
70 | PATH_TYPE@[76; 83) | 70 | PATH_TYPE@[76; 83) |
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0001_trait_item_list.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0001_trait_item_list.txt index 998ac3da9..de7df7312 100644 --- a/crates/ra_syntax/tests/data/parser/inline/ok/0001_trait_item_list.txt +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0001_trait_item_list.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 83) | 1 | SOURCE_FILE@[0; 83) |
2 | IMPL_ITEM@[0; 82) | 2 | IMPL_BLOCK@[0; 82) |
3 | IMPL_KW@[0; 4) | 3 | IMPL_KW@[0; 4) |
4 | WHITESPACE@[4; 5) | 4 | WHITESPACE@[4; 5) |
5 | PATH_TYPE@[5; 6) | 5 | PATH_TYPE@[5; 6) |
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0006_self_param.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0006_self_param.txt index 53027c852..4df01c6e5 100644 --- a/crates/ra_syntax/tests/data/parser/inline/ok/0006_self_param.txt +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0006_self_param.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 128) | 1 | SOURCE_FILE@[0; 128) |
2 | IMPL_ITEM@[0; 127) | 2 | IMPL_BLOCK@[0; 127) |
3 | IMPL_KW@[0; 4) | 3 | IMPL_KW@[0; 4) |
4 | WHITESPACE@[4; 5) | 4 | WHITESPACE@[4; 5) |
5 | PATH_TYPE@[5; 6) | 5 | PATH_TYPE@[5; 6) |
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0018_arb_self_types.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0018_arb_self_types.txt index b2f04ea7b..03139f7a4 100644 --- a/crates/ra_syntax/tests/data/parser/inline/ok/0018_arb_self_types.txt +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0018_arb_self_types.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 69) | 1 | SOURCE_FILE@[0; 69) |
2 | IMPL_ITEM@[0; 68) | 2 | IMPL_BLOCK@[0; 68) |
3 | IMPL_KW@[0; 4) | 3 | IMPL_KW@[0; 4) |
4 | WHITESPACE@[4; 5) | 4 | WHITESPACE@[4; 5) |
5 | PATH_TYPE@[5; 6) | 5 | PATH_TYPE@[5; 6) |
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0021_impl_item_list.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0021_impl_item_list.txt index b15f93cd2..50426bdfe 100644 --- a/crates/ra_syntax/tests/data/parser/inline/ok/0021_impl_item_list.txt +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0021_impl_item_list.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 89) | 1 | SOURCE_FILE@[0; 89) |
2 | IMPL_ITEM@[0; 88) | 2 | IMPL_BLOCK@[0; 88) |
3 | IMPL_KW@[0; 4) | 3 | IMPL_KW@[0; 4) |
4 | WHITESPACE@[4; 5) | 4 | WHITESPACE@[4; 5) |
5 | PATH_TYPE@[5; 6) | 5 | PATH_TYPE@[5; 6) |
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0047_unsafe_default_impl.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0047_unsafe_default_impl.txt index 6003ba645..5d68e88d6 100644 --- a/crates/ra_syntax/tests/data/parser/inline/ok/0047_unsafe_default_impl.txt +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0047_unsafe_default_impl.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 27) | 1 | SOURCE_FILE@[0; 27) |
2 | IMPL_ITEM@[0; 26) | 2 | IMPL_BLOCK@[0; 26) |
3 | UNSAFE_KW@[0; 6) | 3 | UNSAFE_KW@[0; 6) |
4 | WHITESPACE@[6; 7) | 4 | WHITESPACE@[6; 7) |
5 | DEFAULT_KW@[7; 14) | 5 | DEFAULT_KW@[7; 14) |
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0063_impl_item_neg.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0063_impl_block_neg.rs index b7527c870..b7527c870 100644 --- a/crates/ra_syntax/tests/data/parser/inline/ok/0063_impl_item_neg.rs +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0063_impl_block_neg.rs | |||
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0063_impl_item_neg.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0063_impl_block_neg.txt index b83db380e..563e43508 100644 --- a/crates/ra_syntax/tests/data/parser/inline/ok/0063_impl_item_neg.txt +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0063_impl_block_neg.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 20) | 1 | SOURCE_FILE@[0; 20) |
2 | IMPL_ITEM@[0; 19) | 2 | IMPL_BLOCK@[0; 19) |
3 | IMPL_KW@[0; 4) | 3 | IMPL_KW@[0; 4) |
4 | WHITESPACE@[4; 5) | 4 | WHITESPACE@[4; 5) |
5 | EXCL@[5; 6) | 5 | EXCL@[5; 6) |
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0079_impl_item.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0079_impl_block.rs index d6337f6b3..d6337f6b3 100644 --- a/crates/ra_syntax/tests/data/parser/inline/ok/0079_impl_item.rs +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0079_impl_block.rs | |||
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0079_impl_item.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0079_impl_block.txt index 1b9a8aa0e..a2c218aa9 100644 --- a/crates/ra_syntax/tests/data/parser/inline/ok/0079_impl_item.txt +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0079_impl_block.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 12) | 1 | SOURCE_FILE@[0; 12) |
2 | IMPL_ITEM@[0; 11) | 2 | IMPL_BLOCK@[0; 11) |
3 | IMPL_KW@[0; 4) | 3 | IMPL_KW@[0; 4) |
4 | WHITESPACE@[4; 5) | 4 | WHITESPACE@[4; 5) |
5 | PATH_TYPE@[5; 8) | 5 | PATH_TYPE@[5; 8) |
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0087_unsafe_impl.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0087_unsafe_impl.txt index f9c96c242..d93c0df4d 100644 --- a/crates/ra_syntax/tests/data/parser/inline/ok/0087_unsafe_impl.txt +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0087_unsafe_impl.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 19) | 1 | SOURCE_FILE@[0; 19) |
2 | IMPL_ITEM@[0; 18) | 2 | IMPL_BLOCK@[0; 18) |
3 | UNSAFE_KW@[0; 6) | 3 | UNSAFE_KW@[0; 6) |
4 | WHITESPACE@[6; 7) | 4 | WHITESPACE@[6; 7) |
5 | IMPL_KW@[7; 11) | 5 | IMPL_KW@[7; 11) |
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0097_default_impl.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0097_default_impl.txt index f45b6251f..0b9af800b 100644 --- a/crates/ra_syntax/tests/data/parser/inline/ok/0097_default_impl.txt +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0097_default_impl.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 20) | 1 | SOURCE_FILE@[0; 20) |
2 | IMPL_ITEM@[0; 19) | 2 | IMPL_BLOCK@[0; 19) |
3 | DEFAULT_KW@[0; 7) | 3 | DEFAULT_KW@[0; 7) |
4 | WHITESPACE@[7; 8) | 4 | WHITESPACE@[7; 8) |
5 | IMPL_KW@[8; 12) | 5 | IMPL_KW@[8; 12) |
diff --git a/crates/ra_syntax/tests/data/parser/ok/0037_mod.txt b/crates/ra_syntax/tests/data/parser/ok/0037_mod.txt index e11c4a06d..f8a20ac53 100644 --- a/crates/ra_syntax/tests/data/parser/ok/0037_mod.txt +++ b/crates/ra_syntax/tests/data/parser/ok/0037_mod.txt | |||
@@ -14,4 +14,3 @@ SOURCE_FILE@[0; 93) | |||
14 | ITEM_LIST@[91; 93) | 14 | ITEM_LIST@[91; 93) |
15 | L_CURLY@[91; 92) | 15 | L_CURLY@[91; 92) |
16 | R_CURLY@[92; 93) | 16 | R_CURLY@[92; 93) |
17 | |||