From 6636f56e79b55f22b88094b7edaed6ec88880500 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 00:23:03 +0200 Subject: Rename ModuleItem -> Item --- xtask/src/codegen/rust.ungram | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'xtask') diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index b6ec5d5e7..08db70093 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram @@ -1,6 +1,22 @@ SourceFile = Attr* - items:ModuleItem* + Item* + +Item = + ConstDef +| EnumDef +| ExternBlock +| ExternCrateItem +| FnDef +| ImplDef +| MacroCall +| Module +| StaticDef +| StructDef +| TraitDef +| TypeAliasDef +| UnionDef +| UseItem FnDef = Attr* Visibility? Abi? 'const' 'default' 'async' 'unsafe' 'fn' Name TypeParamList? @@ -59,7 +75,7 @@ Module = ItemList = '{' AssocItem* - items:ModuleItem* + Item* '}' ConstDef = @@ -168,7 +184,7 @@ Label = BlockExpr = Attr* Label '{' - items:ModuleItem* + Item* statements:Stmt* Expr? '}' @@ -316,7 +332,7 @@ TokenTree = '(' ')' | '{' '}' | '[' ']' MacroItems = - items:ModuleItem* + Item* MacroStmts = statements:Stmt* @@ -454,22 +470,6 @@ AssocItem = ExternItem = FnDef | StaticDef -ModuleItem = - StructDef -| UnionDef -| EnumDef -| FnDef -| TraitDef -| TypeAliasDef -| ImplDef -| UseItem -| ExternCrateItem -| ConstDef -| StaticDef -| Module -| MacroCall -| ExternBlock - AttrInput = Literal | TokenTree -- cgit v1.2.3 From ede5d17b0409f9d5a209aaf16508262dbd2a4489 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 00:27:00 +0200 Subject: Finish SourceFile grammar --- xtask/src/codegen/gen_syntax.rs | 2 +- xtask/src/codegen/rust.ungram | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'xtask') diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs index 24e8be1fb..9b49712c1 100644 --- a/xtask/src/codegen/gen_syntax.rs +++ b/xtask/src/codegen/gen_syntax.rs @@ -374,6 +374,7 @@ fn generate_syntax_kinds(grammar: KindsSrc<'_>) -> Result { #([#all_keywords_idents] => { $crate::SyntaxKind::#all_keywords };)* [lifetime] => { $crate::SyntaxKind::LIFETIME }; [ident] => { $crate::SyntaxKind::IDENT }; + [shebang] => { $crate::SyntaxKind::SHEBANG }; } }; @@ -595,7 +596,6 @@ fn lower_rule(acc: &mut Vec, grammar: &Grammar, rule: &Rule) { } fn deduplicate_fields(ast: &mut AstSrc) { - eprintln!(); for node in &mut ast.nodes { let mut i = 0; 'outer: while i < node.fields.len() { diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 08db70093..a93cb3815 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram @@ -1,4 +1,5 @@ SourceFile = + 'shebang'? Attr* Item* -- cgit v1.2.3