From 0fd582b6f5dbdcf38f4b0d5627b69e56df9dbc1d Mon Sep 17 00:00:00 2001 From: Artemy Egorov Date: Mon, 12 Aug 2024 20:30:46 +0300 Subject: [PATCH] fix: rename tcol, tpcol to trow, tprow --- examples/bench.rs | 4 ++-- examples/daleth.dlth | 4 ++-- src/daleth/custom_parsers/mod.rs | 4 ++-- src/daleth/format.rs | 4 ++-- src/daleth/lexer/mod.rs | 4 ++-- src/daleth/lexer/types.rs | 8 ++++---- src/daleth/parser/mod.rs | 6 +++--- src/daletl.rs | 4 ++-- src/traits/from_daletl.rs | 4 ++-- src/traits/to_daletl.rs | 4 ++-- src/typed.rs | 4 ++-- 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/examples/bench.rs b/examples/bench.rs index ea4b5d2..ade8205 100644 --- a/examples/bench.rs +++ b/examples/bench.rs @@ -63,12 +63,12 @@ fn main() { ] .into()), Table(vec![ - Tpcol(vec![ + Tprow(vec![ El("Col 1".into()), El("Col 2".into()), El("Col 3".into()), ]), - Tcol(vec![ + Trow(vec![ El("Never gonna".into()), El("give you".into()), El("up".into()), diff --git a/examples/daleth.dlth b/examples/daleth.dlth index 7ba5c39..f30af78 100644 --- a/examples/daleth.dlth +++ b/examples/daleth.dlth @@ -121,7 +121,7 @@ row [ # +| cells | - primary column # | cells | - secondary column # | Element | Description | - converts to -# tcol [ +# trow [ # Element # Description # ] @@ -135,4 +135,4 @@ row [ [ ul | Unordered list ] [ br | Line break ] [[ quantity | 7 ]] -} \ No newline at end of file +} diff --git a/src/daleth/custom_parsers/mod.rs b/src/daleth/custom_parsers/mod.rs index b7cdff5..c7c094f 100644 --- a/src/daleth/custom_parsers/mod.rs +++ b/src/daleth/custom_parsers/mod.rs @@ -16,12 +16,12 @@ pub fn table_to_tag(rows: &Vec) -> Tag { Tag::Table( rows.into_iter() .map(|row| match row { - TableCol::Primary(row) => Tag::Tpcol( + TableCol::Primary(row) => Tag::Tprow( row.into_iter() .map(|t| Tag::El(NNBody::Text(format!("{t}")))) .collect(), ), - TableCol::Secondary(row) => Tag::Tcol( + TableCol::Secondary(row) => Tag::Trow( row.into_iter() .map(|t| Tag::El(NNBody::Text(format!("{t}")))) .collect(), diff --git a/src/daleth/format.rs b/src/daleth/format.rs index 79a4e83..98f9d4a 100644 --- a/src/daleth/format.rs +++ b/src/daleth/format.rs @@ -119,8 +119,8 @@ pub fn format<'src>(spanned_tokens: &Vec>>) -> String { Token::Navbtn => prepend_indent("navbtn", current_indent), Token::Img => prepend_indent("img", current_indent), Token::Table => prepend_indent("table", current_indent), - Token::Tcol => prepend_indent("tcol", current_indent), - Token::Tpcol => prepend_indent("tpcol", current_indent), + Token::Trow => prepend_indent("trow", current_indent), + Token::Tprow => prepend_indent("tprow", current_indent), Token::Hr => prepend_indent("hr", current_indent), Token::B => prepend_indent("b", current_indent), Token::I => prepend_indent("i", current_indent), diff --git a/src/daleth/lexer/mod.rs b/src/daleth/lexer/mod.rs index 7b072f9..dba40ed 100644 --- a/src/daleth/lexer/mod.rs +++ b/src/daleth/lexer/mod.rs @@ -53,8 +53,8 @@ fn tag<'src>() -> impl Parser<'src, &'src str, Token<'src>, extra::Err { Navbtn, Img, Table, - Tcol, - Tpcol, + Trow, + Tprow, Hr, B, I, @@ -100,8 +100,8 @@ impl<'src> fmt::Display for Token<'src> { Token::Navbtn => write!(f, "navbtn"), Token::Img => write!(f, "img"), Token::Table => write!(f, "table"), - Token::Tcol => write!(f, "tcol"), - Token::Tpcol => write!(f, "tpcol"), + Token::Trow => write!(f, "trow"), + Token::Tprow => write!(f, "tprow"), Token::Hr => write!(f, "hr"), Token::B => write!(f, "b"), Token::I => write!(f, "i"), diff --git a/src/daleth/parser/mod.rs b/src/daleth/parser/mod.rs index 2e1381f..a82ecae 100644 --- a/src/daleth/parser/mod.rs +++ b/src/daleth/parser/mod.rs @@ -131,8 +131,8 @@ pub fn tag<'tokens, 'src: 'tokens>( .map(|(arg, body)| Navbtn(body, arg)); let img = just(Token::Img).ignore_then(text_arg.clone()).map(Img); let table = just(Token::Table).ignore_then(tags_body.clone()).map(Table); - let tcol = just(Token::Tcol).ignore_then(tags_body.clone()).map(Tcol); - let tpcol = just(Token::Tpcol).ignore_then(tags_body.clone()).map(Tpcol); + let trow = just(Token::Trow).ignore_then(tags_body.clone()).map(Trow); + let tprow = just(Token::Tprow).ignore_then(tags_body.clone()).map(Tprow); let hr = just(Token::Hr).to(Hr); let b = just(Token::B).ignore_then(text_body.clone()).map(B); let i = just(Token::I).ignore_then(text_body.clone()).map(I); @@ -184,7 +184,7 @@ pub fn tag<'tokens, 'src: 'tokens>( }; choice(( - el, h, p, br, ul, ol, row, link, navlink, btn, navbtn, img, table, tcol, tpcol, hr, b, + el, h, p, br, ul, ol, row, link, navlink, btn, navbtn, img, table, trow, tprow, hr, b, i, bq, footlnk, footn, a, s, sup, sub, disc, )) .or(choice((block, carousel, code, pre, meta))) diff --git a/src/daletl.rs b/src/daletl.rs index df0ebd6..726b6f2 100644 --- a/src/daletl.rs +++ b/src/daletl.rs @@ -60,8 +60,8 @@ pub enum DlTid { Navbtn, Img, Table, - Tcol, - Tpcol, + Trow, + Tprow, Hr, B, I, diff --git a/src/traits/from_daletl.rs b/src/traits/from_daletl.rs index ee93ebe..5ede9fe 100644 --- a/src/traits/from_daletl.rs +++ b/src/traits/from_daletl.rs @@ -24,8 +24,8 @@ impl TryFrom for Tag { DlTid::Navbtn => Navbtn(tag.body.try_into()?, tag.argument.try_into()?), DlTid::Img => Img(tag.argument.try_into()?), DlTid::Table => Table(tag.body.try_into()?), - DlTid::Tcol => Tcol(tag.body.try_into()?), - DlTid::Tpcol => Tpcol(tag.body.try_into()?), + DlTid::Trow => Trow(tag.body.try_into()?), + DlTid::Tprow => Tprow(tag.body.try_into()?), DlTid::Hr => Hr, DlTid::B => B(tag.body.try_into()?), DlTid::I => I(tag.body.try_into()?), diff --git a/src/traits/to_daletl.rs b/src/traits/to_daletl.rs index 00f2b90..0733331 100644 --- a/src/traits/to_daletl.rs +++ b/src/traits/to_daletl.rs @@ -19,8 +19,8 @@ impl From for DlTag { Tag::Navbtn(b, a) => dlt_new(DlTid::Navbtn, b.into(), a.into()), Tag::Img(a) => dlt_new(DlTid::Img, NB, a.into()), Tag::Table(b) => dlt_new(DlTid::Table, b.into(), NA), - Tag::Tcol(b) => dlt_new(DlTid::Tcol, b.into(), NA), - Tag::Tpcol(b) => dlt_new(DlTid::Tpcol, b.into(), NA), + Tag::Trow(b) => dlt_new(DlTid::Trow, b.into(), NA), + Tag::Tprow(b) => dlt_new(DlTid::Tprow, b.into(), NA), Tag::Hr => dlt_new(DlTid::Hr, NB, NA), Tag::B(b) => dlt_new(DlTid::B, b.into(), NA), Tag::I(b) => dlt_new(DlTid::I, b.into(), NA), diff --git a/src/typed.rs b/src/typed.rs index b099d22..f119ee8 100644 --- a/src/typed.rs +++ b/src/typed.rs @@ -29,8 +29,8 @@ pub enum Tag { Navbtn(Body, TArg), Img(TArg), Table(Vec), - Tcol(Vec), - Tpcol(Vec), + Trow(Vec), + Tprow(Vec), Hr, B(TBody), I(TBody),