From 54fd09a9ca567fc79cae53237dfeedc5baeec635 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 31 Jul 2020 18:27:23 +0200 Subject: Finalize Path grammar --- xtask/src/codegen/rust.ungram | 57 +++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 27 deletions(-) (limited to 'xtask/src/codegen/rust.ungram') diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index bc1dd6761..13ad67ca1 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram @@ -1,3 +1,33 @@ +Path = + (qualifier:Path '::')? segment:PathSegment + +PathSegment = + '::' | 'crate' | 'self' | 'super' +| (NameRef ('::'? TypeArgList)?) +| NameRef ParamList RetType? +| '<' PathType ('as' PathType)? '>' + +TypeArgList = + '::'? '<' + TypeArg* + LifetimeArg* + AssocTypeArg* + ConstArg* + '>' + +TypeArg = + Type + +AssocTypeArg = + NameRef (':' TypeBoundList | '=' Type) + +LifetimeArg = + 'lifetime' + +ConstArg = + Literal | BlockExpr BlockExpr + + SourceFile = 'shebang'? Attr* @@ -521,33 +551,6 @@ MacroStmts = statements:Stmt* Expr? -Path = - (qualifier:Path '::')? segment:PathSegment - -PathSegment = - '::' | 'crate' | 'self' | 'super' -| '<' NameRef TypeArgList ParamList RetType PathType '>' - -TypeArgList = - '::'? '<' - TypeArg* - LifetimeArg* - AssocTypeArg* - ConstArg* - '>' - -TypeArg = - Type - -AssocTypeArg = - NameRef (':' TypeBoundList | '=' Type) - -LifetimeArg = - 'lifetime' - -ConstArg = - Literal | BlockExpr BlockExpr - Pat = OrPat | ParenPat -- cgit v1.2.3