More symbols

This commit is contained in:
Aleksey Kladov 2018-08-11 16:20:37 +03:00
parent fe1fe866f3
commit 56aa6e20e0
7 changed files with 42 additions and 22 deletions

View file

@ -180,3 +180,22 @@ impl<R: TreeRoot> AstNode<R> for Trait<R> {
impl<R: TreeRoot> ast::NameOwner<R> for Trait<R> {}
impl<R: TreeRoot> Trait<R> {}
// TypeItem
#[derive(Debug, Clone, Copy)]
pub struct TypeItem<R: TreeRoot = Arc<SyntaxRoot>> {
syntax: SyntaxNode<R>,
}
impl<R: TreeRoot> AstNode<R> for TypeItem<R> {
fn cast(syntax: SyntaxNode<R>) -> Option<Self> {
match syntax.kind() {
TYPE_ITEM => Some(TypeItem { syntax }),
_ => None,
}
}
fn syntax(&self) -> &SyntaxNode<R> { &self.syntax }
}
impl<R: TreeRoot> ast::NameOwner<R> for TypeItem<R> {}
impl<R: TreeRoot> TypeItem<R> {}

View file

@ -219,27 +219,14 @@ Grammar(
["functions", "Function"]
]
),
"Function": (
traits: ["NameOwner"]
),
"Struct": (
traits: ["NameOwner"]
),
"Enum": (
traits: ["NameOwner"]
),
"Trait": (
traits: ["NameOwner"]
),
"Module": (
traits: ["NameOwner"]
),
"ConstItem": (
traits: ["NameOwner"]
),
"StaticItem": (
traits: ["NameOwner"]
),
"Function": ( traits: ["NameOwner"] ),
"Struct": ( traits: ["NameOwner"] ),
"Enum": ( traits: ["NameOwner"] ),
"Trait": ( traits: ["NameOwner"] ),
"Module": ( traits: ["NameOwner"] ),
"ConstItem": ( traits: ["NameOwner"] ),
"StaticItem": ( traits: ["NameOwner"] ),
"TypeItem": ( traits: ["NameOwner"] ),
"Name": (),
},
)