aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/ast/generated.rs35
-rw-r--r--crates/ra_syntax/src/grammar.ron14
2 files changed, 24 insertions, 25 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index 7df6a9c46..24f72393a 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -378,7 +378,11 @@ impl<R: TreeRoot<RaTypes>> BreakExprNode<R> {
378} 378}
379 379
380 380
381impl<'a> BreakExpr<'a> {} 381impl<'a> BreakExpr<'a> {
382 pub fn expr(self) -> Option<Expr<'a>> {
383 super::child_opt(self)
384 }
385}
382 386
383// Byte 387// Byte
384#[derive(Debug, Clone, Copy,)] 388#[derive(Debug, Clone, Copy,)]
@@ -923,12 +927,7 @@ pub enum Expr<'a> {
923 BlockExpr(BlockExpr<'a>), 927 BlockExpr(BlockExpr<'a>),
924 ReturnExpr(ReturnExpr<'a>), 928 ReturnExpr(ReturnExpr<'a>),
925 MatchExpr(MatchExpr<'a>), 929 MatchExpr(MatchExpr<'a>),
926 MatchArmList(MatchArmList<'a>),
927 MatchArm(MatchArm<'a>),
928 MatchGuard(MatchGuard<'a>),
929 StructLit(StructLit<'a>), 930 StructLit(StructLit<'a>),
930 NamedFieldList(NamedFieldList<'a>),
931 NamedField(NamedField<'a>),
932 CallExpr(CallExpr<'a>), 931 CallExpr(CallExpr<'a>),
933 IndexExpr(IndexExpr<'a>), 932 IndexExpr(IndexExpr<'a>),
934 MethodCallExpr(MethodCallExpr<'a>), 933 MethodCallExpr(MethodCallExpr<'a>),
@@ -960,12 +959,7 @@ impl<'a> AstNode<'a> for Expr<'a> {
960 BLOCK_EXPR => Some(Expr::BlockExpr(BlockExpr { syntax })), 959 BLOCK_EXPR => Some(Expr::BlockExpr(BlockExpr { syntax })),
961 RETURN_EXPR => Some(Expr::ReturnExpr(ReturnExpr { syntax })), 960 RETURN_EXPR => Some(Expr::ReturnExpr(ReturnExpr { syntax })),
962 MATCH_EXPR => Some(Expr::MatchExpr(MatchExpr { syntax })), 961 MATCH_EXPR => Some(Expr::MatchExpr(MatchExpr { syntax })),
963 MATCH_ARM_LIST => Some(Expr::MatchArmList(MatchArmList { syntax })),
964 MATCH_ARM => Some(Expr::MatchArm(MatchArm { syntax })),
965 MATCH_GUARD => Some(Expr::MatchGuard(MatchGuard { syntax })),
966 STRUCT_LIT => Some(Expr::StructLit(StructLit { syntax })), 962 STRUCT_LIT => Some(Expr::StructLit(StructLit { syntax })),
967 NAMED_FIELD_LIST => Some(Expr::NamedFieldList(NamedFieldList { syntax })),
968 NAMED_FIELD => Some(Expr::NamedField(NamedField { syntax })),
969 CALL_EXPR => Some(Expr::CallExpr(CallExpr { syntax })), 963 CALL_EXPR => Some(Expr::CallExpr(CallExpr { syntax })),
970 INDEX_EXPR => Some(Expr::IndexExpr(IndexExpr { syntax })), 964 INDEX_EXPR => Some(Expr::IndexExpr(IndexExpr { syntax })),
971 METHOD_CALL_EXPR => Some(Expr::MethodCallExpr(MethodCallExpr { syntax })), 965 METHOD_CALL_EXPR => Some(Expr::MethodCallExpr(MethodCallExpr { syntax })),
@@ -997,12 +991,7 @@ impl<'a> AstNode<'a> for Expr<'a> {
997 Expr::BlockExpr(inner) => inner.syntax(), 991 Expr::BlockExpr(inner) => inner.syntax(),
998 Expr::ReturnExpr(inner) => inner.syntax(), 992 Expr::ReturnExpr(inner) => inner.syntax(),
999 Expr::MatchExpr(inner) => inner.syntax(), 993 Expr::MatchExpr(inner) => inner.syntax(),
1000 Expr::MatchArmList(inner) => inner.syntax(),
1001 Expr::MatchArm(inner) => inner.syntax(),
1002 Expr::MatchGuard(inner) => inner.syntax(),
1003 Expr::StructLit(inner) => inner.syntax(), 994 Expr::StructLit(inner) => inner.syntax(),
1004 Expr::NamedFieldList(inner) => inner.syntax(),
1005 Expr::NamedField(inner) => inner.syntax(),
1006 Expr::CallExpr(inner) => inner.syntax(), 995 Expr::CallExpr(inner) => inner.syntax(),
1007 Expr::IndexExpr(inner) => inner.syntax(), 996 Expr::IndexExpr(inner) => inner.syntax(),
1008 Expr::MethodCallExpr(inner) => inner.syntax(), 997 Expr::MethodCallExpr(inner) => inner.syntax(),
@@ -3880,6 +3869,10 @@ impl<'a> StructLit<'a> {
3880 pub fn named_field_list(self) -> Option<NamedFieldList<'a>> { 3869 pub fn named_field_list(self) -> Option<NamedFieldList<'a>> {
3881 super::child_opt(self) 3870 super::child_opt(self)
3882 } 3871 }
3872
3873 pub fn spread(self) -> Option<Expr<'a>> {
3874 super::child_opt(self)
3875 }
3883} 3876}
3884 3877
3885// StructPat 3878// StructPat
@@ -4147,7 +4140,15 @@ impl<R: TreeRoot<RaTypes>> TupleStructPatNode<R> {
4147} 4140}
4148 4141
4149 4142
4150impl<'a> TupleStructPat<'a> {} 4143impl<'a> TupleStructPat<'a> {
4144 pub fn args(self) -> impl Iterator<Item = Pat<'a>> + 'a {
4145 super::children(self)
4146 }
4147
4148 pub fn path(self) -> Option<Path<'a>> {
4149 super::child_opt(self)
4150 }
4151}
4151 4152
4152// TupleType 4153// TupleType
4153#[derive(Debug, Clone, Copy,)] 4154#[derive(Debug, Clone, Copy,)]
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index c55e9e07a..3c640ed47 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -384,7 +384,7 @@ Grammar(
384 options: [ "Condition" ] 384 options: [ "Condition" ]
385 ), 385 ),
386 "ContinueExpr": (), 386 "ContinueExpr": (),
387 "BreakExpr": (), 387 "BreakExpr": (options: ["Expr"]),
388 "Label": (), 388 "Label": (),
389 "BlockExpr": ( 389 "BlockExpr": (
390 options: [ "Block" ] 390 options: [ "Block" ]
@@ -404,7 +404,7 @@ Grammar(
404 collections: [ [ "pats", "Pat" ] ] 404 collections: [ [ "pats", "Pat" ] ]
405 ), 405 ),
406 "MatchGuard": (), 406 "MatchGuard": (),
407 "StructLit": (options: ["Path", "NamedFieldList"]), 407 "StructLit": (options: ["Path", "NamedFieldList", ["spread", "Expr"]]),
408 "NamedFieldList": (collections: [ ["fields", "NamedField"] ]), 408 "NamedFieldList": (collections: [ ["fields", "NamedField"] ]),
409 "NamedField": (options: ["NameRef", "Expr"]), 409 "NamedField": (options: ["NameRef", "Expr"]),
410 "CallExpr": ( 410 "CallExpr": (
@@ -446,12 +446,7 @@ Grammar(
446 "BlockExpr", 446 "BlockExpr",
447 "ReturnExpr", 447 "ReturnExpr",
448 "MatchExpr", 448 "MatchExpr",
449 "MatchArmList",
450 "MatchArm",
451 "MatchGuard",
452 "StructLit", 449 "StructLit",
453 "NamedFieldList",
454 "NamedField",
455 "CallExpr", 450 "CallExpr",
456 "IndexExpr", 451 "IndexExpr",
457 "MethodCallExpr", 452 "MethodCallExpr",
@@ -472,7 +467,10 @@ Grammar(
472 "PathPat": (), 467 "PathPat": (),
473 "StructPat": (), 468 "StructPat": (),
474 "FieldPatList": (), 469 "FieldPatList": (),
475 "TupleStructPat": (), 470 "TupleStructPat": (
471 options: ["Path"],
472 collections: [["args", "Pat"]],
473 ),
476 "TuplePat": (), 474 "TuplePat": (),
477 "SlicePat": (), 475 "SlicePat": (),
478 "RangePat": (), 476 "RangePat": (),