Module theme_parser::parser::theme_txt
source · Expand description
Everything for parsing GRUB’s theme.txt file.
To parse the file, call Document::parse
. The document contains a list of
statements, each is either a Component
or a GlobalProperty
.
let theme_txt = r#"# your average theme file
terminal-font: "Monospace"
+ label {
text = Hello
}
"#;
let doc = Document::parse(theme_txt)?.1;
assert_eq!(
doc,
Document(
[
Statement::GlobalProperty(GlobalProperty {
name: "terminal-font".to_string(),
value: "Monospace".to_string(),
}),
Statement::Component(Component {
name: "label".to_string(),
properties: [ComponentProperty {
name: "text".to_string(),
value: "Hello".to_string(),
}]
.into(),
}),
]
.into()
)
);
Structs
- A key-value pair, separated with
=
that modifies how aComponent
looks. - Represents the entire theme.txt file.
- A key-value pair, separated with
:
.
Enums
- A single statement in the document.