zamm_yang 0.1.6

A basic, experimental code generator
Documentation
/// Config information for generic data types.
mod configs;
/// Format documentation as rustdoc.
mod docstring;
/// Actual changes to the filesystem.
pub mod filesystem;
/// High-level planning for what the final generation configs will look like. All logic that touch
/// Yin concepts in the codegen module should live inside of this sub-module.
pub mod planning;
/// Finalized code generation.
mod postprocessing;
/// Codegen templates.
pub mod template;
/// Track autogenerated files.
pub mod track_autogen;

pub use configs::{CodegenConfig, StructConfig};
use filesystem::{output_code_verbatim, OutputConfig};
pub use postprocessing::mark_autogen::{add_indent, count_indent};
pub use postprocessing::mark_fmt::add_fmt_skips;
use postprocessing::post_process_generation;

/// How many characters per line each autogenerated document should have.
const CODE_WIDTH: usize = 80;

/// Default number of spaces for one level of indent.
const INDENT_SIZE: usize = 4;

/// Perform post-processing on generated code given the options specified in `codegen_cfg`, and
/// then output it to the given destination file path.
pub fn output_code(generated_code: &str, destination: &str, codegen_cfg: &CodegenConfig) {
    output_code_verbatim(&OutputConfig {
        code: &post_process_generation(generated_code, codegen_cfg),
        file_path: destination,
        git_ignore: !codegen_cfg.release,
        cargo_track: codegen_cfg.track_autogen,
    });
}