aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src/ast/generated/tokens.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/syntax/src/ast/generated/tokens.rs')
-rw-r--r--crates/syntax/src/ast/generated/tokens.rs91
1 files changed, 91 insertions, 0 deletions
diff --git a/crates/syntax/src/ast/generated/tokens.rs b/crates/syntax/src/ast/generated/tokens.rs
new file mode 100644
index 000000000..abadd0b61
--- /dev/null
+++ b/crates/syntax/src/ast/generated/tokens.rs
@@ -0,0 +1,91 @@
1//! Generated file, do not edit by hand, see `xtask/src/codegen`
2
3use crate::{
4 ast::AstToken,
5 SyntaxKind::{self, *},
6 SyntaxToken,
7};
8
9#[derive(Debug, Clone, PartialEq, Eq, Hash)]
10pub struct Whitespace {
11 pub(crate) syntax: SyntaxToken,
12}
13impl std::fmt::Display for Whitespace {
14 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15 std::fmt::Display::fmt(&self.syntax, f)
16 }
17}
18impl AstToken for Whitespace {
19 fn can_cast(kind: SyntaxKind) -> bool { kind == WHITESPACE }
20 fn cast(syntax: SyntaxToken) -> Option<Self> {
21 if Self::can_cast(syntax.kind()) {
22 Some(Self { syntax })
23 } else {
24 None
25 }
26 }
27 fn syntax(&self) -> &SyntaxToken { &self.syntax }
28}
29
30#[derive(Debug, Clone, PartialEq, Eq, Hash)]
31pub struct Comment {
32 pub(crate) syntax: SyntaxToken,
33}
34impl std::fmt::Display for Comment {
35 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
36 std::fmt::Display::fmt(&self.syntax, f)
37 }
38}
39impl AstToken for Comment {
40 fn can_cast(kind: SyntaxKind) -> bool { kind == COMMENT }
41 fn cast(syntax: SyntaxToken) -> Option<Self> {
42 if Self::can_cast(syntax.kind()) {
43 Some(Self { syntax })
44 } else {
45 None
46 }
47 }
48 fn syntax(&self) -> &SyntaxToken { &self.syntax }
49}
50
51#[derive(Debug, Clone, PartialEq, Eq, Hash)]
52pub struct String {
53 pub(crate) syntax: SyntaxToken,
54}
55impl std::fmt::Display for String {
56 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
57 std::fmt::Display::fmt(&self.syntax, f)
58 }
59}
60impl AstToken for String {
61 fn can_cast(kind: SyntaxKind) -> bool { kind == STRING }
62 fn cast(syntax: SyntaxToken) -> Option<Self> {
63 if Self::can_cast(syntax.kind()) {
64 Some(Self { syntax })
65 } else {
66 None
67 }
68 }
69 fn syntax(&self) -> &SyntaxToken { &self.syntax }
70}
71
72#[derive(Debug, Clone, PartialEq, Eq, Hash)]
73pub struct RawString {
74 pub(crate) syntax: SyntaxToken,
75}
76impl std::fmt::Display for RawString {
77 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
78 std::fmt::Display::fmt(&self.syntax, f)
79 }
80}
81impl AstToken for RawString {
82 fn can_cast(kind: SyntaxKind) -> bool { kind == RAW_STRING }
83 fn cast(syntax: SyntaxToken) -> Option<Self> {
84 if Self::can_cast(syntax.kind()) {
85 Some(Self { syntax })
86 } else {
87 None
88 }
89 }
90 fn syntax(&self) -> &SyntaxToken { &self.syntax }
91}