diff options
author | Aleksey Kladov <[email protected]> | 2020-05-02 00:18:19 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-05-02 10:21:39 +0100 |
commit | 4f2134cc33f07c09fe166cec42971828843bc0ef (patch) | |
tree | 0e2440d51717dd0dfcefbf77e5ef546f1ee5c60d /xtask | |
parent | 3c96de5380a09fe06752ce146edeb017ae8c701c (diff) |
Introduce EffectExpr
Diffstat (limited to 'xtask')
-rw-r--r-- | xtask/src/ast_src.rs | 19 | ||||
-rw-r--r-- | xtask/src/codegen/gen_syntax.rs | 1 |
2 files changed, 8 insertions, 12 deletions
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index 1abb62f6f..028f7cbe1 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs | |||
@@ -162,7 +162,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
162 | "RECORD_LIT", | 162 | "RECORD_LIT", |
163 | "RECORD_FIELD_LIST", | 163 | "RECORD_FIELD_LIST", |
164 | "RECORD_FIELD", | 164 | "RECORD_FIELD", |
165 | "TRY_BLOCK_EXPR", | 165 | "EFFECT_EXPR", |
166 | "BOX_EXPR", | 166 | "BOX_EXPR", |
167 | // postfix | 167 | // postfix |
168 | "CALL_EXPR", | 168 | "CALL_EXPR", |
@@ -177,7 +177,6 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
177 | "PREFIX_EXPR", | 177 | "PREFIX_EXPR", |
178 | "RANGE_EXPR", // just weird | 178 | "RANGE_EXPR", // just weird |
179 | "BIN_EXPR", | 179 | "BIN_EXPR", |
180 | "BLOCK", | ||
181 | "EXTERN_BLOCK", | 180 | "EXTERN_BLOCK", |
182 | "EXTERN_ITEM_LIST", | 181 | "EXTERN_ITEM_LIST", |
183 | "ENUM_VARIANT", | 182 | "ENUM_VARIANT", |
@@ -440,7 +439,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
440 | } | 439 | } |
441 | struct IfExpr: AttrsOwner { T![if], Condition } | 440 | struct IfExpr: AttrsOwner { T![if], Condition } |
442 | struct LoopExpr: AttrsOwner, LoopBodyOwner { T![loop] } | 441 | struct LoopExpr: AttrsOwner, LoopBodyOwner { T![loop] } |
443 | struct TryBlockExpr: AttrsOwner { T![try], body: BlockExpr } | 442 | struct EffectExpr: AttrsOwner { Label, T![try], T![unsafe], T![async], BlockExpr } |
444 | struct ForExpr: AttrsOwner, LoopBodyOwner { | 443 | struct ForExpr: AttrsOwner, LoopBodyOwner { |
445 | T![for], | 444 | T![for], |
446 | Pat, | 445 | Pat, |
@@ -451,7 +450,9 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
451 | struct ContinueExpr: AttrsOwner { T![continue], T![lifetime] } | 450 | struct ContinueExpr: AttrsOwner { T![continue], T![lifetime] } |
452 | struct BreakExpr: AttrsOwner { T![break], T![lifetime], Expr } | 451 | struct BreakExpr: AttrsOwner { T![break], T![lifetime], Expr } |
453 | struct Label { T![lifetime] } | 452 | struct Label { T![lifetime] } |
454 | struct BlockExpr: AttrsOwner { Label, T![unsafe], T![async], Block } | 453 | struct BlockExpr: AttrsOwner, ModuleItemOwner { |
454 | T!['{'], statements: [Stmt], Expr, T!['}'], | ||
455 | } | ||
455 | struct ReturnExpr: AttrsOwner { Expr } | 456 | struct ReturnExpr: AttrsOwner { Expr } |
456 | struct CallExpr: ArgListOwner { Expr } | 457 | struct CallExpr: ArgListOwner { Expr } |
457 | struct MethodCallExpr: AttrsOwner, ArgListOwner { | 458 | struct MethodCallExpr: AttrsOwner, ArgListOwner { |
@@ -460,7 +461,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
460 | struct IndexExpr: AttrsOwner { T!['['], T![']'] } | 461 | struct IndexExpr: AttrsOwner { T!['['], T![']'] } |
461 | struct FieldExpr: AttrsOwner { Expr, T![.], NameRef } | 462 | struct FieldExpr: AttrsOwner { Expr, T![.], NameRef } |
462 | struct AwaitExpr: AttrsOwner { Expr, T![.], T![await] } | 463 | struct AwaitExpr: AttrsOwner { Expr, T![.], T![await] } |
463 | struct TryExpr: AttrsOwner { T![try], Expr } | 464 | struct TryExpr: AttrsOwner { Expr, T![?] } |
464 | struct CastExpr: AttrsOwner { Expr, T![as], TypeRef } | 465 | struct CastExpr: AttrsOwner { Expr, T![as], TypeRef } |
465 | struct RefExpr: AttrsOwner { T![&], T![raw], T![mut], Expr } | 466 | struct RefExpr: AttrsOwner { T![&], T![raw], T![mut], Expr } |
466 | struct PrefixExpr: AttrsOwner { /*PrefixOp,*/ Expr } | 467 | struct PrefixExpr: AttrsOwner { /*PrefixOp,*/ Expr } |
@@ -556,12 +557,6 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
556 | T![;], | 557 | T![;], |
557 | } | 558 | } |
558 | struct Condition { T![let], Pat, T![=], Expr } | 559 | struct Condition { T![let], Pat, T![=], Expr } |
559 | struct Block: AttrsOwner, ModuleItemOwner { | ||
560 | T!['{'], | ||
561 | statements: [Stmt], | ||
562 | Expr, | ||
563 | T!['}'], | ||
564 | } | ||
565 | struct ParamList { | 560 | struct ParamList { |
566 | T!['('], | 561 | T!['('], |
567 | SelfParam, | 562 | SelfParam, |
@@ -722,7 +717,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
722 | FieldExpr, | 717 | FieldExpr, |
723 | AwaitExpr, | 718 | AwaitExpr, |
724 | TryExpr, | 719 | TryExpr, |
725 | TryBlockExpr, | 720 | EffectExpr, |
726 | CastExpr, | 721 | CastExpr, |
727 | RefExpr, | 722 | RefExpr, |
728 | PrefixExpr, | 723 | PrefixExpr, |
diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs index e9dc09552..8028575c5 100644 --- a/xtask/src/codegen/gen_syntax.rs +++ b/xtask/src/codegen/gen_syntax.rs | |||
@@ -432,6 +432,7 @@ impl Field<'_> { | |||
432 | ":" => "colon", | 432 | ":" => "colon", |
433 | "::" => "coloncolon", | 433 | "::" => "coloncolon", |
434 | "#" => "pound", | 434 | "#" => "pound", |
435 | "?" => "question_mark", | ||
435 | _ => name, | 436 | _ => name, |
436 | }; | 437 | }; |
437 | format_ident!("{}_token", name) | 438 | format_ident!("{}_token", name) |