diff options
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 10 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar.ron | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 4afe1a146..435d90116 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -715,6 +715,7 @@ pub enum ExprKind<'a> { | |||
715 | RangeExpr(&'a RangeExpr), | 715 | RangeExpr(&'a RangeExpr), |
716 | BinExpr(&'a BinExpr), | 716 | BinExpr(&'a BinExpr), |
717 | Literal(&'a Literal), | 717 | Literal(&'a Literal), |
718 | MacroCall(&'a MacroCall), | ||
718 | } | 719 | } |
719 | impl<'a> From<&'a TupleExpr> for &'a Expr { | 720 | impl<'a> From<&'a TupleExpr> for &'a Expr { |
720 | fn from(n: &'a TupleExpr) -> &'a Expr { | 721 | fn from(n: &'a TupleExpr) -> &'a Expr { |
@@ -851,6 +852,11 @@ impl<'a> From<&'a Literal> for &'a Expr { | |||
851 | Expr::cast(&n.syntax).unwrap() | 852 | Expr::cast(&n.syntax).unwrap() |
852 | } | 853 | } |
853 | } | 854 | } |
855 | impl<'a> From<&'a MacroCall> for &'a Expr { | ||
856 | fn from(n: &'a MacroCall) -> &'a Expr { | ||
857 | Expr::cast(&n.syntax).unwrap() | ||
858 | } | ||
859 | } | ||
854 | 860 | ||
855 | 861 | ||
856 | impl AstNode for Expr { | 862 | impl AstNode for Expr { |
@@ -882,7 +888,8 @@ impl AstNode for Expr { | |||
882 | | PREFIX_EXPR | 888 | | PREFIX_EXPR |
883 | | RANGE_EXPR | 889 | | RANGE_EXPR |
884 | | BIN_EXPR | 890 | | BIN_EXPR |
885 | | LITERAL => Some(Expr::from_repr(syntax.into_repr())), | 891 | | LITERAL |
892 | | MACRO_CALL => Some(Expr::from_repr(syntax.into_repr())), | ||
886 | _ => None, | 893 | _ => None, |
887 | } | 894 | } |
888 | } | 895 | } |
@@ -924,6 +931,7 @@ impl Expr { | |||
924 | RANGE_EXPR => ExprKind::RangeExpr(RangeExpr::cast(&self.syntax).unwrap()), | 931 | RANGE_EXPR => ExprKind::RangeExpr(RangeExpr::cast(&self.syntax).unwrap()), |
925 | BIN_EXPR => ExprKind::BinExpr(BinExpr::cast(&self.syntax).unwrap()), | 932 | BIN_EXPR => ExprKind::BinExpr(BinExpr::cast(&self.syntax).unwrap()), |
926 | LITERAL => ExprKind::Literal(Literal::cast(&self.syntax).unwrap()), | 933 | LITERAL => ExprKind::Literal(Literal::cast(&self.syntax).unwrap()), |
934 | MACRO_CALL => ExprKind::MacroCall(MacroCall::cast(&self.syntax).unwrap()), | ||
927 | _ => unreachable!(), | 935 | _ => unreachable!(), |
928 | } | 936 | } |
929 | } | 937 | } |
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 6d7a5a1cb..3d97bea7f 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron | |||
@@ -494,6 +494,7 @@ Grammar( | |||
494 | "RangeExpr", | 494 | "RangeExpr", |
495 | "BinExpr", | 495 | "BinExpr", |
496 | "Literal", | 496 | "Literal", |
497 | "MacroCall", | ||
497 | ], | 498 | ], |
498 | ), | 499 | ), |
499 | 500 | ||