Crates.io | nom-config-in |
lib.rs | nom-config-in |
version | 0.1.0 |
source | src |
created_at | 2023-08-20 18:40:18.53327 |
updated_at | 2023-08-20 18:40:18.53327 |
description | A Kconfig parser |
homepage | https://github.com/Mcdostone/nom-config-in |
repository | https://github.com/Mcdostone/nom-config-in |
max_upload_size | |
id | 949503 |
size | 82,257 |
This parser is not actively maintained since it has been replaced by Kconfig. This library has been tested from linux kernel 1.0 to 2.5.44 (542 versions).
A Config.in file looks like this:
# 2.5.0/arch/i386/config.in
mainmenu_name "Linux Kernel Configuration"
define_bool CONFIG_X86 y
define_bool CONFIG_ISA y
define_bool CONFIG_SBUS n
define_bool CONFIG_UID16 y
mainmenu_option next_comment
comment 'Code maturity level options'
bool 'Prompt for development and/or incomplete code/drivers' CONFIG_EXPERIMENTAL
endmenu
cargo add nom-config-in
use nom_config_in::{parse_config_in, ConfigInFile, ConfigInInput};
use std::path::PathBuf;
// curl https://cdn.kernel.org/pub/linux/kernel/v2.5/linux-2.5.0.tar.xz | tar -xJ -C /tmp/
fn main() -> Result<(), Box<dyn std::error::Error>> {
let config_in_file = ConfigInFile::new(
PathBuf::from("/tmp/linux/"),
PathBuf::from("/tmp/linux/arch/i386/config.in"),
);
let input = config_in_file.read_to_string().unwrap();
let config_in = parse_config_in(ConfigInInput::new_extra(&input, config_in_file));
println!("{:?}", config_in);
Ok(())
}