aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-31 16:08:58 +0100
committerAleksey Kladov <[email protected]>2020-07-31 16:08:58 +0100
commit633aace41108b74fe6c93c5ab04272067db033f9 (patch)
treed071a03fb2c191629da532c14c002c30328d1e04
parentbfcee63e75d6feb21cafbdf3887e0efd508b6b2e (diff)
Rename LambdaExpr -> ClosureExpr
-rw-r--r--crates/ra_assists/src/handlers/extract_variable.rs4
-rw-r--r--crates/ra_hir_def/src/body/lower.rs2
-rw-r--r--crates/ra_hir_expand/src/db.rs2
-rw-r--r--crates/ra_ide/src/completion/patterns.rs2
-rw-r--r--crates/ra_parser/src/grammar/expressions/atom.rs2
-rw-r--r--crates/ra_parser/src/syntax_kind/generated.rs2
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs35
-rw-r--r--crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast14
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast2
-rw-r--r--xtask/src/ast_src.rs2
-rw-r--r--xtask/src/codegen/gen_syntax.rs14
-rw-r--r--xtask/src/codegen/rust.ungram16
19 files changed, 59 insertions, 54 deletions
diff --git a/crates/ra_assists/src/handlers/extract_variable.rs b/crates/ra_assists/src/handlers/extract_variable.rs
index b925a2884..cc62db0c4 100644
--- a/crates/ra_assists/src/handlers/extract_variable.rs
+++ b/crates/ra_assists/src/handlers/extract_variable.rs
@@ -1,7 +1,7 @@
1use ra_syntax::{ 1use ra_syntax::{
2 ast::{self, AstNode}, 2 ast::{self, AstNode},
3 SyntaxKind::{ 3 SyntaxKind::{
4 BLOCK_EXPR, BREAK_EXPR, COMMENT, LAMBDA_EXPR, LOOP_EXPR, MATCH_ARM, PATH_EXPR, RETURN_EXPR, 4 BLOCK_EXPR, BREAK_EXPR, CLOSURE_EXPR, COMMENT, LOOP_EXPR, MATCH_ARM, PATH_EXPR, RETURN_EXPR,
5 }, 5 },
6 SyntaxNode, 6 SyntaxNode,
7}; 7};
@@ -148,7 +148,7 @@ impl Anchor {
148 } 148 }
149 149
150 if let Some(parent) = node.parent() { 150 if let Some(parent) = node.parent() {
151 if parent.kind() == MATCH_ARM || parent.kind() == LAMBDA_EXPR { 151 if parent.kind() == MATCH_ARM || parent.kind() == CLOSURE_EXPR {
152 return Some(Anchor::WrapInBlock(node)); 152 return Some(Anchor::WrapInBlock(node));
153 } 153 }
154 } 154 }
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index 67d7041fc..99d723402 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -473,7 +473,7 @@ impl ExprCollector<'_> {
473 self.alloc_expr(Expr::Missing, syntax_ptr) 473 self.alloc_expr(Expr::Missing, syntax_ptr)
474 } 474 }
475 } 475 }
476 ast::Expr::LambdaExpr(e) => { 476 ast::Expr::ClosureExpr(e) => {
477 let mut args = Vec::new(); 477 let mut args = Vec::new();
478 let mut arg_types = Vec::new(); 478 let mut arg_types = Vec::new();
479 if let Some(pl) = e.param_list() { 479 if let Some(pl) = e.param_list() {
diff --git a/crates/ra_hir_expand/src/db.rs b/crates/ra_hir_expand/src/db.rs
index 41df66696..f3b7cd492 100644
--- a/crates/ra_hir_expand/src/db.rs
+++ b/crates/ra_hir_expand/src/db.rs
@@ -379,7 +379,7 @@ fn to_fragment_kind(db: &dyn AstDatabase, id: MacroCallId) -> FragmentKind {
379 379
380 FOR_EXPR => FragmentKind::Expr, 380 FOR_EXPR => FragmentKind::Expr,
381 PATH_EXPR => FragmentKind::Expr, 381 PATH_EXPR => FragmentKind::Expr,
382 LAMBDA_EXPR => FragmentKind::Expr, 382 CLOSURE_EXPR => FragmentKind::Expr,
383 CONDITION => FragmentKind::Expr, 383 CONDITION => FragmentKind::Expr,
384 BREAK_EXPR => FragmentKind::Expr, 384 BREAK_EXPR => FragmentKind::Expr,
385 RETURN_EXPR => FragmentKind::Expr, 385 RETURN_EXPR => FragmentKind::Expr,
diff --git a/crates/ra_ide/src/completion/patterns.rs b/crates/ra_ide/src/completion/patterns.rs
index a68861e1c..9e654b373 100644
--- a/crates/ra_ide/src/completion/patterns.rs
+++ b/crates/ra_ide/src/completion/patterns.rs
@@ -134,7 +134,7 @@ pub(crate) fn is_in_loop_body(element: SyntaxElement) -> bool {
134 NodeOrToken::Token(token) => token.parent(), 134 NodeOrToken::Token(token) => token.parent(),
135 }; 135 };
136 for node in leaf.ancestors() { 136 for node in leaf.ancestors() {
137 if node.kind() == FN || node.kind() == LAMBDA_EXPR { 137 if node.kind() == FN || node.kind() == CLOSURE_EXPR {
138 break; 138 break;
139 } 139 }
140 let loop_body = match_ast! { 140 let loop_body = match_ast! {
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs
index 706a2f796..0b01d3bc6 100644
--- a/crates/ra_parser/src/grammar/expressions/atom.rs
+++ b/crates/ra_parser/src/grammar/expressions/atom.rs
@@ -250,7 +250,7 @@ fn lambda_expr(p: &mut Parser) -> CompletedMarker {
250 p.error("expected expression"); 250 p.error("expected expression");
251 } 251 }
252 } 252 }
253 m.complete(p, LAMBDA_EXPR) 253 m.complete(p, CLOSURE_EXPR)
254} 254}
255 255
256// test if_expr 256// test if_expr
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs
index 64ab18217..2830c0d74 100644
--- a/crates/ra_parser/src/syntax_kind/generated.rs
+++ b/crates/ra_parser/src/syntax_kind/generated.rs
@@ -173,7 +173,7 @@ pub enum SyntaxKind {
173 ARRAY_EXPR, 173 ARRAY_EXPR,
174 PAREN_EXPR, 174 PAREN_EXPR,
175 PATH_EXPR, 175 PATH_EXPR,
176 LAMBDA_EXPR, 176 CLOSURE_EXPR,
177 IF_EXPR, 177 IF_EXPR,
178 WHILE_EXPR, 178 WHILE_EXPR,
179 CONDITION, 179 CONDITION,
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 186db538b..158544fa2 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -582,9 +582,7 @@ pub struct BinExpr {
582 pub(crate) syntax: SyntaxNode, 582 pub(crate) syntax: SyntaxNode,
583} 583}
584impl ast::AttrsOwner for BinExpr {} 584impl ast::AttrsOwner for BinExpr {}
585impl BinExpr { 585impl BinExpr {}
586 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
587}
588#[derive(Debug, Clone, PartialEq, Eq, Hash)] 586#[derive(Debug, Clone, PartialEq, Eq, Hash)]
589pub struct BoxExpr { 587pub struct BoxExpr {
590 pub(crate) syntax: SyntaxNode, 588 pub(crate) syntax: SyntaxNode,
@@ -680,9 +678,7 @@ impl ast::AttrsOwner for IfExpr {}
680impl IfExpr { 678impl IfExpr {
681 pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } 679 pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) }
682 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } 680 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) }
683 pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
684 pub fn else_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![else]) } 681 pub fn else_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![else]) }
685 pub fn if_expr(&self) -> Option<IfExpr> { support::child(&self.syntax) }
686} 682}
687#[derive(Debug, Clone, PartialEq, Eq, Hash)] 683#[derive(Debug, Clone, PartialEq, Eq, Hash)]
688pub struct IndexExpr { 684pub struct IndexExpr {
@@ -690,7 +686,6 @@ pub struct IndexExpr {
690} 686}
691impl ast::AttrsOwner for IndexExpr {} 687impl ast::AttrsOwner for IndexExpr {}
692impl IndexExpr { 688impl IndexExpr {
693 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
694 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } 689 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
695 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } 690 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
696} 691}
@@ -704,11 +699,11 @@ impl Label {
704 } 699 }
705} 700}
706#[derive(Debug, Clone, PartialEq, Eq, Hash)] 701#[derive(Debug, Clone, PartialEq, Eq, Hash)]
707pub struct LambdaExpr { 702pub struct ClosureExpr {
708 pub(crate) syntax: SyntaxNode, 703 pub(crate) syntax: SyntaxNode,
709} 704}
710impl ast::AttrsOwner for LambdaExpr {} 705impl ast::AttrsOwner for ClosureExpr {}
711impl LambdaExpr { 706impl ClosureExpr {
712 pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } 707 pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) }
713 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } 708 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
714 pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) } 709 pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) }
@@ -778,9 +773,7 @@ pub struct RangeExpr {
778 pub(crate) syntax: SyntaxNode, 773 pub(crate) syntax: SyntaxNode,
779} 774}
780impl ast::AttrsOwner for RangeExpr {} 775impl ast::AttrsOwner for RangeExpr {}
781impl RangeExpr { 776impl RangeExpr {}
782 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
783}
784#[derive(Debug, Clone, PartialEq, Eq, Hash)] 777#[derive(Debug, Clone, PartialEq, Eq, Hash)]
785pub struct RecordExpr { 778pub struct RecordExpr {
786 pub(crate) syntax: SyntaxNode, 779 pub(crate) syntax: SyntaxNode,
@@ -1351,7 +1344,7 @@ pub enum Expr {
1351 IfExpr(IfExpr), 1344 IfExpr(IfExpr),
1352 IndexExpr(IndexExpr), 1345 IndexExpr(IndexExpr),
1353 Label(Label), 1346 Label(Label),
1354 LambdaExpr(LambdaExpr), 1347 ClosureExpr(ClosureExpr),
1355 Literal(Literal), 1348 Literal(Literal),
1356 LoopExpr(LoopExpr), 1349 LoopExpr(LoopExpr),
1357 MacroCall(MacroCall), 1350 MacroCall(MacroCall),
@@ -2101,8 +2094,8 @@ impl AstNode for Label {
2101 } 2094 }
2102 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2095 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2103} 2096}
2104impl AstNode for LambdaExpr { 2097impl AstNode for ClosureExpr {
2105 fn can_cast(kind: SyntaxKind) -> bool { kind == LAMBDA_EXPR } 2098 fn can_cast(kind: SyntaxKind) -> bool { kind == CLOSURE_EXPR }
2106 fn cast(syntax: SyntaxNode) -> Option<Self> { 2099 fn cast(syntax: SyntaxNode) -> Option<Self> {
2107 if Self::can_cast(syntax.kind()) { 2100 if Self::can_cast(syntax.kind()) {
2108 Some(Self { syntax }) 2101 Some(Self { syntax })
@@ -3114,8 +3107,8 @@ impl From<IndexExpr> for Expr {
3114impl From<Label> for Expr { 3107impl From<Label> for Expr {
3115 fn from(node: Label) -> Expr { Expr::Label(node) } 3108 fn from(node: Label) -> Expr { Expr::Label(node) }
3116} 3109}
3117impl From<LambdaExpr> for Expr { 3110impl From<ClosureExpr> for Expr {
3118 fn from(node: LambdaExpr) -> Expr { Expr::LambdaExpr(node) } 3111 fn from(node: ClosureExpr) -> Expr { Expr::ClosureExpr(node) }
3119} 3112}
3120impl From<Literal> for Expr { 3113impl From<Literal> for Expr {
3121 fn from(node: Literal) -> Expr { Expr::Literal(node) } 3114 fn from(node: Literal) -> Expr { Expr::Literal(node) }
@@ -3167,7 +3160,7 @@ impl AstNode for Expr {
3167 match kind { 3160 match kind {
3168 ARRAY_EXPR | AWAIT_EXPR | BIN_EXPR | BLOCK_EXPR | BOX_EXPR | BREAK_EXPR | CALL_EXPR 3161 ARRAY_EXPR | AWAIT_EXPR | BIN_EXPR | BLOCK_EXPR | BOX_EXPR | BREAK_EXPR | CALL_EXPR
3169 | CAST_EXPR | CONTINUE_EXPR | EFFECT_EXPR | FIELD_EXPR | FOR_EXPR | IF_EXPR 3162 | CAST_EXPR | CONTINUE_EXPR | EFFECT_EXPR | FIELD_EXPR | FOR_EXPR | IF_EXPR
3170 | INDEX_EXPR | LABEL | LAMBDA_EXPR | LITERAL | LOOP_EXPR | MACRO_CALL | MATCH_EXPR 3163 | INDEX_EXPR | LABEL | CLOSURE_EXPR | LITERAL | LOOP_EXPR | MACRO_CALL | MATCH_EXPR
3171 | METHOD_CALL_EXPR | PAREN_EXPR | PATH_EXPR | PREFIX_EXPR | RANGE_EXPR 3164 | METHOD_CALL_EXPR | PAREN_EXPR | PATH_EXPR | PREFIX_EXPR | RANGE_EXPR
3172 | RECORD_EXPR | REF_EXPR | RETURN_EXPR | TRY_EXPR | TUPLE_EXPR | WHILE_EXPR => true, 3165 | RECORD_EXPR | REF_EXPR | RETURN_EXPR | TRY_EXPR | TUPLE_EXPR | WHILE_EXPR => true,
3173 _ => false, 3166 _ => false,
@@ -3190,7 +3183,7 @@ impl AstNode for Expr {
3190 IF_EXPR => Expr::IfExpr(IfExpr { syntax }), 3183 IF_EXPR => Expr::IfExpr(IfExpr { syntax }),
3191 INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }), 3184 INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }),
3192 LABEL => Expr::Label(Label { syntax }), 3185 LABEL => Expr::Label(Label { syntax }),
3193 LAMBDA_EXPR => Expr::LambdaExpr(LambdaExpr { syntax }), 3186 CLOSURE_EXPR => Expr::ClosureExpr(ClosureExpr { syntax }),
3194 LITERAL => Expr::Literal(Literal { syntax }), 3187 LITERAL => Expr::Literal(Literal { syntax }),
3195 LOOP_EXPR => Expr::LoopExpr(LoopExpr { syntax }), 3188 LOOP_EXPR => Expr::LoopExpr(LoopExpr { syntax }),
3196 MACRO_CALL => Expr::MacroCall(MacroCall { syntax }), 3189 MACRO_CALL => Expr::MacroCall(MacroCall { syntax }),
@@ -3227,7 +3220,7 @@ impl AstNode for Expr {
3227 Expr::IfExpr(it) => &it.syntax, 3220 Expr::IfExpr(it) => &it.syntax,
3228 Expr::IndexExpr(it) => &it.syntax, 3221 Expr::IndexExpr(it) => &it.syntax,
3229 Expr::Label(it) => &it.syntax, 3222 Expr::Label(it) => &it.syntax,
3230 Expr::LambdaExpr(it) => &it.syntax, 3223 Expr::ClosureExpr(it) => &it.syntax,
3231 Expr::Literal(it) => &it.syntax, 3224 Expr::Literal(it) => &it.syntax,
3232 Expr::LoopExpr(it) => &it.syntax, 3225 Expr::LoopExpr(it) => &it.syntax,
3233 Expr::MacroCall(it) => &it.syntax, 3226 Expr::MacroCall(it) => &it.syntax,
@@ -3757,7 +3750,7 @@ impl std::fmt::Display for Label {
3757 std::fmt::Display::fmt(self.syntax(), f) 3750 std::fmt::Display::fmt(self.syntax(), f)
3758 } 3751 }
3759} 3752}
3760impl std::fmt::Display for LambdaExpr { 3753impl std::fmt::Display for ClosureExpr {
3761 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3754 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3762 std::fmt::Display::fmt(self.syntax(), f) 3755 std::fmt::Display::fmt(self.syntax(), f)
3763 } 3756 }
diff --git a/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast b/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast
index 1c3e0f65b..e0f1d0c27 100644
--- a/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast
+++ b/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast
@@ -12,7 +12,7 @@ [email protected]
12 [email protected] "{" 12 [email protected] "{"
13 [email protected] "\n " 13 [email protected] "\n "
14 [email protected] 14 [email protected]
15 LAMBDA[email protected] 15 CLOSURE[email protected]
16 [email protected] 16 [email protected]
17 [email protected] "|" 17 [email protected] "|"
18 [email protected] "|" 18 [email protected] "|"
diff --git a/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast b/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast
index d62906b99..0afa24b77 100644
--- a/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast
+++ b/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast
@@ -117,7 +117,7 @@ [email protected]
117 [email protected] 117 [email protected]
118 [email protected] 118 [email protected]
119 [email protected] 119 [email protected]
120 LAMBDA[email protected] 120 CLOSURE[email protected]
121 [email protected] 121 [email protected]
122 [email protected] 122 [email protected]
123 [email protected] 123 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast
index a98c31b0c..0678d4278 100644
--- a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast
+++ b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast
@@ -49,7 +49,7 @@ [email protected]
49 [email protected] "map" 49 [email protected] "map"
50 [email protected] 50 [email protected]
51 [email protected] "(" 51 [email protected] "("
52 LAMBDA[email protected] 52 CLOSURE[email protected]
53 [email protected] 53 [email protected]
54 [email protected] "|" 54 [email protected] "|"
55 [email protected] 55 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast
index 51a6c5170..a80d79563 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast
@@ -12,7 +12,7 @@ [email protected]
12 [email protected] "{" 12 [email protected] "{"
13 [email protected] "\n " 13 [email protected] "\n "
14 [email protected] 14 [email protected]
15 LAMBDA[email protected] 15 CLOSURE[email protected]
16 [email protected] 16 [email protected]
17 [email protected] "|" 17 [email protected] "|"
18 [email protected] "|" 18 [email protected] "|"
@@ -23,7 +23,7 @@ [email protected]
23 [email protected] ";" 23 [email protected] ";"
24 [email protected] "\n " 24 [email protected] "\n "
25 [email protected] 25 [email protected]
26 LAMBDA[email protected] 26 CLOSURE[email protected]
27 [email protected] 27 [email protected]
28 [email protected] "|" 28 [email protected] "|"
29 [email protected] "|" 29 [email protected] "|"
@@ -47,7 +47,7 @@ [email protected]
47 [email protected] ";" 47 [email protected] ";"
48 [email protected] "\n " 48 [email protected] "\n "
49 [email protected] 49 [email protected]
50 LAMBDA[email protected] 50 CLOSURE[email protected]
51 [email protected] 51 [email protected]
52 [email protected] "|" 52 [email protected] "|"
53 [email protected] 53 [email protected]
@@ -64,7 +64,7 @@ [email protected]
64 [email protected] ";" 64 [email protected] ";"
65 [email protected] "\n " 65 [email protected] "\n "
66 [email protected] 66 [email protected]
67 LAMBDA[email protected] 67 CLOSURE[email protected]
68 [email protected] "move" 68 [email protected] "move"
69 [email protected] " " 69 [email protected] " "
70 [email protected] 70 [email protected]
@@ -91,7 +91,7 @@ [email protected]
91 [email protected] ";" 91 [email protected] ";"
92 [email protected] "\n " 92 [email protected] "\n "
93 [email protected] 93 [email protected]
94 LAMBDA[email protected] 94 CLOSURE[email protected]
95 [email protected] "async" 95 [email protected] "async"
96 [email protected] " " 96 [email protected] " "
97 [email protected] 97 [email protected]
@@ -104,7 +104,7 @@ [email protected]
104 [email protected] ";" 104 [email protected] ";"
105 [email protected] "\n " 105 [email protected] "\n "
106 [email protected] 106 [email protected]
107 LAMBDA[email protected] 107 CLOSURE[email protected]
108 [email protected] "move" 108 [email protected] "move"
109 [email protected] " " 109 [email protected] " "
110 [email protected] 110 [email protected]
@@ -117,7 +117,7 @@ [email protected]
117 [email protected] ";" 117 [email protected] ";"
118 [email protected] "\n " 118 [email protected] "\n "
119 [email protected] 119 [email protected]
120 LAMBDA[email protected] 120 CLOSURE[email protected]
121 [email protected] "async" 121 [email protected] "async"
122 [email protected] " " 122 [email protected] " "
123 [email protected] "move" 123 [email protected] "move"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast b/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast
index 931e81f27..d2fd6e567 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast
@@ -105,7 +105,7 @@ [email protected]
105 [email protected] " " 105 [email protected] " "
106 [email protected] "=" 106 [email protected] "="
107 [email protected] " " 107 [email protected] " "
108 LAMBDA[email protected] 108 CLOSURE[email protected]
109 [email protected] 109 [email protected]
110 [email protected] "#" 110 [email protected] "#"
111 [email protected] "[" 111 [email protected] "["
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast b/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast
index c63a55a56..0a9f7c137 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast
@@ -20,7 +20,7 @@ [email protected]
20 [email protected] " " 20 [email protected] " "
21 [email protected] "=" 21 [email protected] "="
22 [email protected] " " 22 [email protected] " "
23 LAMBDA[email protected] 23 CLOSURE[email protected]
24 [email protected] 24 [email protected]
25 [email protected] "|" 25 [email protected] "|"
26 [email protected] 26 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast
index 9c071ec2e..aa4099a92 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast
@@ -13,7 +13,7 @@ [email protected]
13 [email protected] " " 13 [email protected] " "
14 [email protected] 14 [email protected]
15 [email protected] 15 [email protected]
16 LAMBDA[email protected] 16 CLOSURE[email protected]
17 [email protected] 17 [email protected]
18 [email protected] "|" 18 [email protected] "|"
19 [email protected] "|" 19 [email protected] "|"
diff --git a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast
index 66cd5727a..1d75ed08f 100644
--- a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast
@@ -351,7 +351,7 @@ [email protected]
351 [email protected] " " 351 [email protected] " "
352 [email protected] 352 [email protected]
353 [email protected] "{" 353 [email protected] "{"
354 LAMBDA[email protected] 354 CLOSURE[email protected]
355 [email protected] 355 [email protected]
356 [email protected] "|" 356 [email protected] "|"
357 [email protected] "|" 357 [email protected] "|"
@@ -1628,7 +1628,7 @@ [email protected]
1628 [email protected] 1628 [email protected]
1629 [email protected] 1629 [email protected]
1630 [email protected] "(" 1630 [email protected] "("
1631 LAMBDA[email protected] 1631 CLOSURE[email protected]
1632 [email protected] 1632 [email protected]
1633 [email protected] "|" 1633 [email protected] "|"
1634 [email protected] 1634 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast b/crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast
index c9e6d88eb..650f4e310 100644
--- a/crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast
@@ -52,7 +52,7 @@ [email protected]
52 [email protected] "catch_unwind" 52 [email protected] "catch_unwind"
53 [email protected] 53 [email protected]
54 [email protected] "(" 54 [email protected] "("
55 LAMBDA[email protected] 55 CLOSURE[email protected]
56 [email protected] "move" 56 [email protected] "move"
57 [email protected] " " 57 [email protected] " "
58 [email protected] 58 [email protected]
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs
index 38b60b2a5..427406249 100644
--- a/xtask/src/ast_src.rs
+++ b/xtask/src/ast_src.rs
@@ -144,7 +144,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc {
144 "ARRAY_EXPR", 144 "ARRAY_EXPR",
145 "PAREN_EXPR", 145 "PAREN_EXPR",
146 "PATH_EXPR", 146 "PATH_EXPR",
147 "LAMBDA_EXPR", 147 "CLOSURE_EXPR",
148 "IF_EXPR", 148 "IF_EXPR",
149 "WHILE_EXPR", 149 "WHILE_EXPR",
150 "CONDITION", 150 "CONDITION",
diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs
index 90f746e96..059538696 100644
--- a/xtask/src/codegen/gen_syntax.rs
+++ b/xtask/src/codegen/gen_syntax.rs
@@ -579,7 +579,19 @@ fn lower_rule(acc: &mut Vec<Field>, grammar: &Grammar, label: Option<&String>, r
579 } 579 }
580 Rule::Labeled { label: l, rule } => { 580 Rule::Labeled { label: l, rule } => {
581 assert!(label.is_none()); 581 assert!(label.is_none());
582 if l == "op" { 582 let manually_implemented = matches!(
583 l.as_str(),
584 "lhs"
585 | "rhs"
586 | "then_branch"
587 | "else_branch"
588 | "start"
589 | "end"
590 | "op"
591 | "index"
592 | "base"
593 );
594 if manually_implemented {
583 return; 595 return;
584 } 596 }
585 lower_rule(acc, grammar, Some(l), rule); 597 lower_rule(acc, grammar, Some(l), rule);
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram
index 93195befe..aef07cb1e 100644
--- a/xtask/src/codegen/rust.ungram
+++ b/xtask/src/codegen/rust.ungram
@@ -222,7 +222,7 @@ Expr =
222| IfExpr 222| IfExpr
223| IndexExpr 223| IndexExpr
224| Label 224| Label
225| LambdaExpr 225| ClosureExpr
226| Literal 226| Literal
227| LoopExpr 227| LoopExpr
228| MacroCall 228| MacroCall
@@ -266,14 +266,14 @@ PrefixExpr =
266 266
267BinExpr = 267BinExpr =
268 Attr* 268 Attr*
269 Expr 269 lhs:Expr
270 op:( 270 op:(
271 '||' | '&&' 271 '||' | '&&'
272 | '==' | '!=' | '<=' | '>=' | '<' | '>' 272 | '==' | '!=' | '<=' | '>=' | '<' | '>'
273 | '+' | '*' | '-' | '/' | '%' | '<<' | '>>' | '^' | '|' | '&' 273 | '+' | '*' | '-' | '/' | '%' | '<<' | '>>' | '^' | '|' | '&'
274 | '=' | '+=' | '/=' | '*=' | '%=' | '>>=' | '<<=' | '-=' | '|=' | '&=' | '^=' 274 | '=' | '+=' | '/=' | '*=' | '%=' | '>>=' | '<<=' | '-=' | '|=' | '&=' | '^='
275 ) 275 )
276 Expr 276 rhs:Expr
277 277
278CastExpr = 278CastExpr =
279 Attr* Expr 'as' Type 279 Attr* Expr 'as' Type
@@ -288,7 +288,7 @@ ArrayExpr =
288 ) ']' 288 ) ']'
289 289
290IndexExpr = 290IndexExpr =
291 Attr* Expr '[' Expr ']' 291 Attr* base:Expr '[' index:Expr ']'
292 292
293TupleExpr = 293TupleExpr =
294 Attr* '(' Attr* (Expr (',' Expr)* ','?)? ')' 294 Attr* '(' Attr* (Expr (',' Expr)* ','?)? ')'
@@ -318,13 +318,13 @@ MethodCallExpr =
318FieldExpr = 318FieldExpr =
319 Attr* Expr '.' NameRef 319 Attr* Expr '.' NameRef
320 320
321LambdaExpr = 321ClosureExpr =
322 Attr* 'static'? 'async'? 'move'? ParamList RetType? 322 Attr* 'static'? 'async'? 'move'? ParamList RetType?
323 body:Expr 323 body:Expr
324 324
325IfExpr = 325IfExpr =
326 Attr* 'if' Condition BlockExpr 326 Attr* 'if' Condition then_branch:BlockExpr
327 ('else' (IfExpr | BlockExpr))? 327 ('else' else_branch:(IfExpr | BlockExpr))?
328 328
329Condition = 329Condition =
330 'let' Pat '=' Expr 330 'let' Pat '=' Expr
@@ -352,7 +352,7 @@ ContinueExpr =
352 Attr* 'continue' 'lifetime'? 352 Attr* 'continue' 'lifetime'?
353 353
354RangeExpr = 354RangeExpr =
355 Attr* Expr? op:('..' | '..=') Expr? 355 Attr* start:Expr? op:('..' | '..=') end:Expr?
356 356
357MatchExpr = 357MatchExpr =
358 Attr* 'match' Expr MatchArmList 358 Attr* 'match' Expr MatchArmList