use alloc::{string::String, vec::Vec};
use crate::css::Css;
pub mod cpp;
pub mod python;
pub mod rust;
pub struct GeneratedFile {
pub path: String,
pub contents: String,
}
pub trait CodegenBackend {
fn lang(&self) -> &'static str;
fn emit_css(&self, css: &Css) -> String;
fn emit_project(&self, css: &Css) -> Vec<GeneratedFile>;
}
pub fn backend_for(lang: &str) -> Option<alloc::boxed::Box<dyn CodegenBackend>> {
match lang {
"rust" => Some(alloc::boxed::Box::new(rust::RustBackend)),
"cpp" | "c++" => Some(alloc::boxed::Box::new(cpp::CppBackend)),
"python" | "py" => Some(alloc::boxed::Box::new(python::PythonBackend)),
_ => None,
}
}