diff options
Diffstat (limited to 'crates/libsyntax2/src/ast')
-rw-r--r-- | crates/libsyntax2/src/ast/generated.rs | 688 |
1 files changed, 688 insertions, 0 deletions
diff --git a/crates/libsyntax2/src/ast/generated.rs b/crates/libsyntax2/src/ast/generated.rs index 52668c37b..7d746a85b 100644 --- a/crates/libsyntax2/src/ast/generated.rs +++ b/crates/libsyntax2/src/ast/generated.rs | |||
@@ -4,6 +4,24 @@ use { | |||
4 | SyntaxKind::*, | 4 | SyntaxKind::*, |
5 | }; | 5 | }; |
6 | 6 | ||
7 | // ArrayExpr | ||
8 | #[derive(Debug, Clone, Copy)] | ||
9 | pub struct ArrayExpr<'a> { | ||
10 | syntax: SyntaxNodeRef<'a>, | ||
11 | } | ||
12 | |||
13 | impl<'a> AstNode<'a> for ArrayExpr<'a> { | ||
14 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
15 | match syntax.kind() { | ||
16 | ARRAY_EXPR => Some(ArrayExpr { syntax }), | ||
17 | _ => None, | ||
18 | } | ||
19 | } | ||
20 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
21 | } | ||
22 | |||
23 | impl<'a> ArrayExpr<'a> {} | ||
24 | |||
7 | // ArrayType | 25 | // ArrayType |
8 | #[derive(Debug, Clone, Copy)] | 26 | #[derive(Debug, Clone, Copy)] |
9 | pub struct ArrayType<'a> { | 27 | pub struct ArrayType<'a> { |
@@ -44,6 +62,114 @@ impl<'a> Attr<'a> { | |||
44 | } | 62 | } |
45 | } | 63 | } |
46 | 64 | ||
65 | // BinExpr | ||
66 | #[derive(Debug, Clone, Copy)] | ||
67 | pub struct BinExpr<'a> { | ||
68 | syntax: SyntaxNodeRef<'a>, | ||
69 | } | ||
70 | |||
71 | impl<'a> AstNode<'a> for BinExpr<'a> { | ||
72 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
73 | match syntax.kind() { | ||
74 | BIN_EXPR => Some(BinExpr { syntax }), | ||
75 | _ => None, | ||
76 | } | ||
77 | } | ||
78 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
79 | } | ||
80 | |||
81 | impl<'a> BinExpr<'a> {} | ||
82 | |||
83 | // Block | ||
84 | #[derive(Debug, Clone, Copy)] | ||
85 | pub struct Block<'a> { | ||
86 | syntax: SyntaxNodeRef<'a>, | ||
87 | } | ||
88 | |||
89 | impl<'a> AstNode<'a> for Block<'a> { | ||
90 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
91 | match syntax.kind() { | ||
92 | BLOCK => Some(Block { syntax }), | ||
93 | _ => None, | ||
94 | } | ||
95 | } | ||
96 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
97 | } | ||
98 | |||
99 | impl<'a> Block<'a> {} | ||
100 | |||
101 | // BlockExpr | ||
102 | #[derive(Debug, Clone, Copy)] | ||
103 | pub struct BlockExpr<'a> { | ||
104 | syntax: SyntaxNodeRef<'a>, | ||
105 | } | ||
106 | |||
107 | impl<'a> AstNode<'a> for BlockExpr<'a> { | ||
108 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
109 | match syntax.kind() { | ||
110 | BLOCK_EXPR => Some(BlockExpr { syntax }), | ||
111 | _ => None, | ||
112 | } | ||
113 | } | ||
114 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
115 | } | ||
116 | |||
117 | impl<'a> BlockExpr<'a> {} | ||
118 | |||
119 | // BreakExpr | ||
120 | #[derive(Debug, Clone, Copy)] | ||
121 | pub struct BreakExpr<'a> { | ||
122 | syntax: SyntaxNodeRef<'a>, | ||
123 | } | ||
124 | |||
125 | impl<'a> AstNode<'a> for BreakExpr<'a> { | ||
126 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
127 | match syntax.kind() { | ||
128 | BREAK_EXPR => Some(BreakExpr { syntax }), | ||
129 | _ => None, | ||
130 | } | ||
131 | } | ||
132 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
133 | } | ||
134 | |||
135 | impl<'a> BreakExpr<'a> {} | ||
136 | |||
137 | // CallExpr | ||
138 | #[derive(Debug, Clone, Copy)] | ||
139 | pub struct CallExpr<'a> { | ||
140 | syntax: SyntaxNodeRef<'a>, | ||
141 | } | ||
142 | |||
143 | impl<'a> AstNode<'a> for CallExpr<'a> { | ||
144 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
145 | match syntax.kind() { | ||
146 | CALL_EXPR => Some(CallExpr { syntax }), | ||
147 | _ => None, | ||
148 | } | ||
149 | } | ||
150 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
151 | } | ||
152 | |||
153 | impl<'a> CallExpr<'a> {} | ||
154 | |||
155 | // CastExpr | ||
156 | #[derive(Debug, Clone, Copy)] | ||
157 | pub struct CastExpr<'a> { | ||
158 | syntax: SyntaxNodeRef<'a>, | ||
159 | } | ||
160 | |||
161 | impl<'a> AstNode<'a> for CastExpr<'a> { | ||
162 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
163 | match syntax.kind() { | ||
164 | CAST_EXPR => Some(CastExpr { syntax }), | ||
165 | _ => None, | ||
166 | } | ||
167 | } | ||
168 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
169 | } | ||
170 | |||
171 | impl<'a> CastExpr<'a> {} | ||
172 | |||
47 | // ConstDef | 173 | // ConstDef |
48 | #[derive(Debug, Clone, Copy)] | 174 | #[derive(Debug, Clone, Copy)] |
49 | pub struct ConstDef<'a> { | 175 | pub struct ConstDef<'a> { |
@@ -65,6 +191,24 @@ impl<'a> ast::TypeParamsOwner<'a> for ConstDef<'a> {} | |||
65 | impl<'a> ast::AttrsOwner<'a> for ConstDef<'a> {} | 191 | impl<'a> ast::AttrsOwner<'a> for ConstDef<'a> {} |
66 | impl<'a> ConstDef<'a> {} | 192 | impl<'a> ConstDef<'a> {} |
67 | 193 | ||
194 | // ContinueExpr | ||
195 | #[derive(Debug, Clone, Copy)] | ||
196 | pub struct ContinueExpr<'a> { | ||
197 | syntax: SyntaxNodeRef<'a>, | ||
198 | } | ||
199 | |||
200 | impl<'a> AstNode<'a> for ContinueExpr<'a> { | ||
201 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
202 | match syntax.kind() { | ||
203 | CONTINUE_EXPR => Some(ContinueExpr { syntax }), | ||
204 | _ => None, | ||
205 | } | ||
206 | } | ||
207 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
208 | } | ||
209 | |||
210 | impl<'a> ContinueExpr<'a> {} | ||
211 | |||
68 | // DynTraitType | 212 | // DynTraitType |
69 | #[derive(Debug, Clone, Copy)] | 213 | #[derive(Debug, Clone, Copy)] |
70 | pub struct DynTraitType<'a> { | 214 | pub struct DynTraitType<'a> { |
@@ -104,6 +248,136 @@ impl<'a> ast::TypeParamsOwner<'a> for EnumDef<'a> {} | |||
104 | impl<'a> ast::AttrsOwner<'a> for EnumDef<'a> {} | 248 | impl<'a> ast::AttrsOwner<'a> for EnumDef<'a> {} |
105 | impl<'a> EnumDef<'a> {} | 249 | impl<'a> EnumDef<'a> {} |
106 | 250 | ||
251 | // Expr | ||
252 | #[derive(Debug, Clone, Copy)] | ||
253 | pub enum Expr<'a> { | ||
254 | TupleExpr(TupleExpr<'a>), | ||
255 | ArrayExpr(ArrayExpr<'a>), | ||
256 | ParenExpr(ParenExpr<'a>), | ||
257 | PathExpr(PathExpr<'a>), | ||
258 | LambdaExpr(LambdaExpr<'a>), | ||
259 | IfExpr(IfExpr<'a>), | ||
260 | LoopExpr(LoopExpr<'a>), | ||
261 | ForExpr(ForExpr<'a>), | ||
262 | WhileExpr(WhileExpr<'a>), | ||
263 | ContinueExpr(ContinueExpr<'a>), | ||
264 | BreakExpr(BreakExpr<'a>), | ||
265 | Label(Label<'a>), | ||
266 | BlockExpr(BlockExpr<'a>), | ||
267 | ReturnExpr(ReturnExpr<'a>), | ||
268 | MatchExpr(MatchExpr<'a>), | ||
269 | MatchArmList(MatchArmList<'a>), | ||
270 | MatchArm(MatchArm<'a>), | ||
271 | MatchGuard(MatchGuard<'a>), | ||
272 | StructLit(StructLit<'a>), | ||
273 | NamedFieldList(NamedFieldList<'a>), | ||
274 | NamedField(NamedField<'a>), | ||
275 | CallExpr(CallExpr<'a>), | ||
276 | IndexExpr(IndexExpr<'a>), | ||
277 | MethodCallExpr(MethodCallExpr<'a>), | ||
278 | FieldExpr(FieldExpr<'a>), | ||
279 | TryExpr(TryExpr<'a>), | ||
280 | CastExpr(CastExpr<'a>), | ||
281 | RefExpr(RefExpr<'a>), | ||
282 | PrefixExpr(PrefixExpr<'a>), | ||
283 | RangeExpr(RangeExpr<'a>), | ||
284 | BinExpr(BinExpr<'a>), | ||
285 | } | ||
286 | |||
287 | impl<'a> AstNode<'a> for Expr<'a> { | ||
288 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
289 | match syntax.kind() { | ||
290 | TUPLE_EXPR => Some(Expr::TupleExpr(TupleExpr { syntax })), | ||
291 | ARRAY_EXPR => Some(Expr::ArrayExpr(ArrayExpr { syntax })), | ||
292 | PAREN_EXPR => Some(Expr::ParenExpr(ParenExpr { syntax })), | ||
293 | PATH_EXPR => Some(Expr::PathExpr(PathExpr { syntax })), | ||
294 | LAMBDA_EXPR => Some(Expr::LambdaExpr(LambdaExpr { syntax })), | ||
295 | IF_EXPR => Some(Expr::IfExpr(IfExpr { syntax })), | ||
296 | LOOP_EXPR => Some(Expr::LoopExpr(LoopExpr { syntax })), | ||
297 | FOR_EXPR => Some(Expr::ForExpr(ForExpr { syntax })), | ||
298 | WHILE_EXPR => Some(Expr::WhileExpr(WhileExpr { syntax })), | ||
299 | CONTINUE_EXPR => Some(Expr::ContinueExpr(ContinueExpr { syntax })), | ||
300 | BREAK_EXPR => Some(Expr::BreakExpr(BreakExpr { syntax })), | ||
301 | LABEL => Some(Expr::Label(Label { syntax })), | ||
302 | BLOCK_EXPR => Some(Expr::BlockExpr(BlockExpr { syntax })), | ||
303 | RETURN_EXPR => Some(Expr::ReturnExpr(ReturnExpr { syntax })), | ||
304 | MATCH_EXPR => Some(Expr::MatchExpr(MatchExpr { syntax })), | ||
305 | MATCH_ARM_LIST => Some(Expr::MatchArmList(MatchArmList { syntax })), | ||
306 | MATCH_ARM => Some(Expr::MatchArm(MatchArm { syntax })), | ||
307 | MATCH_GUARD => Some(Expr::MatchGuard(MatchGuard { syntax })), | ||
308 | STRUCT_LIT => Some(Expr::StructLit(StructLit { syntax })), | ||
309 | NAMED_FIELD_LIST => Some(Expr::NamedFieldList(NamedFieldList { syntax })), | ||
310 | NAMED_FIELD => Some(Expr::NamedField(NamedField { syntax })), | ||
311 | CALL_EXPR => Some(Expr::CallExpr(CallExpr { syntax })), | ||
312 | INDEX_EXPR => Some(Expr::IndexExpr(IndexExpr { syntax })), | ||
313 | METHOD_CALL_EXPR => Some(Expr::MethodCallExpr(MethodCallExpr { syntax })), | ||
314 | FIELD_EXPR => Some(Expr::FieldExpr(FieldExpr { syntax })), | ||
315 | TRY_EXPR => Some(Expr::TryExpr(TryExpr { syntax })), | ||
316 | CAST_EXPR => Some(Expr::CastExpr(CastExpr { syntax })), | ||
317 | REF_EXPR => Some(Expr::RefExpr(RefExpr { syntax })), | ||
318 | PREFIX_EXPR => Some(Expr::PrefixExpr(PrefixExpr { syntax })), | ||
319 | RANGE_EXPR => Some(Expr::RangeExpr(RangeExpr { syntax })), | ||
320 | BIN_EXPR => Some(Expr::BinExpr(BinExpr { syntax })), | ||
321 | _ => None, | ||
322 | } | ||
323 | } | ||
324 | fn syntax(self) -> SyntaxNodeRef<'a> { | ||
325 | match self { | ||
326 | Expr::TupleExpr(inner) => inner.syntax(), | ||
327 | Expr::ArrayExpr(inner) => inner.syntax(), | ||
328 | Expr::ParenExpr(inner) => inner.syntax(), | ||
329 | Expr::PathExpr(inner) => inner.syntax(), | ||
330 | Expr::LambdaExpr(inner) => inner.syntax(), | ||
331 | Expr::IfExpr(inner) => inner.syntax(), | ||
332 | Expr::LoopExpr(inner) => inner.syntax(), | ||
333 | Expr::ForExpr(inner) => inner.syntax(), | ||
334 | Expr::WhileExpr(inner) => inner.syntax(), | ||
335 | Expr::ContinueExpr(inner) => inner.syntax(), | ||
336 | Expr::BreakExpr(inner) => inner.syntax(), | ||
337 | Expr::Label(inner) => inner.syntax(), | ||
338 | Expr::BlockExpr(inner) => inner.syntax(), | ||
339 | Expr::ReturnExpr(inner) => inner.syntax(), | ||
340 | Expr::MatchExpr(inner) => inner.syntax(), | ||
341 | Expr::MatchArmList(inner) => inner.syntax(), | ||
342 | Expr::MatchArm(inner) => inner.syntax(), | ||
343 | Expr::MatchGuard(inner) => inner.syntax(), | ||
344 | Expr::StructLit(inner) => inner.syntax(), | ||
345 | Expr::NamedFieldList(inner) => inner.syntax(), | ||
346 | Expr::NamedField(inner) => inner.syntax(), | ||
347 | Expr::CallExpr(inner) => inner.syntax(), | ||
348 | Expr::IndexExpr(inner) => inner.syntax(), | ||
349 | Expr::MethodCallExpr(inner) => inner.syntax(), | ||
350 | Expr::FieldExpr(inner) => inner.syntax(), | ||
351 | Expr::TryExpr(inner) => inner.syntax(), | ||
352 | Expr::CastExpr(inner) => inner.syntax(), | ||
353 | Expr::RefExpr(inner) => inner.syntax(), | ||
354 | Expr::PrefixExpr(inner) => inner.syntax(), | ||
355 | Expr::RangeExpr(inner) => inner.syntax(), | ||
356 | Expr::BinExpr(inner) => inner.syntax(), | ||
357 | } | ||
358 | } | ||
359 | } | ||
360 | |||
361 | impl<'a> Expr<'a> {} | ||
362 | |||
363 | // FieldExpr | ||
364 | #[derive(Debug, Clone, Copy)] | ||
365 | pub struct FieldExpr<'a> { | ||
366 | syntax: SyntaxNodeRef<'a>, | ||
367 | } | ||
368 | |||
369 | impl<'a> AstNode<'a> for FieldExpr<'a> { | ||
370 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
371 | match syntax.kind() { | ||
372 | FIELD_EXPR => Some(FieldExpr { syntax }), | ||
373 | _ => None, | ||
374 | } | ||
375 | } | ||
376 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
377 | } | ||
378 | |||
379 | impl<'a> FieldExpr<'a> {} | ||
380 | |||
107 | // FnDef | 381 | // FnDef |
108 | #[derive(Debug, Clone, Copy)] | 382 | #[derive(Debug, Clone, Copy)] |
109 | pub struct FnDef<'a> { | 383 | pub struct FnDef<'a> { |
@@ -143,6 +417,24 @@ impl<'a> AstNode<'a> for FnPointerType<'a> { | |||
143 | 417 | ||
144 | impl<'a> FnPointerType<'a> {} | 418 | impl<'a> FnPointerType<'a> {} |
145 | 419 | ||
420 | // ForExpr | ||
421 | #[derive(Debug, Clone, Copy)] | ||
422 | pub struct ForExpr<'a> { | ||
423 | syntax: SyntaxNodeRef<'a>, | ||
424 | } | ||
425 | |||
426 | impl<'a> AstNode<'a> for ForExpr<'a> { | ||
427 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
428 | match syntax.kind() { | ||
429 | FOR_EXPR => Some(ForExpr { syntax }), | ||
430 | _ => None, | ||
431 | } | ||
432 | } | ||
433 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
434 | } | ||
435 | |||
436 | impl<'a> ForExpr<'a> {} | ||
437 | |||
146 | // ForType | 438 | // ForType |
147 | #[derive(Debug, Clone, Copy)] | 439 | #[derive(Debug, Clone, Copy)] |
148 | pub struct ForType<'a> { | 440 | pub struct ForType<'a> { |
@@ -161,6 +453,24 @@ impl<'a> AstNode<'a> for ForType<'a> { | |||
161 | 453 | ||
162 | impl<'a> ForType<'a> {} | 454 | impl<'a> ForType<'a> {} |
163 | 455 | ||
456 | // IfExpr | ||
457 | #[derive(Debug, Clone, Copy)] | ||
458 | pub struct IfExpr<'a> { | ||
459 | syntax: SyntaxNodeRef<'a>, | ||
460 | } | ||
461 | |||
462 | impl<'a> AstNode<'a> for IfExpr<'a> { | ||
463 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
464 | match syntax.kind() { | ||
465 | IF_EXPR => Some(IfExpr { syntax }), | ||
466 | _ => None, | ||
467 | } | ||
468 | } | ||
469 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
470 | } | ||
471 | |||
472 | impl<'a> IfExpr<'a> {} | ||
473 | |||
164 | // ImplItem | 474 | // ImplItem |
165 | #[derive(Debug, Clone, Copy)] | 475 | #[derive(Debug, Clone, Copy)] |
166 | pub struct ImplItem<'a> { | 476 | pub struct ImplItem<'a> { |
@@ -197,6 +507,168 @@ impl<'a> AstNode<'a> for ImplTraitType<'a> { | |||
197 | 507 | ||
198 | impl<'a> ImplTraitType<'a> {} | 508 | impl<'a> ImplTraitType<'a> {} |
199 | 509 | ||
510 | // IndexExpr | ||
511 | #[derive(Debug, Clone, Copy)] | ||
512 | pub struct IndexExpr<'a> { | ||
513 | syntax: SyntaxNodeRef<'a>, | ||
514 | } | ||
515 | |||
516 | impl<'a> AstNode<'a> for IndexExpr<'a> { | ||
517 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
518 | match syntax.kind() { | ||
519 | INDEX_EXPR => Some(IndexExpr { syntax }), | ||
520 | _ => None, | ||
521 | } | ||
522 | } | ||
523 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
524 | } | ||
525 | |||
526 | impl<'a> IndexExpr<'a> {} | ||
527 | |||
528 | // Label | ||
529 | #[derive(Debug, Clone, Copy)] | ||
530 | pub struct Label<'a> { | ||
531 | syntax: SyntaxNodeRef<'a>, | ||
532 | } | ||
533 | |||
534 | impl<'a> AstNode<'a> for Label<'a> { | ||
535 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
536 | match syntax.kind() { | ||
537 | LABEL => Some(Label { syntax }), | ||
538 | _ => None, | ||
539 | } | ||
540 | } | ||
541 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
542 | } | ||
543 | |||
544 | impl<'a> Label<'a> {} | ||
545 | |||
546 | // LambdaExpr | ||
547 | #[derive(Debug, Clone, Copy)] | ||
548 | pub struct LambdaExpr<'a> { | ||
549 | syntax: SyntaxNodeRef<'a>, | ||
550 | } | ||
551 | |||
552 | impl<'a> AstNode<'a> for LambdaExpr<'a> { | ||
553 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
554 | match syntax.kind() { | ||
555 | LAMBDA_EXPR => Some(LambdaExpr { syntax }), | ||
556 | _ => None, | ||
557 | } | ||
558 | } | ||
559 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
560 | } | ||
561 | |||
562 | impl<'a> LambdaExpr<'a> {} | ||
563 | |||
564 | // LoopExpr | ||
565 | #[derive(Debug, Clone, Copy)] | ||
566 | pub struct LoopExpr<'a> { | ||
567 | syntax: SyntaxNodeRef<'a>, | ||
568 | } | ||
569 | |||
570 | impl<'a> AstNode<'a> for LoopExpr<'a> { | ||
571 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
572 | match syntax.kind() { | ||
573 | LOOP_EXPR => Some(LoopExpr { syntax }), | ||
574 | _ => None, | ||
575 | } | ||
576 | } | ||
577 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
578 | } | ||
579 | |||
580 | impl<'a> LoopExpr<'a> {} | ||
581 | |||
582 | // MatchArm | ||
583 | #[derive(Debug, Clone, Copy)] | ||
584 | pub struct MatchArm<'a> { | ||
585 | syntax: SyntaxNodeRef<'a>, | ||
586 | } | ||
587 | |||
588 | impl<'a> AstNode<'a> for MatchArm<'a> { | ||
589 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
590 | match syntax.kind() { | ||
591 | MATCH_ARM => Some(MatchArm { syntax }), | ||
592 | _ => None, | ||
593 | } | ||
594 | } | ||
595 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
596 | } | ||
597 | |||
598 | impl<'a> MatchArm<'a> {} | ||
599 | |||
600 | // MatchArmList | ||
601 | #[derive(Debug, Clone, Copy)] | ||
602 | pub struct MatchArmList<'a> { | ||
603 | syntax: SyntaxNodeRef<'a>, | ||
604 | } | ||
605 | |||
606 | impl<'a> AstNode<'a> for MatchArmList<'a> { | ||
607 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
608 | match syntax.kind() { | ||
609 | MATCH_ARM_LIST => Some(MatchArmList { syntax }), | ||
610 | _ => None, | ||
611 | } | ||
612 | } | ||
613 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
614 | } | ||
615 | |||
616 | impl<'a> MatchArmList<'a> {} | ||
617 | |||
618 | // MatchExpr | ||
619 | #[derive(Debug, Clone, Copy)] | ||
620 | pub struct MatchExpr<'a> { | ||
621 | syntax: SyntaxNodeRef<'a>, | ||
622 | } | ||
623 | |||
624 | impl<'a> AstNode<'a> for MatchExpr<'a> { | ||
625 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
626 | match syntax.kind() { | ||
627 | MATCH_EXPR => Some(MatchExpr { syntax }), | ||
628 | _ => None, | ||
629 | } | ||
630 | } | ||
631 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
632 | } | ||
633 | |||
634 | impl<'a> MatchExpr<'a> {} | ||
635 | |||
636 | // MatchGuard | ||
637 | #[derive(Debug, Clone, Copy)] | ||
638 | pub struct MatchGuard<'a> { | ||
639 | syntax: SyntaxNodeRef<'a>, | ||
640 | } | ||
641 | |||
642 | impl<'a> AstNode<'a> for MatchGuard<'a> { | ||
643 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
644 | match syntax.kind() { | ||
645 | MATCH_GUARD => Some(MatchGuard { syntax }), | ||
646 | _ => None, | ||
647 | } | ||
648 | } | ||
649 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
650 | } | ||
651 | |||
652 | impl<'a> MatchGuard<'a> {} | ||
653 | |||
654 | // MethodCallExpr | ||
655 | #[derive(Debug, Clone, Copy)] | ||
656 | pub struct MethodCallExpr<'a> { | ||
657 | syntax: SyntaxNodeRef<'a>, | ||
658 | } | ||
659 | |||
660 | impl<'a> AstNode<'a> for MethodCallExpr<'a> { | ||
661 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
662 | match syntax.kind() { | ||
663 | METHOD_CALL_EXPR => Some(MethodCallExpr { syntax }), | ||
664 | _ => None, | ||
665 | } | ||
666 | } | ||
667 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
668 | } | ||
669 | |||
670 | impl<'a> MethodCallExpr<'a> {} | ||
671 | |||
200 | // Module | 672 | // Module |
201 | #[derive(Debug, Clone, Copy)] | 673 | #[derive(Debug, Clone, Copy)] |
202 | pub struct Module<'a> { | 674 | pub struct Module<'a> { |
@@ -257,6 +729,24 @@ impl<'a> AstNode<'a> for NameRef<'a> { | |||
257 | 729 | ||
258 | impl<'a> NameRef<'a> {} | 730 | impl<'a> NameRef<'a> {} |
259 | 731 | ||
732 | // NamedField | ||
733 | #[derive(Debug, Clone, Copy)] | ||
734 | pub struct NamedField<'a> { | ||
735 | syntax: SyntaxNodeRef<'a>, | ||
736 | } | ||
737 | |||
738 | impl<'a> AstNode<'a> for NamedField<'a> { | ||
739 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
740 | match syntax.kind() { | ||
741 | NAMED_FIELD => Some(NamedField { syntax }), | ||
742 | _ => None, | ||
743 | } | ||
744 | } | ||
745 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
746 | } | ||
747 | |||
748 | impl<'a> NamedField<'a> {} | ||
749 | |||
260 | // NamedFieldDef | 750 | // NamedFieldDef |
261 | #[derive(Debug, Clone, Copy)] | 751 | #[derive(Debug, Clone, Copy)] |
262 | pub struct NamedFieldDef<'a> { | 752 | pub struct NamedFieldDef<'a> { |
@@ -277,6 +767,24 @@ impl<'a> ast::NameOwner<'a> for NamedFieldDef<'a> {} | |||
277 | impl<'a> ast::AttrsOwner<'a> for NamedFieldDef<'a> {} | 767 | impl<'a> ast::AttrsOwner<'a> for NamedFieldDef<'a> {} |
278 | impl<'a> NamedFieldDef<'a> {} | 768 | impl<'a> NamedFieldDef<'a> {} |
279 | 769 | ||
770 | // NamedFieldList | ||
771 | #[derive(Debug, Clone, Copy)] | ||
772 | pub struct NamedFieldList<'a> { | ||
773 | syntax: SyntaxNodeRef<'a>, | ||
774 | } | ||
775 | |||
776 | impl<'a> AstNode<'a> for NamedFieldList<'a> { | ||
777 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
778 | match syntax.kind() { | ||
779 | NAMED_FIELD_LIST => Some(NamedFieldList { syntax }), | ||
780 | _ => None, | ||
781 | } | ||
782 | } | ||
783 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
784 | } | ||
785 | |||
786 | impl<'a> NamedFieldList<'a> {} | ||
787 | |||
280 | // NeverType | 788 | // NeverType |
281 | #[derive(Debug, Clone, Copy)] | 789 | #[derive(Debug, Clone, Copy)] |
282 | pub struct NeverType<'a> { | 790 | pub struct NeverType<'a> { |
@@ -323,6 +831,24 @@ impl<'a> ast::TypeParamsOwner<'a> for NominalDef<'a> {} | |||
323 | impl<'a> ast::AttrsOwner<'a> for NominalDef<'a> {} | 831 | impl<'a> ast::AttrsOwner<'a> for NominalDef<'a> {} |
324 | impl<'a> NominalDef<'a> {} | 832 | impl<'a> NominalDef<'a> {} |
325 | 833 | ||
834 | // ParenExpr | ||
835 | #[derive(Debug, Clone, Copy)] | ||
836 | pub struct ParenExpr<'a> { | ||
837 | syntax: SyntaxNodeRef<'a>, | ||
838 | } | ||
839 | |||
840 | impl<'a> AstNode<'a> for ParenExpr<'a> { | ||
841 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
842 | match syntax.kind() { | ||
843 | PAREN_EXPR => Some(ParenExpr { syntax }), | ||
844 | _ => None, | ||
845 | } | ||
846 | } | ||
847 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
848 | } | ||
849 | |||
850 | impl<'a> ParenExpr<'a> {} | ||
851 | |||
326 | // ParenType | 852 | // ParenType |
327 | #[derive(Debug, Clone, Copy)] | 853 | #[derive(Debug, Clone, Copy)] |
328 | pub struct ParenType<'a> { | 854 | pub struct ParenType<'a> { |
@@ -341,6 +867,24 @@ impl<'a> AstNode<'a> for ParenType<'a> { | |||
341 | 867 | ||
342 | impl<'a> ParenType<'a> {} | 868 | impl<'a> ParenType<'a> {} |
343 | 869 | ||
870 | // PathExpr | ||
871 | #[derive(Debug, Clone, Copy)] | ||
872 | pub struct PathExpr<'a> { | ||
873 | syntax: SyntaxNodeRef<'a>, | ||
874 | } | ||
875 | |||
876 | impl<'a> AstNode<'a> for PathExpr<'a> { | ||
877 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
878 | match syntax.kind() { | ||
879 | PATH_EXPR => Some(PathExpr { syntax }), | ||
880 | _ => None, | ||
881 | } | ||
882 | } | ||
883 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
884 | } | ||
885 | |||
886 | impl<'a> PathExpr<'a> {} | ||
887 | |||
344 | // PathType | 888 | // PathType |
345 | #[derive(Debug, Clone, Copy)] | 889 | #[derive(Debug, Clone, Copy)] |
346 | pub struct PathType<'a> { | 890 | pub struct PathType<'a> { |
@@ -395,6 +939,60 @@ impl<'a> AstNode<'a> for PointerType<'a> { | |||
395 | 939 | ||
396 | impl<'a> PointerType<'a> {} | 940 | impl<'a> PointerType<'a> {} |
397 | 941 | ||
942 | // PrefixExpr | ||
943 | #[derive(Debug, Clone, Copy)] | ||
944 | pub struct PrefixExpr<'a> { | ||
945 | syntax: SyntaxNodeRef<'a>, | ||
946 | } | ||
947 | |||
948 | impl<'a> AstNode<'a> for PrefixExpr<'a> { | ||
949 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
950 | match syntax.kind() { | ||
951 | PREFIX_EXPR => Some(PrefixExpr { syntax }), | ||
952 | _ => None, | ||
953 | } | ||
954 | } | ||
955 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
956 | } | ||
957 | |||
958 | impl<'a> PrefixExpr<'a> {} | ||
959 | |||
960 | // RangeExpr | ||
961 | #[derive(Debug, Clone, Copy)] | ||
962 | pub struct RangeExpr<'a> { | ||
963 | syntax: SyntaxNodeRef<'a>, | ||
964 | } | ||
965 | |||
966 | impl<'a> AstNode<'a> for RangeExpr<'a> { | ||
967 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
968 | match syntax.kind() { | ||
969 | RANGE_EXPR => Some(RangeExpr { syntax }), | ||
970 | _ => None, | ||
971 | } | ||
972 | } | ||
973 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
974 | } | ||
975 | |||
976 | impl<'a> RangeExpr<'a> {} | ||
977 | |||
978 | // RefExpr | ||
979 | #[derive(Debug, Clone, Copy)] | ||
980 | pub struct RefExpr<'a> { | ||
981 | syntax: SyntaxNodeRef<'a>, | ||
982 | } | ||
983 | |||
984 | impl<'a> AstNode<'a> for RefExpr<'a> { | ||
985 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
986 | match syntax.kind() { | ||
987 | REF_EXPR => Some(RefExpr { syntax }), | ||
988 | _ => None, | ||
989 | } | ||
990 | } | ||
991 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
992 | } | ||
993 | |||
994 | impl<'a> RefExpr<'a> {} | ||
995 | |||
398 | // ReferenceType | 996 | // ReferenceType |
399 | #[derive(Debug, Clone, Copy)] | 997 | #[derive(Debug, Clone, Copy)] |
400 | pub struct ReferenceType<'a> { | 998 | pub struct ReferenceType<'a> { |
@@ -413,6 +1011,24 @@ impl<'a> AstNode<'a> for ReferenceType<'a> { | |||
413 | 1011 | ||
414 | impl<'a> ReferenceType<'a> {} | 1012 | impl<'a> ReferenceType<'a> {} |
415 | 1013 | ||
1014 | // ReturnExpr | ||
1015 | #[derive(Debug, Clone, Copy)] | ||
1016 | pub struct ReturnExpr<'a> { | ||
1017 | syntax: SyntaxNodeRef<'a>, | ||
1018 | } | ||
1019 | |||
1020 | impl<'a> AstNode<'a> for ReturnExpr<'a> { | ||
1021 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
1022 | match syntax.kind() { | ||
1023 | RETURN_EXPR => Some(ReturnExpr { syntax }), | ||
1024 | _ => None, | ||
1025 | } | ||
1026 | } | ||
1027 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
1028 | } | ||
1029 | |||
1030 | impl<'a> ReturnExpr<'a> {} | ||
1031 | |||
416 | // Root | 1032 | // Root |
417 | #[derive(Debug, Clone, Copy)] | 1033 | #[derive(Debug, Clone, Copy)] |
418 | pub struct Root<'a> { | 1034 | pub struct Root<'a> { |
@@ -503,6 +1119,24 @@ impl<'a> StructDef<'a> { | |||
503 | } | 1119 | } |
504 | } | 1120 | } |
505 | 1121 | ||
1122 | // StructLit | ||
1123 | #[derive(Debug, Clone, Copy)] | ||
1124 | pub struct StructLit<'a> { | ||
1125 | syntax: SyntaxNodeRef<'a>, | ||
1126 | } | ||
1127 | |||
1128 | impl<'a> AstNode<'a> for StructLit<'a> { | ||
1129 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
1130 | match syntax.kind() { | ||
1131 | STRUCT_LIT => Some(StructLit { syntax }), | ||
1132 | _ => None, | ||
1133 | } | ||
1134 | } | ||
1135 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
1136 | } | ||
1137 | |||
1138 | impl<'a> StructLit<'a> {} | ||
1139 | |||
506 | // TokenTree | 1140 | // TokenTree |
507 | #[derive(Debug, Clone, Copy)] | 1141 | #[derive(Debug, Clone, Copy)] |
508 | pub struct TokenTree<'a> { | 1142 | pub struct TokenTree<'a> { |
@@ -541,6 +1175,42 @@ impl<'a> ast::NameOwner<'a> for TraitDef<'a> {} | |||
541 | impl<'a> ast::AttrsOwner<'a> for TraitDef<'a> {} | 1175 | impl<'a> ast::AttrsOwner<'a> for TraitDef<'a> {} |
542 | impl<'a> TraitDef<'a> {} | 1176 | impl<'a> TraitDef<'a> {} |
543 | 1177 | ||
1178 | // TryExpr | ||
1179 | #[derive(Debug, Clone, Copy)] | ||
1180 | pub struct TryExpr<'a> { | ||
1181 | syntax: SyntaxNodeRef<'a>, | ||
1182 | } | ||
1183 | |||
1184 | impl<'a> AstNode<'a> for TryExpr<'a> { | ||
1185 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
1186 | match syntax.kind() { | ||
1187 | TRY_EXPR => Some(TryExpr { syntax }), | ||
1188 | _ => None, | ||
1189 | } | ||
1190 | } | ||
1191 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
1192 | } | ||
1193 | |||
1194 | impl<'a> TryExpr<'a> {} | ||
1195 | |||
1196 | // TupleExpr | ||
1197 | #[derive(Debug, Clone, Copy)] | ||
1198 | pub struct TupleExpr<'a> { | ||
1199 | syntax: SyntaxNodeRef<'a>, | ||
1200 | } | ||
1201 | |||
1202 | impl<'a> AstNode<'a> for TupleExpr<'a> { | ||
1203 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
1204 | match syntax.kind() { | ||
1205 | TUPLE_EXPR => Some(TupleExpr { syntax }), | ||
1206 | _ => None, | ||
1207 | } | ||
1208 | } | ||
1209 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
1210 | } | ||
1211 | |||
1212 | impl<'a> TupleExpr<'a> {} | ||
1213 | |||
544 | // TupleType | 1214 | // TupleType |
545 | #[derive(Debug, Clone, Copy)] | 1215 | #[derive(Debug, Clone, Copy)] |
546 | pub struct TupleType<'a> { | 1216 | pub struct TupleType<'a> { |
@@ -697,3 +1367,21 @@ impl<'a> AstNode<'a> for WhereClause<'a> { | |||
697 | 1367 | ||
698 | impl<'a> WhereClause<'a> {} | 1368 | impl<'a> WhereClause<'a> {} |
699 | 1369 | ||
1370 | // WhileExpr | ||
1371 | #[derive(Debug, Clone, Copy)] | ||
1372 | pub struct WhileExpr<'a> { | ||
1373 | syntax: SyntaxNodeRef<'a>, | ||
1374 | } | ||
1375 | |||
1376 | impl<'a> AstNode<'a> for WhileExpr<'a> { | ||
1377 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
1378 | match syntax.kind() { | ||
1379 | WHILE_EXPR => Some(WhileExpr { syntax }), | ||
1380 | _ => None, | ||
1381 | } | ||
1382 | } | ||
1383 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
1384 | } | ||
1385 | |||
1386 | impl<'a> WhileExpr<'a> {} | ||
1387 | |||