diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-31 17:50:43 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-31 17:50:43 +0100 |
commit | 5d9145ce10c7dff6caa397b7a6c561848399e4f9 (patch) | |
tree | 8db83308ee58e07dcfd5071462460a8a50f1ce91 /xtask/src | |
parent | 0392a894b7284b13a88a13171e6b8b29764921be (diff) | |
parent | c1c97b289662501cea93fdc10760e08702ff5950 (diff) |
Merge #5629
5629: Finalize Path grammar r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'xtask/src')
-rw-r--r-- | xtask/src/ast_src.rs | 2 | ||||
-rw-r--r-- | xtask/src/codegen/rust.ungram | 60 |
2 files changed, 33 insertions, 29 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/rust.ungram b/xtask/src/codegen/rust.ungram index bc1dd6761..1d8bed0b4 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* |
@@ -318,7 +349,7 @@ ArgList = | |||
318 | '(' args:(Expr (',' Expr)* ','?)? ')' | 349 | '(' args:(Expr (',' Expr)* ','?)? ')' |
319 | 350 | ||
320 | MethodCallExpr = | 351 | MethodCallExpr = |
321 | Attr* Expr '.' NameRef TypeArgList? ArgList | 352 | Attr* Expr '.' NameRef GenericArgList? ArgList |
322 | 353 | ||
323 | FieldExpr = | 354 | FieldExpr = |
324 | Attr* Expr '.' NameRef | 355 | Attr* Expr '.' NameRef |
@@ -521,33 +552,6 @@ MacroStmts = | |||
521 | statements:Stmt* | 552 | statements:Stmt* |
522 | Expr? | 553 | Expr? |
523 | 554 | ||
524 | Path = | ||
525 | (qualifier:Path '::')? segment:PathSegment | ||
526 | |||
527 | PathSegment = | ||
528 | '::' | 'crate' | 'self' | 'super' | ||
529 | | '<' NameRef TypeArgList ParamList RetType PathType '>' | ||
530 | |||
531 | TypeArgList = | ||
532 | '::'? '<' | ||
533 | TypeArg* | ||
534 | LifetimeArg* | ||
535 | AssocTypeArg* | ||
536 | ConstArg* | ||
537 | '>' | ||
538 | |||
539 | TypeArg = | ||
540 | Type | ||
541 | |||
542 | AssocTypeArg = | ||
543 | NameRef (':' TypeBoundList | '=' Type) | ||
544 | |||
545 | LifetimeArg = | ||
546 | 'lifetime' | ||
547 | |||
548 | ConstArg = | ||
549 | Literal | BlockExpr BlockExpr | ||
550 | |||
551 | Pat = | 555 | Pat = |
552 | OrPat | 556 | OrPat |
553 | | ParenPat | 557 | | ParenPat |