Merge #5624
5624: Finalize expressions grammar r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
7325283c69
@ -1,7 +1,7 @@
|
||||
use ra_syntax::{
|
||||
ast::{self, AstNode},
|
||||
SyntaxKind::{
|
||||
BLOCK_EXPR, BREAK_EXPR, COMMENT, LAMBDA_EXPR, LOOP_EXPR, MATCH_ARM, PATH_EXPR, RETURN_EXPR,
|
||||
BLOCK_EXPR, BREAK_EXPR, CLOSURE_EXPR, COMMENT, LOOP_EXPR, MATCH_ARM, PATH_EXPR, RETURN_EXPR,
|
||||
},
|
||||
SyntaxNode,
|
||||
};
|
||||
@ -148,7 +148,7 @@ fn from(to_extract: &ast::Expr) -> Option<Anchor> {
|
||||
}
|
||||
|
||||
if let Some(parent) = node.parent() {
|
||||
if parent.kind() == MATCH_ARM || parent.kind() == LAMBDA_EXPR {
|
||||
if parent.kind() == MATCH_ARM || parent.kind() == CLOSURE_EXPR {
|
||||
return Some(Anchor::WrapInBlock(node));
|
||||
}
|
||||
}
|
||||
|
@ -224,9 +224,22 @@ fn collect_expr(&mut self, expr: ast::Expr) -> ExprId {
|
||||
self.alloc_expr(Expr::Unsafe { body }, syntax_ptr)
|
||||
}
|
||||
// FIXME: we need to record these effects somewhere...
|
||||
ast::Effect::Async(_) | ast::Effect::Label(_) => {
|
||||
self.collect_block_opt(e.block_expr())
|
||||
}
|
||||
ast::Effect::Label(label) => match e.block_expr() {
|
||||
Some(block) => {
|
||||
let res = self.collect_block(block);
|
||||
match &mut self.body.exprs[res] {
|
||||
Expr::Block { label: block_label, .. } => {
|
||||
*block_label =
|
||||
label.lifetime_token().map(|t| Name::new_lifetime(&t))
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
res
|
||||
}
|
||||
None => self.missing_expr(),
|
||||
},
|
||||
// FIXME: we need to record these effects somewhere...
|
||||
ast::Effect::Async(_) => self.collect_block_opt(e.block_expr()),
|
||||
},
|
||||
ast::Expr::BlockExpr(e) => self.collect_block(e),
|
||||
ast::Expr::LoopExpr(e) => {
|
||||
@ -460,7 +473,7 @@ fn collect_expr(&mut self, expr: ast::Expr) -> ExprId {
|
||||
self.alloc_expr(Expr::Missing, syntax_ptr)
|
||||
}
|
||||
}
|
||||
ast::Expr::LambdaExpr(e) => {
|
||||
ast::Expr::ClosureExpr(e) => {
|
||||
let mut args = Vec::new();
|
||||
let mut arg_types = Vec::new();
|
||||
if let Some(pl) = e.param_list() {
|
||||
@ -618,8 +631,7 @@ fn collect_block(&mut self, block: ast::BlockExpr) -> ExprId {
|
||||
})
|
||||
.collect();
|
||||
let tail = block.expr().map(|e| self.collect_expr(e));
|
||||
let label = block.label().and_then(|l| l.lifetime_token()).map(|t| Name::new_lifetime(&t));
|
||||
self.alloc_expr(Expr::Block { statements, tail, label }, syntax_node_ptr)
|
||||
self.alloc_expr(Expr::Block { statements, tail, label: None }, syntax_node_ptr)
|
||||
}
|
||||
|
||||
fn collect_block_items(&mut self, block: &ast::BlockExpr) {
|
||||
|
@ -379,7 +379,7 @@ fn to_fragment_kind(db: &dyn AstDatabase, id: MacroCallId) -> FragmentKind {
|
||||
|
||||
FOR_EXPR => FragmentKind::Expr,
|
||||
PATH_EXPR => FragmentKind::Expr,
|
||||
LAMBDA_EXPR => FragmentKind::Expr,
|
||||
CLOSURE_EXPR => FragmentKind::Expr,
|
||||
CONDITION => FragmentKind::Expr,
|
||||
BREAK_EXPR => FragmentKind::Expr,
|
||||
RETURN_EXPR => FragmentKind::Expr,
|
||||
|
@ -134,7 +134,7 @@ pub(crate) fn is_in_loop_body(element: SyntaxElement) -> bool {
|
||||
NodeOrToken::Token(token) => token.parent(),
|
||||
};
|
||||
for node in leaf.ancestors() {
|
||||
if node.kind() == FN || node.kind() == LAMBDA_EXPR {
|
||||
if node.kind() == FN || node.kind() == CLOSURE_EXPR {
|
||||
break;
|
||||
}
|
||||
let loop_body = match_ast! {
|
||||
|
@ -250,7 +250,7 @@ fn lambda_expr(p: &mut Parser) -> CompletedMarker {
|
||||
p.error("expected expression");
|
||||
}
|
||||
}
|
||||
m.complete(p, LAMBDA_EXPR)
|
||||
m.complete(p, CLOSURE_EXPR)
|
||||
}
|
||||
|
||||
// test if_expr
|
||||
|
@ -173,7 +173,7 @@ pub enum SyntaxKind {
|
||||
ARRAY_EXPR,
|
||||
PAREN_EXPR,
|
||||
PATH_EXPR,
|
||||
LAMBDA_EXPR,
|
||||
CLOSURE_EXPR,
|
||||
IF_EXPR,
|
||||
WHILE_EXPR,
|
||||
CONDITION,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -12,7 +12,7 @@ SOURCE_FILE@0..42
|
||||
L_CURLY@10..11 "{"
|
||||
WHITESPACE@11..16 "\n "
|
||||
EXPR_STMT@16..24
|
||||
LAMBDA_EXPR@16..24
|
||||
CLOSURE_EXPR@16..24
|
||||
PARAM_LIST@16..18
|
||||
PIPE@16..17 "|"
|
||||
PIPE@17..18 "|"
|
||||
|
@ -117,7 +117,7 @@ SOURCE_FILE@0..389
|
||||
WHITESPACE@140..141
|
||||
EQ@141..142
|
||||
WHITESPACE@142..143
|
||||
LAMBDA_EXPR@143..389
|
||||
CLOSURE_EXPR@143..389
|
||||
PARAM_LIST@143..388
|
||||
PIPE@143..144
|
||||
PARAM@144..159
|
||||
|
@ -49,7 +49,7 @@ SOURCE_FILE@0..83
|
||||
IDENT@48..51 "map"
|
||||
ARG_LIST@51..57
|
||||
L_PAREN@51..52 "("
|
||||
LAMBDA_EXPR@52..56
|
||||
CLOSURE_EXPR@52..56
|
||||
PARAM_LIST@52..56
|
||||
PIPE@52..53 "|"
|
||||
PARAM@53..55
|
||||
|
@ -12,7 +12,7 @@ SOURCE_FILE@0..134
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
EXPR_STMT@15..21
|
||||
LAMBDA_EXPR@15..20
|
||||
CLOSURE_EXPR@15..20
|
||||
PARAM_LIST@15..17
|
||||
PIPE@15..16 "|"
|
||||
PIPE@16..17 "|"
|
||||
@ -23,7 +23,7 @@ SOURCE_FILE@0..134
|
||||
SEMICOLON@20..21 ";"
|
||||
WHITESPACE@21..26 "\n "
|
||||
EXPR_STMT@26..43
|
||||
LAMBDA_EXPR@26..42
|
||||
CLOSURE_EXPR@26..42
|
||||
PARAM_LIST@26..28
|
||||
PIPE@26..27 "|"
|
||||
PIPE@27..28 "|"
|
||||
@ -47,7 +47,7 @@ SOURCE_FILE@0..134
|
||||
SEMICOLON@42..43 ";"
|
||||
WHITESPACE@43..48 "\n "
|
||||
EXPR_STMT@48..54
|
||||
LAMBDA_EXPR@48..53
|
||||
CLOSURE_EXPR@48..53
|
||||
PARAM_LIST@48..51
|
||||
PIPE@48..49 "|"
|
||||
PARAM@49..50
|
||||
@ -64,7 +64,7 @@ SOURCE_FILE@0..134
|
||||
SEMICOLON@53..54 ";"
|
||||
WHITESPACE@54..59 "\n "
|
||||
EXPR_STMT@59..76
|
||||
LAMBDA_EXPR@59..75
|
||||
CLOSURE_EXPR@59..75
|
||||
MOVE_KW@59..63 "move"
|
||||
WHITESPACE@63..64 " "
|
||||
PARAM_LIST@64..73
|
||||
@ -91,7 +91,7 @@ SOURCE_FILE@0..134
|
||||
SEMICOLON@75..76 ";"
|
||||
WHITESPACE@76..81 "\n "
|
||||
EXPR_STMT@81..93
|
||||
LAMBDA_EXPR@81..92
|
||||
CLOSURE_EXPR@81..92
|
||||
ASYNC_KW@81..86 "async"
|
||||
WHITESPACE@86..87 " "
|
||||
PARAM_LIST@87..89
|
||||
@ -104,7 +104,7 @@ SOURCE_FILE@0..134
|
||||
SEMICOLON@92..93 ";"
|
||||
WHITESPACE@93..98 "\n "
|
||||
EXPR_STMT@98..109
|
||||
LAMBDA_EXPR@98..108
|
||||
CLOSURE_EXPR@98..108
|
||||
MOVE_KW@98..102 "move"
|
||||
WHITESPACE@102..103 " "
|
||||
PARAM_LIST@103..105
|
||||
@ -117,7 +117,7 @@ SOURCE_FILE@0..134
|
||||
SEMICOLON@108..109 ";"
|
||||
WHITESPACE@109..114 "\n "
|
||||
EXPR_STMT@114..131
|
||||
LAMBDA_EXPR@114..130
|
||||
CLOSURE_EXPR@114..130
|
||||
ASYNC_KW@114..119 "async"
|
||||
WHITESPACE@119..120 " "
|
||||
MOVE_KW@120..124 "move"
|
||||
|
@ -105,7 +105,7 @@ SOURCE_FILE@0..135
|
||||
WHITESPACE@117..118 " "
|
||||
EQ@118..119 "="
|
||||
WHITESPACE@119..120 " "
|
||||
LAMBDA_EXPR@120..131
|
||||
CLOSURE_EXPR@120..131
|
||||
ATTR@120..127
|
||||
POUND@120..121 "#"
|
||||
L_BRACK@121..122 "["
|
||||
|
@ -20,7 +20,7 @@ SOURCE_FILE@0..63
|
||||
WHITESPACE@22..23 " "
|
||||
EQ@23..24 "="
|
||||
WHITESPACE@24..25 " "
|
||||
LAMBDA_EXPR@25..59
|
||||
CLOSURE_EXPR@25..59
|
||||
PARAM_LIST@25..56
|
||||
PIPE@25..26 "|"
|
||||
PARAM@26..29
|
||||
|
@ -13,7 +13,7 @@ SOURCE_FILE@0..34
|
||||
WHITESPACE@11..12 " "
|
||||
EXPR_STMT@12..31
|
||||
CALL_EXPR@12..30
|
||||
LAMBDA_EXPR@12..28
|
||||
CLOSURE_EXPR@12..28
|
||||
PARAM_LIST@12..14
|
||||
PIPE@12..13 "|"
|
||||
PIPE@13..14 "|"
|
||||
|
@ -351,7 +351,7 @@ SOURCE_FILE@0..3813
|
||||
WHITESPACE@766..767 " "
|
||||
BLOCK_EXPR@767..777
|
||||
L_CURLY@767..768 "{"
|
||||
LAMBDA_EXPR@768..776
|
||||
CLOSURE_EXPR@768..776
|
||||
PARAM_LIST@768..770
|
||||
PIPE@768..769 "|"
|
||||
PIPE@769..770 "|"
|
||||
@ -1628,7 +1628,7 @@ SOURCE_FILE@0..3813
|
||||
CALL_EXPR@2950..2995
|
||||
PAREN_EXPR@2950..2971
|
||||
L_PAREN@2950..2951 "("
|
||||
LAMBDA_EXPR@2951..2970
|
||||
CLOSURE_EXPR@2951..2970
|
||||
PARAM_LIST@2951..2968
|
||||
PIPE@2951..2952 "|"
|
||||
PARAM@2952..2962
|
||||
|
@ -52,7 +52,7 @@ SOURCE_FILE@0..166
|
||||
IDENT@134..146 "catch_unwind"
|
||||
ARG_LIST@146..162
|
||||
L_PAREN@146..147 "("
|
||||
LAMBDA_EXPR@147..161
|
||||
CLOSURE_EXPR@147..161
|
||||
MOVE_KW@147..151 "move"
|
||||
WHITESPACE@151..152 " "
|
||||
PARAM_LIST@152..154
|
||||
|
@ -144,7 +144,7 @@ pub(crate) struct KindsSrc<'a> {
|
||||
"ARRAY_EXPR",
|
||||
"PAREN_EXPR",
|
||||
"PATH_EXPR",
|
||||
"LAMBDA_EXPR",
|
||||
"CLOSURE_EXPR",
|
||||
"IF_EXPR",
|
||||
"WHILE_EXPR",
|
||||
"CONDITION",
|
||||
|
@ -579,6 +579,21 @@ fn lower_rule(acc: &mut Vec<Field>, grammar: &Grammar, label: Option<&String>, r
|
||||
}
|
||||
Rule::Labeled { label: l, rule } => {
|
||||
assert!(label.is_none());
|
||||
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);
|
||||
}
|
||||
Rule::Seq(rules) | Rule::Alt(rules) => {
|
||||
|
@ -115,8 +115,8 @@ Union =
|
||||
RecordFieldList
|
||||
|
||||
AdtDef =
|
||||
Struct
|
||||
| Enum
|
||||
Enum
|
||||
| Struct
|
||||
| Union
|
||||
|
||||
Const =
|
||||
@ -136,10 +136,10 @@ AssocItemList =
|
||||
'{' Attr* AssocItem* '}'
|
||||
|
||||
AssocItem =
|
||||
Fn
|
||||
| TypeAlias
|
||||
| Const
|
||||
Const
|
||||
| Fn
|
||||
| MacroCall
|
||||
| TypeAlias
|
||||
|
||||
Impl =
|
||||
Attr* Visibility?
|
||||
@ -162,9 +162,9 @@ GenericParamList =
|
||||
'<' (GenericParam (',' GenericParam)* ','?)? '>'
|
||||
|
||||
GenericParam =
|
||||
LifetimeParam
|
||||
ConstParam
|
||||
| LifetimeParam
|
||||
| TypeParam
|
||||
| ConstParam
|
||||
|
||||
TypeParam =
|
||||
Attr* Name (':' TypeBoundList?)?
|
||||
@ -195,9 +195,9 @@ Attr =
|
||||
'#' '!'? '[' Path ('=' Literal | TokenTree)? ']'
|
||||
|
||||
Stmt =
|
||||
LetStmt
|
||||
| ExprStmt
|
||||
ExprStmt
|
||||
| Item
|
||||
| LetStmt
|
||||
|
||||
LetStmt =
|
||||
Attr* 'let' Pat (':' Type)?
|
||||
@ -206,20 +206,192 @@ LetStmt =
|
||||
ExprStmt =
|
||||
Attr* Expr ';'?
|
||||
|
||||
Expr =
|
||||
ArrayExpr
|
||||
| AwaitExpr
|
||||
| BinExpr
|
||||
| BlockExpr
|
||||
| BoxExpr
|
||||
| BreakExpr
|
||||
| CallExpr
|
||||
| CastExpr
|
||||
| ContinueExpr
|
||||
| EffectExpr
|
||||
| FieldExpr
|
||||
| ForExpr
|
||||
| IfExpr
|
||||
| IndexExpr
|
||||
| Label
|
||||
| ClosureExpr
|
||||
| Literal
|
||||
| LoopExpr
|
||||
| MacroCall
|
||||
| MatchExpr
|
||||
| MethodCallExpr
|
||||
| ParenExpr
|
||||
| PathExpr
|
||||
| PrefixExpr
|
||||
| RangeExpr
|
||||
| RecordExpr
|
||||
| RefExpr
|
||||
| ReturnExpr
|
||||
| TryExpr
|
||||
| TupleExpr
|
||||
| WhileExpr
|
||||
|
||||
Literal =
|
||||
Attr* 'int_number'
|
||||
|
||||
PathExpr =
|
||||
Attr* Path
|
||||
|
||||
BlockExpr =
|
||||
'{'
|
||||
Attr*
|
||||
statements:Stmt*
|
||||
Expr?
|
||||
'}'
|
||||
|
||||
RefExpr =
|
||||
Attr* '&' ('raw' |'mut' | 'const') Expr
|
||||
|
||||
TryExpr =
|
||||
Attr* Expr '?'
|
||||
|
||||
EffectExpr =
|
||||
Attr* Label? ('try' | 'unsafe' | 'async') BlockExpr
|
||||
|
||||
PrefixExpr =
|
||||
Attr* op:('-' | '!' | '*') Expr
|
||||
|
||||
BinExpr =
|
||||
Attr*
|
||||
lhs:Expr
|
||||
op:(
|
||||
'||' | '&&'
|
||||
| '==' | '!=' | '<=' | '>=' | '<' | '>'
|
||||
| '+' | '*' | '-' | '/' | '%' | '<<' | '>>' | '^' | '|' | '&'
|
||||
| '=' | '+=' | '/=' | '*=' | '%=' | '>>=' | '<<=' | '-=' | '|=' | '&=' | '^='
|
||||
)
|
||||
rhs:Expr
|
||||
|
||||
CastExpr =
|
||||
Attr* Expr 'as' Type
|
||||
|
||||
ParenExpr =
|
||||
Attr* '(' Attr* Expr ')'
|
||||
|
||||
ArrayExpr =
|
||||
Attr* '[' Attr* (
|
||||
(Expr (',' Expr)* ','?)?
|
||||
| Expr ';' Expr
|
||||
) ']'
|
||||
|
||||
IndexExpr =
|
||||
Attr* base:Expr '[' index:Expr ']'
|
||||
|
||||
TupleExpr =
|
||||
Attr* '(' Attr* (Expr (',' Expr)* ','?)? ')'
|
||||
|
||||
RecordExpr =
|
||||
Path RecordExprFieldList
|
||||
|
||||
RecordExprFieldList =
|
||||
'{'
|
||||
Attr*
|
||||
fields:(RecordExprField (',' RecordExprField)* ','?)
|
||||
('..' spread:Expr)?
|
||||
'}'
|
||||
|
||||
RecordExprField =
|
||||
Attr* NameRef (':' Expr)?
|
||||
|
||||
CallExpr =
|
||||
Attr* Expr ArgList
|
||||
|
||||
ArgList =
|
||||
'(' args:(Expr (',' Expr)* ','?)? ')'
|
||||
|
||||
MethodCallExpr =
|
||||
Attr* Expr '.' NameRef TypeArgList? ArgList
|
||||
|
||||
FieldExpr =
|
||||
Attr* Expr '.' NameRef
|
||||
|
||||
ClosureExpr =
|
||||
Attr* 'static'? 'async'? 'move'? ParamList RetType?
|
||||
body:Expr
|
||||
|
||||
IfExpr =
|
||||
Attr* 'if' Condition then_branch:BlockExpr
|
||||
('else' else_branch:(IfExpr | BlockExpr))?
|
||||
|
||||
Condition =
|
||||
'let' Pat '=' Expr
|
||||
| Expr
|
||||
|
||||
LoopExpr =
|
||||
Attr* Label? 'loop'
|
||||
loop_body:BlockExpr
|
||||
|
||||
ForExpr =
|
||||
Attr* Label? 'for' Pat 'in' iterable:Expr
|
||||
loop_body:BlockExpr
|
||||
|
||||
WhileExpr =
|
||||
Attr* Label? 'while' Condition
|
||||
loop_body:BlockExpr?
|
||||
|
||||
Label =
|
||||
'lifetime'
|
||||
|
||||
BreakExpr =
|
||||
Attr* 'break' 'lifetime'? Expr?
|
||||
|
||||
ContinueExpr =
|
||||
Attr* 'continue' 'lifetime'?
|
||||
|
||||
RangeExpr =
|
||||
Attr* start:Expr? op:('..' | '..=') end:Expr?
|
||||
|
||||
MatchExpr =
|
||||
Attr* 'match' Expr MatchArmList
|
||||
|
||||
MatchArmList =
|
||||
'{'
|
||||
Attr*
|
||||
arms:MatchArm*
|
||||
'}'
|
||||
|
||||
MatchArm =
|
||||
Attr* Pat guard:MatchGuard? '=>' Expr ','?
|
||||
|
||||
MatchGuard =
|
||||
'if' Expr
|
||||
|
||||
ReturnExpr =
|
||||
Attr* 'return' Expr?
|
||||
|
||||
AwaitExpr =
|
||||
Attr* Expr '.' 'await'
|
||||
|
||||
BoxExpr =
|
||||
Attr* 'box' Expr
|
||||
|
||||
Type =
|
||||
ParenType
|
||||
| TupleType
|
||||
| NeverType
|
||||
| PathType
|
||||
| PointerType
|
||||
| ArrayType
|
||||
| SliceType
|
||||
| ReferenceType
|
||||
| InferType
|
||||
ArrayType
|
||||
| DynTraitType
|
||||
| FnPointerType
|
||||
| ForType
|
||||
| ImplTraitType
|
||||
| DynTraitType
|
||||
| InferType
|
||||
| NeverType
|
||||
| ParenType
|
||||
| PathType
|
||||
| PointerType
|
||||
| ReferenceType
|
||||
| SliceType
|
||||
| TupleType
|
||||
|
||||
ParenType =
|
||||
'(' Type ')'
|
||||
@ -267,129 +439,6 @@ TypeBound =
|
||||
'lifetime'
|
||||
| '?'? Type
|
||||
|
||||
TupleExpr =
|
||||
Attr* '(' Expr* ')'
|
||||
|
||||
ArrayExpr =
|
||||
Attr* '[' (Expr* | Expr ';' Expr) ']'
|
||||
|
||||
ParenExpr =
|
||||
Attr* '(' Expr ')'
|
||||
|
||||
PathExpr =
|
||||
Path
|
||||
|
||||
LambdaExpr =
|
||||
Attr* 'static'? 'async'? 'move'? ParamList RetType?
|
||||
body:Expr
|
||||
|
||||
IfExpr =
|
||||
Attr* 'if' Condition
|
||||
|
||||
Condition =
|
||||
'let' Pat '=' Expr
|
||||
| Expr
|
||||
|
||||
EffectExpr =
|
||||
Attr* Label? ('try' | 'unsafe' | 'async') BlockExpr
|
||||
|
||||
LoopExpr =
|
||||
Attr* Label? 'loop'
|
||||
loop_body:BlockExpr?
|
||||
|
||||
ForExpr =
|
||||
Attr* Label? 'for' Pat 'in' iterable:Expr
|
||||
loop_body:BlockExpr?
|
||||
|
||||
WhileExpr =
|
||||
Attr* Label? 'while' Condition
|
||||
loop_body:BlockExpr?
|
||||
|
||||
ContinueExpr =
|
||||
Attr* 'continue' 'lifetime'?
|
||||
|
||||
BreakExpr =
|
||||
Attr* 'break' 'lifetime'? Expr?
|
||||
|
||||
Label =
|
||||
'lifetime'
|
||||
|
||||
BlockExpr =
|
||||
Attr* Label
|
||||
'{'
|
||||
statements:Stmt*
|
||||
Expr?
|
||||
'}'
|
||||
|
||||
ReturnExpr =
|
||||
Attr* 'return' Expr
|
||||
|
||||
CallExpr =
|
||||
Attr* Expr ArgList
|
||||
|
||||
MethodCallExpr =
|
||||
Attr* Expr '.' NameRef TypeArgList? ArgList
|
||||
|
||||
ArgList =
|
||||
'(' args:Expr* ')'
|
||||
|
||||
FieldExpr =
|
||||
Attr* Expr '.' NameRef
|
||||
|
||||
IndexExpr =
|
||||
Attr* '[' ']'
|
||||
|
||||
AwaitExpr =
|
||||
Attr* Expr '.' 'await'
|
||||
|
||||
TryExpr =
|
||||
Attr* Expr '?'
|
||||
|
||||
CastExpr =
|
||||
Attr* Expr 'as' Type
|
||||
|
||||
RefExpr =
|
||||
Attr* '&' ('raw' | 'mut' | 'const') Expr
|
||||
|
||||
PrefixExpr =
|
||||
Attr* Expr
|
||||
|
||||
BoxExpr =
|
||||
Attr* 'box' Expr
|
||||
|
||||
RangeExpr =
|
||||
Attr*
|
||||
|
||||
BinExpr =
|
||||
Attr*
|
||||
|
||||
Literal =
|
||||
'int_number'
|
||||
|
||||
MatchExpr =
|
||||
Attr* 'match' Expr MatchArmList
|
||||
|
||||
MatchArmList =
|
||||
'{' arms:MatchArm* '}'
|
||||
|
||||
MatchArm =
|
||||
Attr* Pat guard:MatchGuard? '=>' Expr
|
||||
|
||||
MatchGuard =
|
||||
'if' Expr
|
||||
|
||||
RecordExpr =
|
||||
Path RecordExprFieldList
|
||||
|
||||
RecordExprFieldList =
|
||||
'{'
|
||||
fields:RecordExprField*
|
||||
('..' spread:Expr)?
|
||||
'}'
|
||||
|
||||
RecordExprField =
|
||||
Attr* NameRef (':' Expr)?
|
||||
|
||||
OrPat =
|
||||
Pat*
|
||||
|
||||
@ -510,36 +559,3 @@ Pat =
|
||||
| RangePat
|
||||
| LiteralPat
|
||||
| MacroPat
|
||||
|
||||
Expr =
|
||||
TupleExpr
|
||||
| ArrayExpr
|
||||
| ParenExpr
|
||||
| PathExpr
|
||||
| LambdaExpr
|
||||
| IfExpr
|
||||
| LoopExpr
|
||||
| ForExpr
|
||||
| WhileExpr
|
||||
| ContinueExpr
|
||||
| BreakExpr
|
||||
| Label
|
||||
| BlockExpr
|
||||
| ReturnExpr
|
||||
| MatchExpr
|
||||
| RecordExpr
|
||||
| CallExpr
|
||||
| IndexExpr
|
||||
| MethodCallExpr
|
||||
| FieldExpr
|
||||
| AwaitExpr
|
||||
| TryExpr
|
||||
| EffectExpr
|
||||
| CastExpr
|
||||
| RefExpr
|
||||
| PrefixExpr
|
||||
| RangeExpr
|
||||
| BinExpr
|
||||
| Literal
|
||||
| MacroCall
|
||||
| BoxExpr
|
||||
|
Loading…
Reference in New Issue
Block a user