From 136aba1cf32646278c4034541ee415f656f8bb5e Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sat, 5 Jan 2019 16:32:07 +0100 Subject: Add HIR Expr machinery --- crates/ra_syntax/src/ast/generated.rs | 10 +++++++++- crates/ra_syntax/src/grammar.ron | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'crates/ra_syntax') diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 7df6a9c46..deb4dea88 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs @@ -378,7 +378,11 @@ impl> BreakExprNode { } -impl<'a> BreakExpr<'a> {} +impl<'a> BreakExpr<'a> { + pub fn expr(self) -> Option> { + super::child_opt(self) + } +} // Byte #[derive(Debug, Clone, Copy,)] @@ -3880,6 +3884,10 @@ impl<'a> StructLit<'a> { pub fn named_field_list(self) -> Option> { super::child_opt(self) } + + pub fn spread(self) -> Option> { + super::child_opt(self) + } } // StructPat diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index c55e9e07a..5bcdf3f1d 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron @@ -384,7 +384,7 @@ Grammar( options: [ "Condition" ] ), "ContinueExpr": (), - "BreakExpr": (), + "BreakExpr": (options: ["Expr"]), "Label": (), "BlockExpr": ( options: [ "Block" ] @@ -404,7 +404,7 @@ Grammar( collections: [ [ "pats", "Pat" ] ] ), "MatchGuard": (), - "StructLit": (options: ["Path", "NamedFieldList"]), + "StructLit": (options: ["Path", "NamedFieldList", ["spread", "Expr"]]), "NamedFieldList": (collections: [ ["fields", "NamedField"] ]), "NamedField": (options: ["NameRef", "Expr"]), "CallExpr": ( -- cgit v1.2.3