nom_kconfig/attribute/
visible.rs

1//! The `visible` attribute is only applicable to menu blocks, if the condition is false, the menu block is not displayed to the user (the symbols contained there can still be selected by other symbols, though). It is similar to a conditional "prompt" attribute for individual menu entries. Default value of "visible" is true.
2
3use super::{parse_if_attribute, Expression};
4use crate::{util::ws, KconfigInput};
5use nom::{bytes::complete::tag, sequence::preceded, IResult, Parser};
6
7pub type Visible = Option<Expression>;
8/// Parses a `visible` attribute.
9/// # Example
10/// ```
11/// use nom_kconfig::{
12/// assert_parsing_eq,
13/// attribute::{parse_visible},
14/// };
15/// assert_parsing_eq!(parse_visible, "visible", Ok(("", None)))
16/// ```
17pub fn parse_visible(input: KconfigInput) -> IResult<KconfigInput, Visible> {
18    preceded(ws(tag("visible")), parse_if_attribute).parse(input)
19}