Rename 'markup' to 'structure'
This commit is contained in:
parent
146bc4a2dc
commit
92bab91020
5 changed files with 9 additions and 9 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
markup {
|
structure {
|
||||||
lanes {
|
lanes {
|
||||||
functions {
|
functions {
|
||||||
calc: "Calculation"
|
calc: "Calculation"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
vis: markup | styles
|
vis: structure styles
|
||||||
markup: "markup:" nodes
|
structure: "structure:" nodes
|
||||||
elements: "{" element* "}"
|
elements: "{" element* "}"
|
||||||
element: node | edge
|
element: node | edge
|
||||||
node: (id (":" title)? nodes?) | edgenode
|
node: (id (":" title)? nodes?) | edgenode
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ mod tokens;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Vis {
|
pub struct Vis {
|
||||||
pub markup: Vec<Element>,
|
pub structure: Vec<Element>,
|
||||||
pub styles: Vec<StyleNode>,
|
pub styles: Vec<StyleNode>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ pub fn parse_vis(contents: &str) -> anyhow::Result<Vis> {
|
||||||
let mut parser = Parser::new(tokens);
|
let mut parser = Parser::new(tokens);
|
||||||
|
|
||||||
Ok(Vis {
|
Ok(Vis {
|
||||||
markup: parser.markup()?,
|
structure: parser.structure()?,
|
||||||
styles: parser.styles()?,
|
styles: parser.styles()?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -28,8 +28,8 @@ impl Parser {
|
||||||
Self { tokens, current: 0 }
|
Self { tokens, current: 0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn markup(&mut self) -> anyhow::Result<Vec<Element>> {
|
fn structure(&mut self) -> anyhow::Result<Vec<Element>> {
|
||||||
if self.match_token(Markup) {
|
if self.match_token(Structure) {
|
||||||
self.elements()
|
self.elements()
|
||||||
} else {
|
} else {
|
||||||
Ok(vec![])
|
Ok(vec![])
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use TokenType::*;
|
||||||
|
|
||||||
pub const KEYWORDS: LazyCell<HashMap<&str, TokenType>> = LazyCell::new(|| {
|
pub const KEYWORDS: LazyCell<HashMap<&str, TokenType>> = LazyCell::new(|| {
|
||||||
let mut m = HashMap::new();
|
let mut m = HashMap::new();
|
||||||
m.insert("markup", Markup);
|
m.insert("structure", Structure);
|
||||||
m.insert("styles", Styles);
|
m.insert("styles", Styles);
|
||||||
m.insert("group", Group);
|
m.insert("group", Group);
|
||||||
m.insert("px", Px);
|
m.insert("px", Px);
|
||||||
|
|
@ -46,7 +46,7 @@ pub enum TokenType {
|
||||||
Str,
|
Str,
|
||||||
Number,
|
Number,
|
||||||
Minus,
|
Minus,
|
||||||
Markup,
|
Structure,
|
||||||
Styles,
|
Styles,
|
||||||
Group,
|
Group,
|
||||||
Eof,
|
Eof,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue