Rename LambdaExpr -> ClosureExpr

This commit is contained in:
Aleksey Kladov 2020-07-31 17:08:58 +02:00
parent bfcee63e75
commit 633aace411
19 changed files with 59 additions and 54 deletions

View file

@ -579,7 +579,19 @@ fn lower_rule(acc: &mut Vec<Field>, grammar: &Grammar, label: Option<&String>, r
}
Rule::Labeled { label: l, rule } => {
assert!(label.is_none());
if l == "op" {
let manually_implemented = matches!(
l.as_str(),
"lhs"
| "rhs"
| "then_branch"
| "else_branch"
| "start"
| "end"
| "op"
| "index"
| "base"
);
if manually_implemented {
return;
}
lower_rule(acc, grammar, Some(l), rule);

View file

@ -222,7 +222,7 @@ Expr =
| IfExpr
| IndexExpr
| Label
| LambdaExpr
| ClosureExpr
| Literal
| LoopExpr
| MacroCall
@ -266,14 +266,14 @@ PrefixExpr =
BinExpr =
Attr*
Expr
lhs:Expr
op:(
'||' | '&&'
| '==' | '!=' | '<=' | '>=' | '<' | '>'
| '+' | '*' | '-' | '/' | '%' | '<<' | '>>' | '^' | '|' | '&'
| '=' | '+=' | '/=' | '*=' | '%=' | '>>=' | '<<=' | '-=' | '|=' | '&=' | '^='
)
Expr
rhs:Expr
CastExpr =
Attr* Expr 'as' Type
@ -288,7 +288,7 @@ ArrayExpr =
) ']'
IndexExpr =
Attr* Expr '[' Expr ']'
Attr* base:Expr '[' index:Expr ']'
TupleExpr =
Attr* '(' Attr* (Expr (',' Expr)* ','?)? ')'
@ -318,13 +318,13 @@ MethodCallExpr =
FieldExpr =
Attr* Expr '.' NameRef
LambdaExpr =
ClosureExpr =
Attr* 'static'? 'async'? 'move'? ParamList RetType?
body:Expr
IfExpr =
Attr* 'if' Condition BlockExpr
('else' (IfExpr | BlockExpr))?
Attr* 'if' Condition then_branch:BlockExpr
('else' else_branch:(IfExpr | BlockExpr))?
Condition =
'let' Pat '=' Expr
@ -352,7 +352,7 @@ ContinueExpr =
Attr* 'continue' 'lifetime'?
RangeExpr =
Attr* Expr? op:('..' | '..=') Expr?
Attr* start:Expr? op:('..' | '..=') end:Expr?
MatchExpr =
Attr* 'match' Expr MatchArmList