xref: /third_party/rust/crates/syn/codegen/src/main.rs (revision fad3a1d3)
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.
11
12#![allow(
13    clippy::items_after_statements,
14    clippy::manual_let_else,
15    clippy::match_like_matches_macro,
16    clippy::similar_names,
17    clippy::too_many_lines,
18    clippy::uninlined_format_args
19)]
20
21mod cfg;
22mod clone;
23mod debug;
24mod eq;
25mod file;
26mod fold;
27mod full;
28mod gen;
29mod hash;
30mod json;
31mod lookup;
32mod operand;
33mod parse;
34mod snapshot;
35mod version;
36mod visit;
37mod visit_mut;
38mod workspace_path;
39
40fn main() -> anyhow::Result<()> {
41    color_backtrace::install();
42    let defs = parse::parse()?;
43    clone::generate(&defs)?;
44    debug::generate(&defs)?;
45    eq::generate(&defs)?;
46    hash::generate(&defs)?;
47    json::generate(&defs)?;
48    fold::generate(&defs)?;
49    visit::generate(&defs)?;
50    visit_mut::generate(&defs)?;
51    snapshot::generate(&defs)?;
52    Ok(())
53}
54