From 1d6eef1350ee0793fcd2a0eb191cdb127b76a49d Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Fri, 11 Jun 2021 18:12:51 +0200 Subject: Update ungrammar --- crates/syntax/src/ast/generated/nodes.rs | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'crates/syntax/src/ast/generated/nodes.rs') diff --git a/crates/syntax/src/ast/generated/nodes.rs b/crates/syntax/src/ast/generated/nodes.rs index 9a88fdb56..702de59a9 100644 --- a/crates/syntax/src/ast/generated/nodes.rs +++ b/crates/syntax/src/ast/generated/nodes.rs @@ -150,10 +150,7 @@ impl Attr { pub fn pound_token(&self) -> Option { support::token(&self.syntax, T![#]) } pub fn excl_token(&self) -> Option { support::token(&self.syntax, T![!]) } pub fn l_brack_token(&self) -> Option { support::token(&self.syntax, T!['[']) } - pub fn path(&self) -> Option { support::child(&self.syntax) } - pub fn eq_token(&self) -> Option { support::token(&self.syntax, T![=]) } - pub fn expr(&self) -> Option { support::child(&self.syntax) } - pub fn token_tree(&self) -> Option { support::child(&self.syntax) } + pub fn meta(&self) -> Option { support::child(&self.syntax) } pub fn r_brack_token(&self) -> Option { support::token(&self.syntax, T![']']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -632,6 +629,16 @@ impl WherePred { pub fn ty(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct Meta { + pub(crate) syntax: SyntaxNode, +} +impl Meta { + pub fn path(&self) -> Option { support::child(&self.syntax) } + pub fn eq_token(&self) -> Option { support::token(&self.syntax, T![=]) } + pub fn expr(&self) -> Option { support::child(&self.syntax) } + pub fn token_tree(&self) -> Option { support::child(&self.syntax) } +} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ExprStmt { pub(crate) syntax: SyntaxNode, } @@ -2072,6 +2079,17 @@ impl AstNode for WherePred { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl AstNode for Meta { + fn can_cast(kind: SyntaxKind) -> bool { kind == META } + fn cast(syntax: SyntaxNode) -> Option { + if Self::can_cast(syntax.kind()) { + Some(Self { syntax }) + } else { + None + } + } + fn syntax(&self) -> &SyntaxNode { &self.syntax } +} impl AstNode for ExprStmt { fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT } fn cast(syntax: SyntaxNode) -> Option { @@ -3887,6 +3905,11 @@ impl std::fmt::Display for WherePred { std::fmt::Display::fmt(self.syntax(), f) } } +impl std::fmt::Display for Meta { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Display::fmt(self.syntax(), f) + } +} impl std::fmt::Display for ExprStmt { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) -- cgit v1.2.3