syncat-stylesheet 3.6.0

Parser for Syncat Stylesheets.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use super::helper::*;
use tree_sitter::TreeCursor;

#[derive(Clone, Eq, PartialEq, Hash, Debug)]
pub(crate) struct Variable(pub(crate) String);

impl Variable {
    pub(crate) fn name(&self) -> &str {
        &self.0[1..]
    }
}

impl FromSource for Variable {
    fn from_source(tree: &mut TreeCursor, source: &[u8]) -> crate::Result<Self> {
        Ok(Self(text!(tree, source, "variable")?.to_string()))
    }
}