diff options
Diffstat (limited to 'xtask')
-rw-r--r-- | xtask/src/ast_src.rs | 2 | ||||
-rw-r--r-- | xtask/src/codegen/gen_syntax.rs | 1 | ||||
-rw-r--r-- | xtask/src/codegen/rust.ungram | 81 |
3 files changed, 47 insertions, 37 deletions
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index 427406249..762d9265e 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs | |||
@@ -208,7 +208,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
208 | "LIFETIME_PARAM", | 208 | "LIFETIME_PARAM", |
209 | "TYPE_PARAM", | 209 | "TYPE_PARAM", |
210 | "CONST_PARAM", | 210 | "CONST_PARAM", |
211 | "TYPE_ARG_LIST", | 211 | "GENERIC_ARG_LIST", |
212 | "LIFETIME_ARG", | 212 | "LIFETIME_ARG", |
213 | "TYPE_ARG", | 213 | "TYPE_ARG", |
214 | "ASSOC_TYPE_ARG", | 214 | "ASSOC_TYPE_ARG", |
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 @@ | |||
1 | Path = | ||
2 | (qualifier:Path '::')? segment:PathSegment | ||
3 | |||
4 | PathSegment = | ||
5 | 'crate' | 'self' | 'super' | ||
6 | | '::' NameRef | ||
7 | | NameRef GenericArgList? | ||
8 | | NameRef ParamList RetType? | ||
9 | | '<' PathType ('as' PathType)? '>' | ||
10 | |||
11 | GenericArgList = | ||
12 | '::'? '<' (GenericArg (',' GenericArg)* ','?)? '>' | ||
13 | |||
14 | GenericArg = | ||
15 | TypeArg | ||
16 | | AssocTypeArg | ||
17 | | LifetimeArg | ||
18 | | ConstArg | ||
19 | |||
20 | TypeArg = | ||
21 | Type | ||
22 | |||
23 | AssocTypeArg = | ||
24 | NameRef (':' TypeBoundList | '=' Type) | ||
25 | |||
26 | LifetimeArg = | ||
27 | 'lifetime' | ||
28 | |||
29 | ConstArg = | ||
30 | Expr | ||
31 | |||
1 | SourceFile = | 32 | SourceFile = |
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 | ||
242 | Literal = | 272 | Literal = |
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 | ||
245 | PathExpr = | 281 | PathExpr = |
246 | Attr* Path | 282 | Attr* Path |
@@ -313,7 +349,7 @@ ArgList = | |||
313 | '(' args:(Expr (',' Expr)* ','?)? ')' | 349 | '(' args:(Expr (',' Expr)* ','?)? ')' |
314 | 350 | ||
315 | MethodCallExpr = | 351 | MethodCallExpr = |
316 | Attr* Expr '.' NameRef TypeArgList? ArgList | 352 | Attr* Expr '.' NameRef GenericArgList? ArgList |
317 | 353 | ||
318 | FieldExpr = | 354 | FieldExpr = |
319 | Attr* Expr '.' NameRef | 355 | Attr* Expr '.' NameRef |
@@ -340,7 +376,7 @@ ForExpr = | |||
340 | 376 | ||
341 | WhileExpr = | 377 | WhileExpr = |
342 | Attr* Label? 'while' Condition | 378 | Attr* Label? 'while' Condition |
343 | loop_body:BlockExpr? | 379 | loop_body:BlockExpr |
344 | 380 | ||
345 | Label = | 381 | Label = |
346 | 'lifetime' | 382 | 'lifetime' |
@@ -418,13 +454,13 @@ SliceType = | |||
418 | '[' Type ']' | 454 | '[' Type ']' |
419 | 455 | ||
420 | InferType = | 456 | InferType = |
421 | '_' | 457 | '_' |
422 | 458 | ||
423 | FnPointerType = | 459 | FnPointerType = |
424 | 'const'? 'async'? 'unsafe'? Abi? 'fn' ParamList RetType? | 460 | 'const'? 'async'? 'unsafe'? Abi? 'fn' ParamList RetType? |
425 | 461 | ||
426 | ForType = | 462 | ForType = |
427 | 'for' GenericParamList Type | 463 | 'for' GenericParamList Type |
428 | 464 | ||
429 | ImplTraitType = | 465 | ImplTraitType = |
430 | 'impl' TypeBoundList | 466 | 'impl' TypeBoundList |
@@ -433,7 +469,7 @@ DynTraitType = | |||
433 | 'dyn' TypeBoundList | 469 | 'dyn' TypeBoundList |
434 | 470 | ||
435 | TypeBoundList = | 471 | TypeBoundList = |
436 | bounds:(TypeBound ('+' TypeBound)* '+'?) | 472 | bounds:(TypeBound ('+' TypeBound)* '+'?) |
437 | 473 | ||
438 | TypeBound = | 474 | TypeBound = |
439 | 'lifetime' | 475 | 'lifetime' |
@@ -513,33 +549,6 @@ MacroStmts = | |||
513 | statements:Stmt* | 549 | statements:Stmt* |
514 | Expr? | 550 | Expr? |
515 | 551 | ||
516 | Path = | ||
517 | (qualifier:Path '::')? segment:PathSegment | ||
518 | |||
519 | PathSegment = | ||
520 | '::' | 'crate' | 'self' | 'super' | ||
521 | | '<' NameRef TypeArgList ParamList RetType PathType '>' | ||
522 | |||
523 | TypeArgList = | ||
524 | '::'? '<' | ||
525 | TypeArg* | ||
526 | LifetimeArg* | ||
527 | AssocTypeArg* | ||
528 | ConstArg* | ||
529 | '>' | ||
530 | |||
531 | TypeArg = | ||
532 | Type | ||
533 | |||
534 | AssocTypeArg = | ||
535 | NameRef (':' TypeBoundList | '=' Type) | ||
536 | |||
537 | LifetimeArg = | ||
538 | 'lifetime' | ||
539 | |||
540 | ConstArg = | ||
541 | Literal | BlockExpr BlockExpr | ||
542 | |||
543 | Pat = | 552 | Pat = |
544 | OrPat | 553 | OrPat |
545 | | ParenPat | 554 | | ParenPat |