David Tolnay | 4b4c4b6 | 2018-01-06 13:48:05 -0800 | [diff] [blame] | 1 | //! This crate automatically generates the definition of the `Visit`, |
| 2 | //! `VisitMut`, and `Fold` traits in `syn` based on the `syn` source. It |
Nika Layzell | 2772666 | 2017-10-24 23:16:35 -0400 | [diff] [blame] | 3 | //! discovers structs and enums declared with the `ast_*` macros and generates |
| 4 | //! the functions for those types. |
| 5 | //! |
| 6 | //! It makes a few assumptions about the target crate: |
| 7 | //! 1. All structs which are discovered must be re-exported in the root of the |
| 8 | //! crate, even if they were declared in a submodule. |
| 9 | //! 2. This code cannot discover submodules which are located in subdirectories |
| 10 | //! - only submodules located in the same directory. |
| 11 | //! 3. The path to `syn` is hardcoded. |
| 12 | |
David Tolnay | 6af4899 | 2018-08-01 11:16:28 -0700 | [diff] [blame] | 13 | #![recursion_limit = "128"] |
David Tolnay | c1f5579 | 2018-11-21 01:39:42 -0800 | [diff] [blame] | 14 | #![allow(clippy::needless_pass_by_value)] |
David Tolnay | ea9ae89 | 2017-12-26 01:44:32 -0500 | [diff] [blame] | 15 | |
Carl Lerche | 058ff47 | 2019-02-13 16:23:52 -0800 | [diff] [blame] | 16 | mod gen; |
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; |
| 19 | mod types; |
David Tolnay | 8c81f62 | 2018-07-31 23:34:35 -0700 | [diff] [blame] | 20 | |
Nika Layzell | 2772666 | 2017-10-24 23:16:35 -0400 | [diff] [blame] | 21 | fn main() { |
Carl Lerche | 058ff47 | 2019-02-13 16:23:52 -0800 | [diff] [blame] | 22 | let types = parse::parse(); |
| 23 | gen::generate(&types); |
Carl Lerche | 9a7d588 | 2019-02-15 12:27:04 -0800 | [diff] [blame] | 24 | json::generate(&types); |
Nika Layzell | 2772666 | 2017-10-24 23:16:35 -0400 | [diff] [blame] | 25 | } |