From 572f1c08b6ba43bdd57c5cb99f79a08ecd821c1c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 31 Jul 2020 19:49:26 +0200 Subject: Minor gramamr reorder --- xtask/src/codegen/rust.ungram | 124 +++++++++++++++++++++--------------------- 1 file changed, 63 insertions(+), 61 deletions(-) (limited to 'xtask/src/codegen') diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 2e3b45011..27bf563b6 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram @@ -1,3 +1,9 @@ +Name = + 'ident' + +NameRef = + 'ident' | 'int_number' + Path = (qualifier:Path '::')? segment:PathSegment @@ -29,6 +35,21 @@ LifetimeArg = ConstArg = Expr +MacroCall = + Attr* Path '!' Name? TokenTree ';'? + +TokenTree = + '(' ')' +| '{' '}' +| '[' ']' + +MacroItems = + Item* + +MacroStmts = + statements:Stmt* + Expr? + SourceFile = 'shebang'? Attr* @@ -475,41 +496,37 @@ TypeBound = 'lifetime' | '?'? Type -OrPat = - Pat* - -ParenPat = - '(' Pat ')' - -RefPat = - '&' 'mut'? Pat - -BoxPat = - 'box' Path - -BindPat = - Attr* 'ref'? 'mut'? Name ('@' Pat)? - -PlaceholderPat = - '_' +Pat = + BindPat +| BoxPat +| DotDotPat +| LiteralPat +| MacroPat +| OrPat +| ParenPat +| PathPat +| PlaceholderPat +| RangePat +| RecordPat +| RefPat +| SlicePat +| TuplePat +| TupleStructPat -DotDotPat = - '..' +LiteralPat = + Literal PathPat = Path -SlicePat = - '[' args:Pat* ']' +PlaceholderPat = + '_' RangePat = - '..' | '..=' - -LiteralPat = - Literal + start:Pat op:('..' | '..=') end:Pat -MacroPat = - MacroCall +RefPat = + '&' 'mut'? Pat RecordPat = Path RecordFieldPatList @@ -522,46 +539,31 @@ RecordFieldPatList = '}' RecordFieldPat = - Attr* NameRef ':' Pat + Attr* (NameRef ':')? Pat -TupleStructPat = - Path '(' args:Pat* ')' +OrPat = + Pat* -TuplePat = - '(' args:Pat* ')' +ParenPat = + '(' Pat ')' -Name = - 'ident' +BoxPat = + 'box' Path -NameRef = - 'ident' | 'int_number' +BindPat = + Attr* 'ref'? 'mut'? Name ('@' Pat)? -MacroCall = - Attr* Path '!' Name? TokenTree ';'? +DotDotPat = + '..' -TokenTree = - '(' ')' | '{' '}' | '[' ']' +SlicePat = + '[' args:Pat* ']' -MacroItems = - Item* +MacroPat = + MacroCall -MacroStmts = - statements:Stmt* - Expr? +TupleStructPat = + Path '(' args:Pat* ')' -Pat = - OrPat -| ParenPat -| RefPat -| BoxPat -| BindPat -| PlaceholderPat -| DotDotPat -| PathPat -| RecordPat -| TupleStructPat -| TuplePat -| SlicePat -| RangePat -| LiteralPat -| MacroPat +TuplePat = + '(' args:Pat* ')' -- cgit v1.2.3