aboutsummaryrefslogtreecommitdiff
path: root/xtask/src
diff options
context:
space:
mode:
Diffstat (limited to 'xtask/src')
-rw-r--r--xtask/src/codegen/gen_syntax.rs2
-rw-r--r--xtask/src/codegen/rust.ungram41
2 files changed, 22 insertions, 21 deletions
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<String> {
374 #([#all_keywords_idents] => { $crate::SyntaxKind::#all_keywords };)* 374 #([#all_keywords_idents] => { $crate::SyntaxKind::#all_keywords };)*
375 [lifetime] => { $crate::SyntaxKind::LIFETIME }; 375 [lifetime] => { $crate::SyntaxKind::LIFETIME };
376 [ident] => { $crate::SyntaxKind::IDENT }; 376 [ident] => { $crate::SyntaxKind::IDENT };
377 [shebang] => { $crate::SyntaxKind::SHEBANG };
377 } 378 }
378 }; 379 };
379 380
@@ -595,7 +596,6 @@ fn lower_rule(acc: &mut Vec<Field>, grammar: &Grammar, rule: &Rule) {
595} 596}
596 597
597fn deduplicate_fields(ast: &mut AstSrc) { 598fn deduplicate_fields(ast: &mut AstSrc) {
598 eprintln!();
599 for node in &mut ast.nodes { 599 for node in &mut ast.nodes {
600 let mut i = 0; 600 let mut i = 0;
601 'outer: while i < node.fields.len() { 601 'outer: while i < node.fields.len() {
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram
index b6ec5d5e7..a93cb3815 100644
--- a/xtask/src/codegen/rust.ungram
+++ b/xtask/src/codegen/rust.ungram
@@ -1,6 +1,23 @@
1SourceFile = 1SourceFile =
2 'shebang'?
2 Attr* 3 Attr*
3 items:ModuleItem* 4 Item*
5
6Item =
7 ConstDef
8| EnumDef
9| ExternBlock
10| ExternCrateItem
11| FnDef
12| ImplDef
13| MacroCall
14| Module
15| StaticDef
16| StructDef
17| TraitDef
18| TypeAliasDef
19| UnionDef
20| UseItem
4 21
5FnDef = 22FnDef =
6 Attr* Visibility? Abi? 'const' 'default' 'async' 'unsafe' 'fn' Name TypeParamList? 23 Attr* Visibility? Abi? 'const' 'default' 'async' 'unsafe' 'fn' Name TypeParamList?
@@ -59,7 +76,7 @@ Module =
59ItemList = 76ItemList =
60 '{' 77 '{'
61 AssocItem* 78 AssocItem*
62 items:ModuleItem* 79 Item*
63 '}' 80 '}'
64 81
65ConstDef = 82ConstDef =
@@ -168,7 +185,7 @@ Label =
168BlockExpr = 185BlockExpr =
169 Attr* Label 186 Attr* Label
170 '{' 187 '{'
171 items:ModuleItem* 188 Item*
172 statements:Stmt* 189 statements:Stmt*
173 Expr? 190 Expr?
174 '}' 191 '}'
@@ -316,7 +333,7 @@ TokenTree =
316 '(' ')' | '{' '}' | '[' ']' 333 '(' ')' | '{' '}' | '[' ']'
317 334
318MacroItems = 335MacroItems =
319 items:ModuleItem* 336 Item*
320 337
321MacroStmts = 338MacroStmts =
322 statements:Stmt* 339 statements:Stmt*
@@ -454,22 +471,6 @@ AssocItem =
454ExternItem = 471ExternItem =
455 FnDef | StaticDef 472 FnDef | StaticDef
456 473
457ModuleItem =
458 StructDef
459| UnionDef
460| EnumDef
461| FnDef
462| TraitDef
463| TypeAliasDef
464| ImplDef
465| UseItem
466| ExternCrateItem
467| ConstDef
468| StaticDef
469| Module
470| MacroCall
471| ExternBlock
472
473AttrInput = 474AttrInput =
474 Literal 475 Literal
475| TokenTree 476| TokenTree