Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 42 additions & 42 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ feature-depth = 1
# A list of advisory IDs to ignore. Note that ignored advisories will still
# output a note when they are encountered.
ignore = [
"RUSTSEC-2026-0204"
#"RUSTSEC-0000-0000",
#{ id = "RUSTSEC-0000-0000", reason = "you can specify a reason the advisory is ignored" },
#"a-crate-that-is-yanked@0.1.1", # you can also ignore yanked crate versions if you wish
Expand Down
Binary file added nom-kconfig-0.12.0.crate
Binary file not shown.
20 changes: 20 additions & 0 deletions src/attribute/default_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,26 @@ fn test_default_attribute_number_2() {
)
}

#[test]
/// https://github.com/torvalds/linux/blob/master/init/Kconfig#L22-L25
fn test_default_attribute_lll() {
assert_parsing_eq!(
parse_default,
"default 10 if BFLB_BL70X_BLE_M0S1T10",
Ok((
"",
DefaultAttribute {
expression: Expression::Term(AndExpression::Term(Term::Atom(Atom::Symbol(
Symbol::Constant(ConstantSymbol::Integer(10))
)))),
r#if: Some(Expression::Term(AndExpression::Term(Term::Atom(
Atom::Symbol(Symbol::NonConstant("BFLB_BL70X_BLE_M0S1T10".to_string()))
))))
}
))
)
}

#[test]
fn test_default_attribute_number_3() {
assert_parsing_eq!(
Expand Down
42 changes: 42 additions & 0 deletions src/attribute/depends_on_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,45 @@ fn test_parse_depends_on_with_if_condition() {
))
)
}

/// https://android.googlesource.com/kernel/common/+/refs/heads/android16-6.12/drivers/auxdisplay/Kconfig#241
#[test]
fn test_parse_depends_on_tmp() {
assert_parsing_eq!(
parse_depends_on,
"depends on PANEL_PROFILE=\"0\" && PANEL_LCD=\"1\" && PANEL_LCD_PROTO=\"0\"",
Ok((
"",
DependsOn {
expression: Expression::Term(AndExpression::Expression(vec![
Term::Atom(Atom::Compare(CompareExpression {
left: CompareOperand::Symbol(Symbol::NonConstant(
"PANEL_PROFILE".to_string()
)),
operator: CompareOperator::Equal,
right: CompareOperand::Symbol(Symbol::Constant(ConstantSymbol::String(
"0".to_string()
)))
})),
Term::Atom(Atom::Compare(CompareExpression {
left: CompareOperand::Symbol(Symbol::NonConstant("PANEL_LCD".to_string())),
operator: CompareOperator::Equal,
right: CompareOperand::Symbol(Symbol::Constant(ConstantSymbol::String(
"1".to_string()
)))
})),
Term::Atom(Atom::Compare(CompareExpression {
left: CompareOperand::Symbol(Symbol::NonConstant(
"PANEL_LCD_PROTO".to_string()
)),
operator: CompareOperator::Equal,
right: CompareOperand::Symbol(Symbol::Constant(ConstantSymbol::String(
"0".to_string()
)))
}))
])),
r#if: None,
}
))
)
}
18 changes: 18 additions & 0 deletions src/attribute/range_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,21 @@ fn test_parse_range_variable() {
))
)
}

// https://github.com/zephyrproject-rtos/zephyr/blob/e201b84b04e4fab1844658e71da0b7e340f1cc82/subsys/net/lib/zperf/Kconfig#L103
#[test]
#[ignore = "not implemented yet"]
fn test_parse_range_variable_in_zephyr() {
assert_parsing_eq!(
parse_range,
"range $(inc,$(UINT8_MAX)) $(UINT16_MAX)",
Ok((
"",
Range {
lower_bound: RangeBound::Variable("inc,UINT8_MAX".to_string()),
upper_bound: RangeBound::Variable("UINT16_MAX".to_string()),
r#if: None
}
))
)
}
9 changes: 5 additions & 4 deletions src/entry/configdefault.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use nom::{
bytes::complete::tag,
combinator::map,
multi::many1,
sequence::{pair, preceded},
IResult, Parser,
};
Expand All @@ -23,18 +24,18 @@ use crate::{
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
pub struct ConfigDefault {
pub symbol: String,
pub default: DefaultAttribute,
pub default_attributes: Vec<DefaultAttribute>,
}

pub fn parse_configdefault(input: KconfigInput) -> IResult<KconfigInput, ConfigDefault> {
map(
pair(
preceded(ws(tag("configdefault")), ws(parse_config_symbol)),
parse_default,
many1(parse_default),
),
|(symbol, default_attribute)| ConfigDefault {
|(symbol, default_attributes)| ConfigDefault {
symbol: symbol.to_string(),
default: default_attribute,
default_attributes,
},
)
.parse(input)
Expand Down
Loading
Loading