From 6c41a205a908eb94f139f968f803e728fc3418c6 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 28 Aug 2018 14:21:37 +0300 Subject: join any block --- crates/libsyntax2/src/ast/generated.rs | 21 +++++++++++++++++++++ crates/libsyntax2/src/grammar.ron | 2 ++ 2 files changed, 23 insertions(+) (limited to 'crates/libsyntax2') 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> { PrefixExpr(PrefixExpr<'a>), RangeExpr(RangeExpr<'a>), BinExpr(BinExpr<'a>), + Literal(Literal<'a>), } impl<'a> AstNode<'a> for Expr<'a> { @@ -375,6 +376,7 @@ impl<'a> AstNode<'a> for Expr<'a> { PREFIX_EXPR => Some(Expr::PrefixExpr(PrefixExpr { syntax })), RANGE_EXPR => Some(Expr::RangeExpr(RangeExpr { syntax })), BIN_EXPR => Some(Expr::BinExpr(BinExpr { syntax })), + LITERAL => Some(Expr::Literal(Literal { syntax })), _ => None, } } @@ -411,6 +413,7 @@ impl<'a> AstNode<'a> for Expr<'a> { Expr::PrefixExpr(inner) => inner.syntax(), Expr::RangeExpr(inner) => inner.syntax(), Expr::BinExpr(inner) => inner.syntax(), + Expr::Literal(inner) => inner.syntax(), } } } @@ -726,6 +729,24 @@ impl<'a> LetStmt<'a> { } } +// Literal +#[derive(Debug, Clone, Copy)] +pub struct Literal<'a> { + syntax: SyntaxNodeRef<'a>, +} + +impl<'a> AstNode<'a> for Literal<'a> { + fn cast(syntax: SyntaxNodeRef<'a>) -> Option { + match syntax.kind() { + LITERAL => Some(Literal { syntax }), + _ => None, + } + } + fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } +} + +impl<'a> Literal<'a> {} + // LoopExpr #[derive(Debug, Clone, Copy)] 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( "PrefixExpr": (), "RangeExpr": (), "BinExpr": (), + "Literal": (), "Expr": ( enum: [ @@ -418,6 +419,7 @@ Grammar( "PrefixExpr", "RangeExpr", "BinExpr", + "Literal", ], ), -- cgit v1.2.3