From 07cbb7d73deed8dac3eecdbdc7e1eaf6938a6cd6 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 27 Aug 2018 12:22:09 +0300 Subject: Support if-let in scopes --- crates/libsyntax2/src/grammar.ron | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'crates/libsyntax2/src/grammar.ron') diff --git a/crates/libsyntax2/src/grammar.ron b/crates/libsyntax2/src/grammar.ron index f3c3d3036..c9e128462 100644 --- a/crates/libsyntax2/src/grammar.ron +++ b/crates/libsyntax2/src/grammar.ron @@ -162,9 +162,10 @@ Grammar( "PATH_EXPR", "LAMBDA_EXPR", "IF_EXPR", + "WHILE_EXPR", + "CONDITION", "LOOP_EXPR", "FOR_EXPR", - "WHILE_EXPR", "CONTINUE_EXPR", "BREAK_EXPR", "LABEL", @@ -336,14 +337,27 @@ Grammar( "ParenExpr": (), "PathExpr": (), "LambdaExpr": (), - "IfExpr": (), - "LoopExpr": (), - "ForExpr": (), - "WhileExpr": (), + "IfExpr": ( + options: [ ["condition", "Condition"] ] + ), + "LoopExpr": ( + options: [ ["body", "Block"] ] + ), + "ForExpr": ( + options: [ ["body", "Block"] ] + ), + "WhileExpr": ( + options: [ + ["condition", "Condition"], + ["body", "Block"], + ] + ), "ContinueExpr": (), "BreakExpr": (), "Label": (), - "BlockExpr": (), + "BlockExpr": ( + options: [ ["block", "Block"] ] + ), "ReturnExpr": (), "MatchExpr": (), "MatchArmList": (), @@ -432,11 +446,19 @@ Grammar( "TypeParamList": ( collections: [ ["type_params", "TypeParam" ] ]), "TypeParam": ( traits: ["NameOwner"] ), "WhereClause": (), - "ExprStmt": (), + "ExprStmt": ( + options: [ ["expr", "Expr"] ] + ), "LetStmt": ( options: [ ["pat", "Pat"], ["initializer", "Expr"], ]), + "Condition": ( + options: [ + [ "pat", "Pat" ], + [ "expr", "Expr" ], + ] + ), "Stmt": ( enum: ["ExprStmt", "LetStmt"], ), -- cgit v1.2.3