Rename 'markup' to 'structure'

This commit is contained in:
Shautvast 2025-01-07 15:58:35 +01:00
parent 146bc4a2dc
commit 92bab91020
5 changed files with 9 additions and 9 deletions

View file

@ -1,4 +1,4 @@
markup {
structure {
lanes {
functions {
calc: "Calculation"

View file

@ -1,5 +1,5 @@
vis: markup | styles
markup: "markup:" nodes
vis: structure styles
structure: "structure:" nodes
elements: "{" element* "}"
element: node | edge
node: (id (":" title)? nodes?) | edgenode

View file

@ -8,7 +8,7 @@ mod tokens;
#[derive(Debug)]
pub struct Vis {
pub markup: Vec<Element>,
pub structure: Vec<Element>,
pub styles: Vec<StyleNode>,
}

View file

@ -13,7 +13,7 @@ pub fn parse_vis(contents: &str) -> anyhow::Result<Vis> {
let mut parser = Parser::new(tokens);
Ok(Vis {
markup: parser.markup()?,
structure: parser.structure()?,
styles: parser.styles()?,
})
}
@ -28,8 +28,8 @@ impl Parser {
Self { tokens, current: 0 }
}
fn markup(&mut self) -> anyhow::Result<Vec<Element>> {
if self.match_token(Markup) {
fn structure(&mut self) -> anyhow::Result<Vec<Element>> {
if self.match_token(Structure) {
self.elements()
} else {
Ok(vec![])

View file

@ -4,7 +4,7 @@ use TokenType::*;
pub const KEYWORDS: LazyCell<HashMap<&str, TokenType>> = LazyCell::new(|| {
let mut m = HashMap::new();
m.insert("markup", Markup);
m.insert("structure", Structure);
m.insert("styles", Styles);
m.insert("group", Group);
m.insert("px", Px);
@ -46,7 +46,7 @@ pub enum TokenType {
Str,
Number,
Minus,
Markup,
Structure,
Styles,
Group,
Eof,