aboutsummaryrefslogtreecommitdiff
path: root/xtask/src/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'xtask/src/codegen')
-rw-r--r--xtask/src/codegen/gen_syntax.rs1
-rw-r--r--xtask/src/codegen/rust.ungram81
2 files changed, 46 insertions, 36 deletions
diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs
index 059538696..e6231ece2 100644
--- a/xtask/src/codegen/gen_syntax.rs
+++ b/xtask/src/codegen/gen_syntax.rs
@@ -590,6 +590,7 @@ fn lower_rule(acc: &mut Vec<Field>, grammar: &Grammar, label: Option<&String>, r
590 | "op" 590 | "op"
591 | "index" 591 | "index"
592 | "base" 592 | "base"
593 | "value"
593 ); 594 );
594 if manually_implemented { 595 if manually_implemented {
595 return; 596 return;
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram
index b560202a1..2e3b45011 100644
--- a/xtask/src/codegen/rust.ungram
+++ b/xtask/src/codegen/rust.ungram
@@ -1,3 +1,34 @@
1Path =
2 (qualifier:Path '::')? segment:PathSegment
3
4PathSegment =
5 'crate' | 'self' | 'super'
6| '::' NameRef
7| NameRef GenericArgList?
8| NameRef ParamList RetType?
9| '<' PathType ('as' PathType)? '>'
10
11GenericArgList =
12 '::'? '<' (GenericArg (',' GenericArg)* ','?)? '>'
13
14GenericArg =
15 TypeArg
16| AssocTypeArg
17| LifetimeArg
18| ConstArg
19
20TypeArg =
21 Type
22
23AssocTypeArg =
24 NameRef (':' TypeBoundList | '=' Type)
25
26LifetimeArg =
27 'lifetime'
28
29ConstArg =
30 Expr
31
1SourceFile = 32SourceFile =
2 'shebang'? 33 'shebang'?
3 Attr* 34 Attr*
@@ -215,14 +246,13 @@ Expr =
215| BreakExpr 246| BreakExpr
216| CallExpr 247| CallExpr
217| CastExpr 248| CastExpr
249| ClosureExpr
218| ContinueExpr 250| ContinueExpr
219| EffectExpr 251| EffectExpr
220| FieldExpr 252| FieldExpr
221| ForExpr 253| ForExpr
222| IfExpr 254| IfExpr
223| IndexExpr 255| IndexExpr
224| Label
225| ClosureExpr
226| Literal 256| Literal
227| LoopExpr 257| LoopExpr
228| MacroCall 258| MacroCall
@@ -240,7 +270,13 @@ Expr =
240| WhileExpr 270| WhileExpr
241 271
242Literal = 272Literal =
243 Attr* 'int_number' 273 Attr* value:(
274 'int_number' | 'float_number'
275 | 'string' | 'raw_string'
276 | 'byte_string' | 'raw_byte_string'
277 | 'true' | 'false'
278 | 'char' | 'byte'
279 )
244 280
245PathExpr = 281PathExpr =
246 Attr* Path 282 Attr* Path
@@ -313,7 +349,7 @@ ArgList =
313 '(' args:(Expr (',' Expr)* ','?)? ')' 349 '(' args:(Expr (',' Expr)* ','?)? ')'
314 350
315MethodCallExpr = 351MethodCallExpr =
316 Attr* Expr '.' NameRef TypeArgList? ArgList 352 Attr* Expr '.' NameRef GenericArgList? ArgList
317 353
318FieldExpr = 354FieldExpr =
319 Attr* Expr '.' NameRef 355 Attr* Expr '.' NameRef
@@ -340,7 +376,7 @@ ForExpr =
340 376
341WhileExpr = 377WhileExpr =
342 Attr* Label? 'while' Condition 378 Attr* Label? 'while' Condition
343 loop_body:BlockExpr? 379 loop_body:BlockExpr
344 380
345Label = 381Label =
346 'lifetime' 382 'lifetime'
@@ -418,13 +454,13 @@ SliceType =
418 '[' Type ']' 454 '[' Type ']'
419 455
420InferType = 456InferType =
421 '_' 457 '_'
422 458
423FnPointerType = 459FnPointerType =
424 'const'? 'async'? 'unsafe'? Abi? 'fn' ParamList RetType? 460 'const'? 'async'? 'unsafe'? Abi? 'fn' ParamList RetType?
425 461
426ForType = 462ForType =
427 'for' GenericParamList Type 463 'for' GenericParamList Type
428 464
429ImplTraitType = 465ImplTraitType =
430 'impl' TypeBoundList 466 'impl' TypeBoundList
@@ -433,7 +469,7 @@ DynTraitType =
433 'dyn' TypeBoundList 469 'dyn' TypeBoundList
434 470
435TypeBoundList = 471TypeBoundList =
436 bounds:(TypeBound ('+' TypeBound)* '+'?) 472 bounds:(TypeBound ('+' TypeBound)* '+'?)
437 473
438TypeBound = 474TypeBound =
439 'lifetime' 475 'lifetime'
@@ -513,33 +549,6 @@ MacroStmts =
513 statements:Stmt* 549 statements:Stmt*
514 Expr? 550 Expr?
515 551
516Path =
517 (qualifier:Path '::')? segment:PathSegment
518
519PathSegment =
520 '::' | 'crate' | 'self' | 'super'
521| '<' NameRef TypeArgList ParamList RetType PathType '>'
522
523TypeArgList =
524 '::'? '<'
525 TypeArg*
526 LifetimeArg*
527 AssocTypeArg*
528 ConstArg*
529 '>'
530
531TypeArg =
532 Type
533
534AssocTypeArg =
535 NameRef (':' TypeBoundList | '=' Type)
536
537LifetimeArg =
538 'lifetime'
539
540ConstArg =
541 Literal | BlockExpr BlockExpr
542
543Pat = 552Pat =
544 OrPat 553 OrPat
545| ParenPat 554| ParenPat