git.delta.rocks / jrsonnet / refs/commits / c678cf8e698f

difftreelog

source

crates/jrsonnet-rowan-parser/src/generated/tokens.rs3.9 KiBsourcehistory
1//! This is a generated file, please do not edit manually. Changes can be2//! made in codegeneration that lives in `xtask` top-level dir.34use crate::{5	ast::AstToken,6	SyntaxKind::{self, *},7	SyntaxToken,8};910#[derive(Debug, Clone, PartialEq, Eq, Hash)]11pub struct Whitespace {12	pub(crate) syntax: SyntaxToken,13}14impl std::fmt::Display for Whitespace {15	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {16		std::fmt::Display::fmt(&self.syntax, f)17	}18}19impl AstToken for Whitespace {20	fn can_cast(kind: SyntaxKind) -> bool { kind == WHITESPACE }21	fn cast(syntax: SyntaxToken) -> Option<Self> {22		if Self::can_cast(syntax.kind()) {23			Some(Self { syntax })24		} else {25			None26		}27	}28	fn syntax(&self) -> &SyntaxToken { &self.syntax }29}3031#[derive(Debug, Clone, PartialEq, Eq, Hash)]32pub struct Comment {33	pub(crate) syntax: SyntaxToken,34}35impl std::fmt::Display for Comment {36	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {37		std::fmt::Display::fmt(&self.syntax, f)38	}39}40impl AstToken for Comment {41	fn can_cast(kind: SyntaxKind) -> bool { kind == COMMENT }42	fn cast(syntax: SyntaxToken) -> Option<Self> {43		if Self::can_cast(syntax.kind()) {44			Some(Self { syntax })45		} else {46			None47		}48	}49	fn syntax(&self) -> &SyntaxToken { &self.syntax }50}5152#[derive(Debug, Clone, PartialEq, Eq, Hash)]53pub struct String {54	pub(crate) syntax: SyntaxToken,55}56impl std::fmt::Display for String {57	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {58		std::fmt::Display::fmt(&self.syntax, f)59	}60}61impl AstToken for String {62	fn can_cast(kind: SyntaxKind) -> bool { kind == STRING }63	fn cast(syntax: SyntaxToken) -> Option<Self> {64		if Self::can_cast(syntax.kind()) {65			Some(Self { syntax })66		} else {67			None68		}69	}70	fn syntax(&self) -> &SyntaxToken { &self.syntax }71}7273#[derive(Debug, Clone, PartialEq, Eq, Hash)]74pub struct StringVerbantim {75	pub(crate) syntax: SyntaxToken,76}77impl std::fmt::Display for StringVerbantim {78	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {79		std::fmt::Display::fmt(&self.syntax, f)80	}81}82impl AstToken for StringVerbantim {83	fn can_cast(kind: SyntaxKind) -> bool { kind == STRING_VERBANTIM }84	fn cast(syntax: SyntaxToken) -> Option<Self> {85		if Self::can_cast(syntax.kind()) {86			Some(Self { syntax })87		} else {88			None89		}90	}91	fn syntax(&self) -> &SyntaxToken { &self.syntax }92}9394#[derive(Debug, Clone, PartialEq, Eq, Hash)]95pub struct StringBlock {96	pub(crate) syntax: SyntaxToken,97}98impl std::fmt::Display for StringBlock {99	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {100		std::fmt::Display::fmt(&self.syntax, f)101	}102}103impl AstToken for StringBlock {104	fn can_cast(kind: SyntaxKind) -> bool { kind == STRING_BLOCK }105	fn cast(syntax: SyntaxToken) -> Option<Self> {106		if Self::can_cast(syntax.kind()) {107			Some(Self { syntax })108		} else {109			None110		}111	}112	fn syntax(&self) -> &SyntaxToken { &self.syntax }113}114115#[derive(Debug, Clone, PartialEq, Eq, Hash)]116pub struct Number {117	pub(crate) syntax: SyntaxToken,118}119impl std::fmt::Display for Number {120	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {121		std::fmt::Display::fmt(&self.syntax, f)122	}123}124impl AstToken for Number {125	fn can_cast(kind: SyntaxKind) -> bool { kind == NUMBER }126	fn cast(syntax: SyntaxToken) -> Option<Self> {127		if Self::can_cast(syntax.kind()) {128			Some(Self { syntax })129		} else {130			None131		}132	}133	fn syntax(&self) -> &SyntaxToken { &self.syntax }134}135136#[derive(Debug, Clone, PartialEq, Eq, Hash)]137pub struct Ident {138	pub(crate) syntax: SyntaxToken,139}140impl std::fmt::Display for Ident {141	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {142		std::fmt::Display::fmt(&self.syntax, f)143	}144}145impl AstToken for Ident {146	fn can_cast(kind: SyntaxKind) -> bool { kind == IDENT }147	fn cast(syntax: SyntaxToken) -> Option<Self> {148		if Self::can_cast(syntax.kind()) {149			Some(Self { syntax })150		} else {151			None152		}153	}154	fn syntax(&self) -> &SyntaxToken { &self.syntax }155}