@@ -132,6 +132,48 @@ impl AstToken for FloatNumber {
132
132
fn syntax ( & self ) -> & SyntaxToken { & self . syntax }
133
133
}
134
134
135
+ #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
136
+ pub struct Char {
137
+ pub ( crate ) syntax : SyntaxToken ,
138
+ }
139
+ impl std:: fmt:: Display for Char {
140
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
141
+ std:: fmt:: Display :: fmt ( & self . syntax , f)
142
+ }
143
+ }
144
+ impl AstToken for Char {
145
+ fn can_cast ( kind : SyntaxKind ) -> bool { kind == CHAR }
146
+ fn cast ( syntax : SyntaxToken ) -> Option < Self > {
147
+ if Self :: can_cast ( syntax. kind ( ) ) {
148
+ Some ( Self { syntax } )
149
+ } else {
150
+ None
151
+ }
152
+ }
153
+ fn syntax ( & self ) -> & SyntaxToken { & self . syntax }
154
+ }
155
+
156
+ #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
157
+ pub struct Byte {
158
+ pub ( crate ) syntax : SyntaxToken ,
159
+ }
160
+ impl std:: fmt:: Display for Byte {
161
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
162
+ std:: fmt:: Display :: fmt ( & self . syntax , f)
163
+ }
164
+ }
165
+ impl AstToken for Byte {
166
+ fn can_cast ( kind : SyntaxKind ) -> bool { kind == BYTE }
167
+ fn cast ( syntax : SyntaxToken ) -> Option < Self > {
168
+ if Self :: can_cast ( syntax. kind ( ) ) {
169
+ Some ( Self { syntax } )
170
+ } else {
171
+ None
172
+ }
173
+ }
174
+ fn syntax ( & self ) -> & SyntaxToken { & self . syntax }
175
+ }
176
+
135
177
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
136
178
pub struct Ident {
137
179
pub ( crate ) syntax : SyntaxToken ,
0 commit comments