From d61932ef7e74f3d9f7863c33c6647c2c52538ed5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 9 Apr 2020 16:17:18 +0200 Subject: Prepare for spliting generated into tokens and nodes --- crates/ra_syntax/src/ast/generated.rs | 9626 +-------------------------------- 1 file changed, 2 insertions(+), 9624 deletions(-) (limited to 'crates/ra_syntax/src/ast/generated.rs') diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index bd92e9c87..6216641d8 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs @@ -1,9625 +1,3 @@ -//! Generated file, do not edit by hand, see `xtask/src/codegen` +//! This file is actually hand-written, but the submodules are indeed generated. -#[allow(unused_imports)] -use crate::{ - ast::{self, support, AstChildren, AstNode, AstToken}, - NodeOrToken, SyntaxElement, - SyntaxKind::{self, *}, - SyntaxNode, SyntaxToken, -}; -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Semi { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Semi { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Semi { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - SEMI => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Comma { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Comma { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Comma { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - COMMA => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct LParen { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for LParen { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for LParen { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - L_PAREN => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RParen { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for RParen { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for RParen { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - R_PAREN => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct LCurly { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for LCurly { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for LCurly { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - L_CURLY => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RCurly { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for RCurly { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for RCurly { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - R_CURLY => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct LBrack { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for LBrack { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for LBrack { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - L_BRACK => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RBrack { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for RBrack { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for RBrack { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - R_BRACK => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct LAngle { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for LAngle { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for LAngle { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - L_ANGLE => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RAngle { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for RAngle { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for RAngle { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - R_ANGLE => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct At { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for At { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for At { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - AT => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Pound { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Pound { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Pound { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - POUND => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Tilde { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Tilde { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Tilde { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - TILDE => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Question { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Question { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Question { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - QUESTION => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Dollar { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Dollar { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Dollar { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - DOLLAR => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Amp { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Amp { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Amp { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - AMP => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Pipe { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Pipe { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Pipe { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - PIPE => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Plus { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Plus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Plus { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - PLUS => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Star { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Star { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Star { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - STAR => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Slash { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Slash { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Slash { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - SLASH => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Caret { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Caret { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Caret { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - CARET => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Percent { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Percent { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Percent { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - PERCENT => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Underscore { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Underscore { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Underscore { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - UNDERSCORE => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Dot { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Dot { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Dot { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - DOT => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Dotdot { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Dotdot { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Dotdot { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - DOTDOT => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Dotdotdot { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Dotdotdot { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Dotdotdot { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - DOTDOTDOT => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Dotdoteq { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Dotdoteq { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Dotdoteq { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - DOTDOTEQ => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Colon { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Colon { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Colon { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - COLON => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Coloncolon { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Coloncolon { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Coloncolon { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - COLONCOLON => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Eq { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Eq { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Eq { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - EQ => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Eqeq { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Eqeq { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Eqeq { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - EQEQ => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct FatArrow { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for FatArrow { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for FatArrow { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - FAT_ARROW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Excl { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Excl { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Excl { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - EXCL => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Neq { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Neq { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Neq { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - NEQ => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Minus { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Minus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Minus { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - MINUS => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ThinArrow { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for ThinArrow { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for ThinArrow { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - THIN_ARROW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Lteq { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Lteq { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Lteq { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - LTEQ => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Gteq { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Gteq { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Gteq { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - GTEQ => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Pluseq { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Pluseq { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Pluseq { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - PLUSEQ => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Minuseq { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Minuseq { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Minuseq { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - MINUSEQ => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Pipeeq { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Pipeeq { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Pipeeq { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - PIPEEQ => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Ampeq { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Ampeq { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Ampeq { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - AMPEQ => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Careteq { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Careteq { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Careteq { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - CARETEQ => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Slasheq { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Slasheq { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Slasheq { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - SLASHEQ => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Stareq { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Stareq { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Stareq { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - STAREQ => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Percenteq { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Percenteq { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Percenteq { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - PERCENTEQ => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Ampamp { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Ampamp { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Ampamp { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - AMPAMP => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Pipepipe { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Pipepipe { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Pipepipe { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - PIPEPIPE => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Shl { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Shl { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Shl { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - SHL => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Shr { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Shr { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Shr { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - SHR => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Shleq { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Shleq { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Shleq { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - SHLEQ => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Shreq { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Shreq { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Shreq { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - SHREQ => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct AsKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for AsKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for AsKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - AS_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct AsyncKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for AsyncKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for AsyncKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - ASYNC_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct AwaitKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for AwaitKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for AwaitKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - AWAIT_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct BoxKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for BoxKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for BoxKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - BOX_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct BreakKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for BreakKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for BreakKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - BREAK_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ConstKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for ConstKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for ConstKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - CONST_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ContinueKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for ContinueKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for ContinueKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - CONTINUE_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct CrateKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for CrateKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for CrateKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - CRATE_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct DynKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for DynKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for DynKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - DYN_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ElseKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for ElseKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for ElseKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - ELSE_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct EnumKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for EnumKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for EnumKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - ENUM_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ExternKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for ExternKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for ExternKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - EXTERN_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct FalseKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for FalseKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for FalseKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - FALSE_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct FnKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for FnKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for FnKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - FN_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ForKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for ForKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for ForKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - FOR_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct IfKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for IfKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for IfKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - IF_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ImplKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for ImplKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for ImplKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - IMPL_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct InKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for InKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for InKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - IN_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct LetKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for LetKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for LetKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - LET_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct LoopKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for LoopKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for LoopKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - LOOP_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MacroKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for MacroKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for MacroKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - MACRO_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MatchKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for MatchKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for MatchKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - MATCH_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ModKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for ModKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for ModKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - MOD_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MoveKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for MoveKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for MoveKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - MOVE_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MutKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for MutKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for MutKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - MUT_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct PubKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for PubKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for PubKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - PUB_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RefKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for RefKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for RefKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - REF_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ReturnKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for ReturnKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for ReturnKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - RETURN_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct SelfKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for SelfKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for SelfKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - SELF_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct StaticKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for StaticKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for StaticKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - STATIC_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct StructKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for StructKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for StructKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - STRUCT_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct SuperKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for SuperKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for SuperKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - SUPER_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TraitKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for TraitKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for TraitKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - TRAIT_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TrueKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for TrueKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for TrueKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - TRUE_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TryKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for TryKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for TryKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - TRY_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TypeKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for TypeKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for TypeKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - TYPE_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct UnsafeKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for UnsafeKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for UnsafeKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - UNSAFE_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct UseKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for UseKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for UseKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - USE_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct WhereKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for WhereKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for WhereKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - WHERE_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct WhileKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for WhileKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for WhileKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - WHILE_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct AutoKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for AutoKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for AutoKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - AUTO_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct DefaultKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for DefaultKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for DefaultKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - DEFAULT_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ExistentialKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for ExistentialKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for ExistentialKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - EXISTENTIAL_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct UnionKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for UnionKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for UnionKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - UNION_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RawKw { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for RawKw { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for RawKw { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - RAW_KW => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct IntNumber { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for IntNumber { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for IntNumber { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - INT_NUMBER => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct FloatNumber { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for FloatNumber { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for FloatNumber { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - FLOAT_NUMBER => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Char { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Char { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Char { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - CHAR => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Byte { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Byte { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Byte { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - BYTE => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct String { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for String { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for String { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - STRING => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RawString { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for RawString { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for RawString { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - RAW_STRING => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ByteString { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for ByteString { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for ByteString { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - BYTE_STRING => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RawByteString { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for RawByteString { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for RawByteString { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - RAW_BYTE_STRING => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Error { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Error { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Error { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - ERROR => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Ident { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Ident { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Ident { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - IDENT => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Whitespace { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Whitespace { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Whitespace { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - WHITESPACE => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Lifetime { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Lifetime { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Lifetime { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - LIFETIME => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Comment { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Comment { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Comment { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - COMMENT => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Shebang { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for Shebang { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for Shebang { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - SHEBANG => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct LDollar { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for LDollar { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for LDollar { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - L_DOLLAR => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RDollar { - pub(crate) syntax: SyntaxToken, -} -impl std::fmt::Display for RDollar { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(&self.syntax, f) - } -} -impl AstToken for RDollar { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - R_DOLLAR => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxToken { - &self.syntax - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct SourceFile { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for SourceFile { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for SourceFile { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - SOURCE_FILE => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::ModuleItemOwner for SourceFile {} -impl ast::FnDefOwner for SourceFile {} -impl ast::AttrsOwner for SourceFile {} -impl SourceFile { - pub fn modules(&self) -> AstChildren { - support::children(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct FnDef { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for FnDef { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for FnDef { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - FN_DEF => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::VisibilityOwner for FnDef {} -impl ast::NameOwner for FnDef {} -impl ast::TypeParamsOwner for FnDef {} -impl ast::DocCommentsOwner for FnDef {} -impl ast::AttrsOwner for FnDef {} -impl FnDef { - pub fn abi(&self) -> Option { - support::child(&self.syntax) - } - pub fn const_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn default_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn async_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn unsafe_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn fn_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn param_list(&self) -> Option { - support::child(&self.syntax) - } - pub fn ret_type(&self) -> Option { - support::child(&self.syntax) - } - pub fn body(&self) -> Option { - support::child(&self.syntax) - } - pub fn semi(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RetType { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for RetType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for RetType { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - RET_TYPE => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl RetType { - pub fn thin_arrow(&self) -> Option { - support::token(&self.syntax) - } - pub fn type_ref(&self) -> Option { - support::child(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct StructDef { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for StructDef { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for StructDef { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - STRUCT_DEF => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::VisibilityOwner for StructDef {} -impl ast::NameOwner for StructDef {} -impl ast::TypeParamsOwner for StructDef {} -impl ast::AttrsOwner for StructDef {} -impl ast::DocCommentsOwner for StructDef {} -impl StructDef { - pub fn struct_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn field_def_list(&self) -> Option { - support::child(&self.syntax) - } - pub fn semi(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct UnionDef { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for UnionDef { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for UnionDef { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - UNION_DEF => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::VisibilityOwner for UnionDef {} -impl ast::NameOwner for UnionDef {} -impl ast::TypeParamsOwner for UnionDef {} -impl ast::AttrsOwner for UnionDef {} -impl ast::DocCommentsOwner for UnionDef {} -impl UnionDef { - pub fn union_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn record_field_def_list(&self) -> Option { - support::child(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RecordFieldDefList { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for RecordFieldDefList { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for RecordFieldDefList { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - RECORD_FIELD_DEF_LIST => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl RecordFieldDefList { - pub fn l_curly(&self) -> Option { - support::token(&self.syntax) - } - pub fn fields(&self) -> AstChildren { - support::children(&self.syntax) - } - pub fn r_curly(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RecordFieldDef { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for RecordFieldDef { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for RecordFieldDef { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - RECORD_FIELD_DEF => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::VisibilityOwner for RecordFieldDef {} -impl ast::NameOwner for RecordFieldDef {} -impl ast::AttrsOwner for RecordFieldDef {} -impl ast::DocCommentsOwner for RecordFieldDef {} -impl ast::TypeAscriptionOwner for RecordFieldDef {} -impl RecordFieldDef {} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TupleFieldDefList { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for TupleFieldDefList { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for TupleFieldDefList { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - TUPLE_FIELD_DEF_LIST => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl TupleFieldDefList { - pub fn l_paren(&self) -> Option { - support::token(&self.syntax) - } - pub fn fields(&self) -> AstChildren { - support::children(&self.syntax) - } - pub fn r_paren(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TupleFieldDef { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for TupleFieldDef { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for TupleFieldDef { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - TUPLE_FIELD_DEF => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::VisibilityOwner for TupleFieldDef {} -impl ast::AttrsOwner for TupleFieldDef {} -impl TupleFieldDef { - pub fn type_ref(&self) -> Option { - support::child(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct EnumDef { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for EnumDef { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for EnumDef { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - ENUM_DEF => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::VisibilityOwner for EnumDef {} -impl ast::NameOwner for EnumDef {} -impl ast::TypeParamsOwner for EnumDef {} -impl ast::AttrsOwner for EnumDef {} -impl ast::DocCommentsOwner for EnumDef {} -impl EnumDef { - pub fn enum_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn variant_list(&self) -> Option { - support::child(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct EnumVariantList { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for EnumVariantList { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for EnumVariantList { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - ENUM_VARIANT_LIST => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl EnumVariantList { - pub fn l_curly(&self) -> Option { - support::token(&self.syntax) - } - pub fn variants(&self) -> AstChildren { - support::children(&self.syntax) - } - pub fn r_curly(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct EnumVariant { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for EnumVariant { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for EnumVariant { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - ENUM_VARIANT => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::VisibilityOwner for EnumVariant {} -impl ast::NameOwner for EnumVariant {} -impl ast::DocCommentsOwner for EnumVariant {} -impl ast::AttrsOwner for EnumVariant {} -impl EnumVariant { - pub fn field_def_list(&self) -> Option { - support::child(&self.syntax) - } - pub fn eq(&self) -> Option { - support::token(&self.syntax) - } - pub fn expr(&self) -> Option { - support::child(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TraitDef { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for TraitDef { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for TraitDef { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - TRAIT_DEF => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::VisibilityOwner for TraitDef {} -impl ast::NameOwner for TraitDef {} -impl ast::AttrsOwner for TraitDef {} -impl ast::DocCommentsOwner for TraitDef {} -impl ast::TypeParamsOwner for TraitDef {} -impl ast::TypeBoundsOwner for TraitDef {} -impl TraitDef { - pub fn unsafe_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn auto_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn trait_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn item_list(&self) -> Option { - support::child(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Module { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for Module { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for Module { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - MODULE => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::VisibilityOwner for Module {} -impl ast::NameOwner for Module {} -impl ast::AttrsOwner for Module {} -impl ast::DocCommentsOwner for Module {} -impl Module { - pub fn mod_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn item_list(&self) -> Option { - support::child(&self.syntax) - } - pub fn semi(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ItemList { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for ItemList { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for ItemList { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - ITEM_LIST => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::FnDefOwner for ItemList {} -impl ast::ModuleItemOwner for ItemList {} -impl ItemList { - pub fn l_curly(&self) -> Option { - support::token(&self.syntax) - } - pub fn impl_items(&self) -> AstChildren { - support::children(&self.syntax) - } - pub fn r_curly(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ConstDef { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for ConstDef { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for ConstDef { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - CONST_DEF => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::VisibilityOwner for ConstDef {} -impl ast::NameOwner for ConstDef {} -impl ast::TypeParamsOwner for ConstDef {} -impl ast::AttrsOwner for ConstDef {} -impl ast::DocCommentsOwner for ConstDef {} -impl ast::TypeAscriptionOwner for ConstDef {} -impl ConstDef { - pub fn default_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn const_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn eq(&self) -> Option { - support::token(&self.syntax) - } - pub fn body(&self) -> Option { - support::child(&self.syntax) - } - pub fn semi(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct StaticDef { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for StaticDef { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for StaticDef { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - STATIC_DEF => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::VisibilityOwner for StaticDef {} -impl ast::NameOwner for StaticDef {} -impl ast::TypeParamsOwner for StaticDef {} -impl ast::AttrsOwner for StaticDef {} -impl ast::DocCommentsOwner for StaticDef {} -impl ast::TypeAscriptionOwner for StaticDef {} -impl StaticDef { - pub fn static_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn mut_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn eq(&self) -> Option { - support::token(&self.syntax) - } - pub fn body(&self) -> Option { - support::child(&self.syntax) - } - pub fn semi(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TypeAliasDef { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for TypeAliasDef { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for TypeAliasDef { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - TYPE_ALIAS_DEF => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::VisibilityOwner for TypeAliasDef {} -impl ast::NameOwner for TypeAliasDef {} -impl ast::TypeParamsOwner for TypeAliasDef {} -impl ast::AttrsOwner for TypeAliasDef {} -impl ast::DocCommentsOwner for TypeAliasDef {} -impl ast::TypeBoundsOwner for TypeAliasDef {} -impl TypeAliasDef { - pub fn default_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn type_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn eq(&self) -> Option { - support::token(&self.syntax) - } - pub fn type_ref(&self) -> Option { - support::child(&self.syntax) - } - pub fn semi(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ImplDef { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for ImplDef { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for ImplDef { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - IMPL_DEF => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::TypeParamsOwner for ImplDef {} -impl ast::AttrsOwner for ImplDef {} -impl ImplDef { - pub fn default_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn const_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn unsafe_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn impl_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn excl(&self) -> Option { - support::token(&self.syntax) - } - pub fn for_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn item_list(&self) -> Option { - support::child(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ParenType { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for ParenType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for ParenType { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - PAREN_TYPE => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ParenType { - pub fn l_paren(&self) -> Option { - support::token(&self.syntax) - } - pub fn type_ref(&self) -> Option { - support::child(&self.syntax) - } - pub fn r_paren(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TupleType { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for TupleType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for TupleType { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - TUPLE_TYPE => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl TupleType { - pub fn l_paren(&self) -> Option { - support::token(&self.syntax) - } - pub fn fields(&self) -> AstChildren { - support::children(&self.syntax) - } - pub fn r_paren(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct NeverType { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for NeverType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for NeverType { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - NEVER_TYPE => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl NeverType { - pub fn excl(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct PathType { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for PathType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for PathType { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - PATH_TYPE => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl PathType { - pub fn path(&self) -> Option { - support::child(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct PointerType { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for PointerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for PointerType { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - POINTER_TYPE => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl PointerType { - pub fn star(&self) -> Option { - support::token(&self.syntax) - } - pub fn const_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn type_ref(&self) -> Option { - support::child(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ArrayType { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for ArrayType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for ArrayType { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - ARRAY_TYPE => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ArrayType { - pub fn l_brack(&self) -> Option { - support::token(&self.syntax) - } - pub fn type_ref(&self) -> Option { - support::child(&self.syntax) - } - pub fn semi(&self) -> Option { - support::token(&self.syntax) - } - pub fn expr(&self) -> Option { - support::child(&self.syntax) - } - pub fn r_brack(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct SliceType { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for SliceType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for SliceType { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - SLICE_TYPE => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl SliceType { - pub fn l_brack(&self) -> Option { - support::token(&self.syntax) - } - pub fn type_ref(&self) -> Option { - support::child(&self.syntax) - } - pub fn r_brack(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ReferenceType { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for ReferenceType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for ReferenceType { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - REFERENCE_TYPE => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ReferenceType { - pub fn amp(&self) -> Option { - support::token(&self.syntax) - } - pub fn lifetime(&self) -> Option { - support::token(&self.syntax) - } - pub fn mut_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn type_ref(&self) -> Option { - support::child(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct PlaceholderType { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for PlaceholderType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for PlaceholderType { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - PLACEHOLDER_TYPE => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl PlaceholderType { - pub fn underscore(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct FnPointerType { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for FnPointerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for FnPointerType { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - FN_POINTER_TYPE => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl FnPointerType { - pub fn abi(&self) -> Option { - support::child(&self.syntax) - } - pub fn unsafe_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn fn_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn param_list(&self) -> Option { - support::child(&self.syntax) - } - pub fn ret_type(&self) -> Option { - support::child(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ForType { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for ForType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for ForType { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - FOR_TYPE => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ForType { - pub fn for_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn type_param_list(&self) -> Option { - support::child(&self.syntax) - } - pub fn type_ref(&self) -> Option { - support::child(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ImplTraitType { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for ImplTraitType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for ImplTraitType { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - IMPL_TRAIT_TYPE => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::TypeBoundsOwner for ImplTraitType {} -impl ImplTraitType { - pub fn impl_kw(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct DynTraitType { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for DynTraitType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for DynTraitType { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - DYN_TRAIT_TYPE => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::TypeBoundsOwner for DynTraitType {} -impl DynTraitType { - pub fn dyn_kw(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TupleExpr { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for TupleExpr { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for TupleExpr { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - TUPLE_EXPR => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::AttrsOwner for TupleExpr {} -impl TupleExpr { - pub fn l_paren(&self) -> Option { - support::token(&self.syntax) - } - pub fn exprs(&self) -> AstChildren { - support::children(&self.syntax) - } - pub fn r_paren(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ArrayExpr { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for ArrayExpr { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for ArrayExpr { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - ARRAY_EXPR => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::AttrsOwner for ArrayExpr {} -impl ArrayExpr { - pub fn l_brack(&self) -> Option { - support::token(&self.syntax) - } - pub fn exprs(&self) -> AstChildren { - support::children(&self.syntax) - } - pub fn semi(&self) -> Option { - support::token(&self.syntax) - } - pub fn r_brack(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ParenExpr { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for ParenExpr { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for ParenExpr { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - PAREN_EXPR => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::AttrsOwner for ParenExpr {} -impl ParenExpr { - pub fn l_paren(&self) -> Option { - support::token(&self.syntax) - } - pub fn expr(&self) -> Option { - support::child(&self.syntax) - } - pub fn r_paren(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct PathExpr { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for PathExpr { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for PathExpr { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - PATH_EXPR => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl PathExpr { - pub fn path(&self) -> Option { - support::child(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct LambdaExpr { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for LambdaExpr { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for LambdaExpr { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - LAMBDA_EXPR => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::AttrsOwner for LambdaExpr {} -impl LambdaExpr { - pub fn static_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn async_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn move_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn param_list(&self) -> Option { - support::child(&self.syntax) - } - pub fn ret_type(&self) -> Option { - support::child(&self.syntax) - } - pub fn body(&self) -> Option { - support::child(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct IfExpr { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for IfExpr { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for IfExpr { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - IF_EXPR => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::AttrsOwner for IfExpr {} -impl IfExpr { - pub fn if_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn condition(&self) -> Option { - support::child(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct LoopExpr { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for LoopExpr { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for LoopExpr { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - LOOP_EXPR => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::AttrsOwner for LoopExpr {} -impl ast::LoopBodyOwner for LoopExpr {} -impl LoopExpr { - pub fn loop_kw(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TryBlockExpr { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for TryBlockExpr { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for TryBlockExpr { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - TRY_BLOCK_EXPR => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::AttrsOwner for TryBlockExpr {} -impl TryBlockExpr { - pub fn try_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn body(&self) -> Option { - support::child(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ForExpr { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for ForExpr { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for ForExpr { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - FOR_EXPR => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::AttrsOwner for ForExpr {} -impl ast::LoopBodyOwner for ForExpr {} -impl ForExpr { - pub fn for_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn pat(&self) -> Option { - support::child(&self.syntax) - } - pub fn in_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn iterable(&self) -> Option { - support::child(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct WhileExpr { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for WhileExpr { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for WhileExpr { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - WHILE_EXPR => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::AttrsOwner for WhileExpr {} -impl ast::LoopBodyOwner for WhileExpr {} -impl WhileExpr { - pub fn while_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn condition(&self) -> Option { - support::child(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ContinueExpr { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for ContinueExpr { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for ContinueExpr { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - CONTINUE_EXPR => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::AttrsOwner for ContinueExpr {} -impl ContinueExpr { - pub fn continue_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn lifetime(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct BreakExpr { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for BreakExpr { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for BreakExpr { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - BREAK_EXPR => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::AttrsOwner for BreakExpr {} -impl BreakExpr { - pub fn break_kw(&self) -> Option { - support::token(&self.syntax) - } - pub fn lifetime(&self) -> Option { - support::token(&self.syntax) - } - pub fn expr(&self) -> Option { - support::child(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Label { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for Label { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for Label { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - LABEL => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl Label { - pub fn lifetime(&self) -> Option { - support::token(&self.syntax) - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct BlockExpr { - pub(crate) syntax: SyntaxNode, -} -impl std::fmt::Display for BlockExpr { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstNode for BlockExpr { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - BLOCK_EXPR => true, - _ => false, - } - } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { - &self.syntax - } -} -impl ast::AttrsOwner for BlockExpr {} -impl BlockExpr { - pub fn label(&self) -> Option