aboutsummaryrefslogtreecommitdiff
path: root/syn/codegen/src/main.rs
blob: 9b1b5dd50690343176ac6a7e9e279949b60366b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// This crate crawls the Syn source directory to find all structs and enums that
// form the Syn syntax tree.
//
// A machine-readable representation of the syntax tree is saved to syn.json in
// the repo root for other code generation tools to consume. The syn-codegen
// crate (https://docs.rs/syn-codegen/) provides the data structures for parsing
// and making use of syn.json from Rust code.
//
// Finally this crate generates the Visit, VisitMut, and Fold traits in Syn
// programmatically from the syntax tree description.

#![recursion_limit = "128"]
#![allow(clippy::needless_pass_by_value)]

mod debug;
mod file;
mod fold;
mod full;
mod gen;
mod json;
mod operand;
mod parse;
mod version;
mod visit;
mod visit_mut;

fn main() -> anyhow::Result<()> {
    color_backtrace::install();
    let defs = parse::parse()?;
    json::generate(&defs)?;
    fold::generate(&defs)?;
    visit::generate(&defs)?;
    visit_mut::generate(&defs)?;
    debug::generate(&defs)?;
    Ok(())
}