aboutsummaryrefslogtreecommitdiff
path: root/xtask
diff options
context:
space:
mode:
Diffstat (limited to 'xtask')
-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
3 files changed, 22 insertions, 10 deletions
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