use koicore::ParserConfig;
#[repr(C)]
#[derive(Clone)]
pub struct KoiParserConfig {
pub command_threshold: usize,
pub skip_annotations: bool,
pub convert_number_command: bool,
pub preserve_indent: bool,
pub preserve_empty_lines: bool,
}
impl From<&KoiParserConfig> for ParserConfig {
fn from(config: &KoiParserConfig) -> Self {
Self {
command_threshold: config.command_threshold,
skip_annotations: config.skip_annotations,
convert_number_command: config.convert_number_command,
preserve_indent: config.preserve_indent,
preserve_empty_lines: config.preserve_empty_lines,
}
}
}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn KoiParserConfig_Init(config: *mut KoiParserConfig) {
if config.is_null() {
return;
}
unsafe {
*config = KoiParserConfig {
command_threshold: 1,
skip_annotations: false,
convert_number_command: true,
preserve_empty_lines: true,
preserve_indent: true,
}
};
}