syncat_stylesheet/ast/
style.rs1use super::{helper::*, Value};
2use tree_sitter::TreeCursor;
3
4#[derive(Clone, Debug)]
5pub(crate) struct Style {
6 pub(crate) name: String,
7 pub(crate) value: Value,
8}
9
10impl FromSource for Style {
11 fn from_source(tree: &mut TreeCursor, source: &[u8]) -> crate::Result<Self> {
12 children!(tree, "style");
13 extras!(tree, "style");
14 let name = text!(tree, source, "name")?.to_string();
15 tree.goto_next_sibling();
16 let value = Value::from_source(tree, source)?;
17 tree.goto_parent();
18 Ok(Style { name, value })
19 }
20}