diff options
Diffstat (limited to 'crates/libsyntax2')
-rw-r--r-- | crates/libsyntax2/src/ast/generated.rs | 21 | ||||
-rw-r--r-- | crates/libsyntax2/src/grammar.ron | 2 |
2 files changed, 23 insertions, 0 deletions
diff --git a/crates/libsyntax2/src/ast/generated.rs b/crates/libsyntax2/src/ast/generated.rs index 6181aada8..b24fd2aba 100644 --- a/crates/libsyntax2/src/ast/generated.rs +++ b/crates/libsyntax2/src/ast/generated.rs | |||
@@ -339,6 +339,7 @@ pub enum Expr<'a> { | |||
339 | PrefixExpr(PrefixExpr<'a>), | 339 | PrefixExpr(PrefixExpr<'a>), |
340 | RangeExpr(RangeExpr<'a>), | 340 | RangeExpr(RangeExpr<'a>), |
341 | BinExpr(BinExpr<'a>), | 341 | BinExpr(BinExpr<'a>), |
342 | Literal(Literal<'a>), | ||
342 | } | 343 | } |
343 | 344 | ||
344 | impl<'a> AstNode<'a> for Expr<'a> { | 345 | impl<'a> AstNode<'a> for Expr<'a> { |
@@ -375,6 +376,7 @@ impl<'a> AstNode<'a> for Expr<'a> { | |||
375 | PREFIX_EXPR => Some(Expr::PrefixExpr(PrefixExpr { syntax })), | 376 | PREFIX_EXPR => Some(Expr::PrefixExpr(PrefixExpr { syntax })), |
376 | RANGE_EXPR => Some(Expr::RangeExpr(RangeExpr { syntax })), | 377 | RANGE_EXPR => Some(Expr::RangeExpr(RangeExpr { syntax })), |
377 | BIN_EXPR => Some(Expr::BinExpr(BinExpr { syntax })), | 378 | BIN_EXPR => Some(Expr::BinExpr(BinExpr { syntax })), |
379 | LITERAL => Some(Expr::Literal(Literal { syntax })), | ||
378 | _ => None, | 380 | _ => None, |
379 | } | 381 | } |
380 | } | 382 | } |
@@ -411,6 +413,7 @@ impl<'a> AstNode<'a> for Expr<'a> { | |||
411 | Expr::PrefixExpr(inner) => inner.syntax(), | 413 | Expr::PrefixExpr(inner) => inner.syntax(), |
412 | Expr::RangeExpr(inner) => inner.syntax(), | 414 | Expr::RangeExpr(inner) => inner.syntax(), |
413 | Expr::BinExpr(inner) => inner.syntax(), | 415 | Expr::BinExpr(inner) => inner.syntax(), |
416 | Expr::Literal(inner) => inner.syntax(), | ||
414 | } | 417 | } |
415 | } | 418 | } |
416 | } | 419 | } |
@@ -726,6 +729,24 @@ impl<'a> LetStmt<'a> { | |||
726 | } | 729 | } |
727 | } | 730 | } |
728 | 731 | ||
732 | // Literal | ||
733 | #[derive(Debug, Clone, Copy)] | ||
734 | pub struct Literal<'a> { | ||
735 | syntax: SyntaxNodeRef<'a>, | ||
736 | } | ||
737 | |||
738 | impl<'a> AstNode<'a> for Literal<'a> { | ||
739 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
740 | match syntax.kind() { | ||
741 | LITERAL => Some(Literal { syntax }), | ||
742 | _ => None, | ||
743 | } | ||
744 | } | ||
745 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
746 | } | ||
747 | |||
748 | impl<'a> Literal<'a> {} | ||
749 | |||
729 | // LoopExpr | 750 | // LoopExpr |
730 | #[derive(Debug, Clone, Copy)] | 751 | #[derive(Debug, Clone, Copy)] |
731 | pub struct LoopExpr<'a> { | 752 | pub struct LoopExpr<'a> { |
diff --git a/crates/libsyntax2/src/grammar.ron b/crates/libsyntax2/src/grammar.ron index 7217a4633..c3a29c10c 100644 --- a/crates/libsyntax2/src/grammar.ron +++ b/crates/libsyntax2/src/grammar.ron | |||
@@ -384,6 +384,7 @@ Grammar( | |||
384 | "PrefixExpr": (), | 384 | "PrefixExpr": (), |
385 | "RangeExpr": (), | 385 | "RangeExpr": (), |
386 | "BinExpr": (), | 386 | "BinExpr": (), |
387 | "Literal": (), | ||
387 | 388 | ||
388 | "Expr": ( | 389 | "Expr": ( |
389 | enum: [ | 390 | enum: [ |
@@ -418,6 +419,7 @@ Grammar( | |||
418 | "PrefixExpr", | 419 | "PrefixExpr", |
419 | "RangeExpr", | 420 | "RangeExpr", |
420 | "BinExpr", | 421 | "BinExpr", |
422 | "Literal", | ||
421 | ], | 423 | ], |
422 | ), | 424 | ), |
423 | 425 | ||