Skip to main content

synapse_codegen_cfs/
lib.rs

1mod c;
2mod constants;
3mod error;
4mod rust;
5mod types;
6mod util;
7mod validate;
8
9use synapse_parser::ast::SynFile;
10
11pub use c::{
12    generate_c, try_generate_c, try_generate_c_with_constants,
13    try_generate_c_with_constants_and_options, try_generate_c_with_options,
14};
15use constants::const_context;
16pub use error::CodegenError;
17pub use rust::{
18    generate_rust, try_generate_rust, try_generate_rust_with_constants,
19    try_generate_rust_with_constants_and_options, try_generate_rust_with_options,
20};
21pub use types::{
22    CfsOptions, CfsPacket, CfsPacketKind, GENERATED_BANNER, MsgIdLayout, PREAMBLE,
23    ResolvedConstants, RustOptions,
24};
25pub use validate::{
26    collect_cfs_packets_with_constants, collect_cfs_packets_with_constants_and_options,
27    validate_cfs, validate_cfs_with_constants, validate_cfs_with_constants_and_options,
28    validate_cfs_with_options,
29};
30
31/// Resolve this file's integer constants, including aliases to visible imported constants.
32pub fn resolve_integer_constants(
33    file: &SynFile,
34    imported_constants: &ResolvedConstants,
35) -> ResolvedConstants {
36    let constants = const_context(file, imported_constants);
37    constants.resolved_local_constants()
38}
39
40#[cfg(test)]
41mod tests;