From 460c8bbdec8561a581d035f9767b7dd1ba36cfd7 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 10 Apr 2020 10:27:23 +0200 Subject: Curley tokens --- crates/ra_syntax/src/ast/generated/tokens.rs | 88 ---------------------------- 1 file changed, 88 deletions(-) (limited to 'crates/ra_syntax/src/ast/generated/tokens.rs') diff --git a/crates/ra_syntax/src/ast/generated/tokens.rs b/crates/ra_syntax/src/ast/generated/tokens.rs index 7344b0e49..4cbc1d793 100644 --- a/crates/ra_syntax/src/ast/generated/tokens.rs +++ b/crates/ra_syntax/src/ast/generated/tokens.rs @@ -1366,94 +1366,6 @@ impl AstToken for RDollar { fn syntax(&self) -> &SyntaxToken { &self.syntax } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum LeftDelimiter { - LParen(LParen), - LBrack(LBrack), - LCurly(LCurly), -} -impl From for LeftDelimiter { - fn from(node: LParen) -> LeftDelimiter { LeftDelimiter::LParen(node) } -} -impl From for LeftDelimiter { - fn from(node: LBrack) -> LeftDelimiter { LeftDelimiter::LBrack(node) } -} -impl From for LeftDelimiter { - fn from(node: LCurly) -> LeftDelimiter { LeftDelimiter::LCurly(node) } -} -impl std::fmt::Display for LeftDelimiter { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstToken for LeftDelimiter { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - L_PAREN | L_BRACK | L_CURLY => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - let res = match syntax.kind() { - L_PAREN => LeftDelimiter::LParen(LParen { syntax }), - L_BRACK => LeftDelimiter::LBrack(LBrack { syntax }), - L_CURLY => LeftDelimiter::LCurly(LCurly { syntax }), - _ => return None, - }; - Some(res) - } - fn syntax(&self) -> &SyntaxToken { - match self { - LeftDelimiter::LParen(it) => &it.syntax, - LeftDelimiter::LBrack(it) => &it.syntax, - LeftDelimiter::LCurly(it) => &it.syntax, - } - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum RightDelimiter { - RParen(RParen), - RBrack(RBrack), - RCurly(RCurly), -} -impl From for RightDelimiter { - fn from(node: RParen) -> RightDelimiter { RightDelimiter::RParen(node) } -} -impl From for RightDelimiter { - fn from(node: RBrack) -> RightDelimiter { RightDelimiter::RBrack(node) } -} -impl From for RightDelimiter { - fn from(node: RCurly) -> RightDelimiter { RightDelimiter::RCurly(node) } -} -impl std::fmt::Display for RightDelimiter { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} -impl AstToken for RightDelimiter { - fn can_cast(kind: SyntaxKind) -> bool { - match kind { - R_PAREN | R_BRACK | R_CURLY => true, - _ => false, - } - } - fn cast(syntax: SyntaxToken) -> Option { - let res = match syntax.kind() { - R_PAREN => RightDelimiter::RParen(RParen { syntax }), - R_BRACK => RightDelimiter::RBrack(RBrack { syntax }), - R_CURLY => RightDelimiter::RCurly(RCurly { syntax }), - _ => return None, - }; - Some(res) - } - fn syntax(&self) -> &SyntaxToken { - match self { - RightDelimiter::RParen(it) => &it.syntax, - RightDelimiter::RBrack(it) => &it.syntax, - RightDelimiter::RCurly(it) => &it.syntax, - } - } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum RangeSeparator { Dotdot(Dotdot), Dotdotdot(Dotdotdot), -- cgit v1.2.3