David Tolnay | 983cd14 | 2019-05-08 15:05:54 -0700 | [diff] [blame] | 1 | // This crate crawls the Syn source directory to find all structs and enums that |
| 2 | // form the Syn syntax tree. |
| 3 | // |
| 4 | // A machine-readable representation of the syntax tree is saved to syn.json in |
| 5 | // the repo root for other code generation tools to consume. The syn-codegen |
| 6 | // crate (https://docs.rs/syn-codegen/) provides the data structures for parsing |
| 7 | // and making use of syn.json from Rust code. |
| 8 | // |
| 9 | // Finally this crate generates the Visit, VisitMut, and Fold traits in Syn |
| 10 | // programmatically from the syntax tree description. |
Nika Layzell | 2772666 | 2017-10-24 23:16:35 -0400 | [diff] [blame] | 11 | |
David Tolnay | 6af4899 | 2018-08-01 11:16:28 -0700 | [diff] [blame] | 12 | #![recursion_limit = "128"] |
David Tolnay | c1f5579 | 2018-11-21 01:39:42 -0800 | [diff] [blame] | 13 | #![allow(clippy::needless_pass_by_value)] |
David Tolnay | ea9ae89 | 2017-12-26 01:44:32 -0500 | [diff] [blame] | 14 | |
David Tolnay | cec98a7 | 2019-05-08 15:23:19 -0700 | [diff] [blame] | 15 | mod file; |
David Tolnay | f1e57f0 | 2019-05-08 15:30:39 -0700 | [diff] [blame] | 16 | mod fold; |
Carl Lerche | 9a7d588 | 2019-02-15 12:27:04 -0800 | [diff] [blame] | 17 | mod json; |
Carl Lerche | 058ff47 | 2019-02-13 16:23:52 -0800 | [diff] [blame] | 18 | mod parse; |
David Tolnay | 1022712 | 2019-02-15 20:53:45 -0800 | [diff] [blame] | 19 | mod version; |
David Tolnay | 490b91b | 2019-05-08 15:46:09 -0700 | [diff] [blame^] | 20 | mod visit; |
| 21 | mod visit_mut; |
David Tolnay | 8c81f62 | 2018-07-31 23:34:35 -0700 | [diff] [blame] | 22 | |
Nika Layzell | 2772666 | 2017-10-24 23:16:35 -0400 | [diff] [blame] | 23 | fn main() { |
David Tolnay | 1022712 | 2019-02-15 20:53:45 -0800 | [diff] [blame] | 24 | let defs = parse::parse(); |
David Tolnay | 1022712 | 2019-02-15 20:53:45 -0800 | [diff] [blame] | 25 | json::generate(&defs); |
David Tolnay | f1e57f0 | 2019-05-08 15:30:39 -0700 | [diff] [blame] | 26 | fold::generate(&defs); |
David Tolnay | 490b91b | 2019-05-08 15:46:09 -0700 | [diff] [blame^] | 27 | visit::generate(&defs); |
| 28 | visit_mut::generate(&defs); |
Nika Layzell | 2772666 | 2017-10-24 23:16:35 -0400 | [diff] [blame] | 29 | } |