diff --git a/src/syntax/content/parser.rs b/src/syntax/content/parser.rs index 1837644..712e127 100644 --- a/src/syntax/content/parser.rs +++ b/src/syntax/content/parser.rs @@ -134,17 +134,19 @@ fn lex(text: &str, map: LexMap, config: &Config) -> Vec { tokens } +#[derive(Clone, Debug)] pub struct State { context: Context, dom_ids: HashMap>, buffers: Buffers, } +#[derive(Clone, Debug)] struct Buffers { anchor: AnchorBuffer, } -#[derive(Debug)] +#[derive(Clone, Debug)] struct AnchorBuffer { candidate: Anchor, text: String, @@ -169,7 +171,7 @@ impl State { dom_ids: HashMap::new(), buffers: Buffers { anchor: AnchorBuffer { - candidate: Anchor::empty(), + candidate: Anchor::default(), text: String::new(), destination: String::new(), }, diff --git a/src/syntax/content/parser/context.rs b/src/syntax/content/parser/context.rs index 99d4f1c..542e51c 100644 --- a/src/syntax/content/parser/context.rs +++ b/src/syntax/content/parser/context.rs @@ -5,11 +5,13 @@ use crate::syntax::content::parser::{ pub mod anchor; +#[derive(Clone, Debug)] pub struct Context { pub block: Block, pub inline: Inline, } +#[derive(Clone, Debug)] pub enum Block { Paragraph, Header(u8), @@ -17,6 +19,7 @@ pub enum Block { None, } +#[derive(Clone, Debug)] pub enum Inline { Anchor, Code, diff --git a/src/syntax/content/parser/token.rs b/src/syntax/content/parser/token.rs index 4f9fa8d..4a0712e 100644 --- a/src/syntax/content/parser/token.rs +++ b/src/syntax/content/parser/token.rs @@ -10,7 +10,7 @@ pub mod preformat; pub mod code; pub mod oblique; -#[derive(Debug, Eq, PartialEq)] +#[derive(Debug, Eq, PartialEq, Clone)] pub enum Token { Anchor(anchor::Anchor), Code(code::Code), diff --git a/src/syntax/content/parser/token/anchor.rs b/src/syntax/content/parser/token/anchor.rs index 799cecb..ddb4bf8 100644 --- a/src/syntax/content/parser/token/anchor.rs +++ b/src/syntax/content/parser/token/anchor.rs @@ -1,6 +1,6 @@ use crate::syntax::content::{Parseable, parser::lexeme::Lexeme}; -#[derive(Debug, Clone, Eq, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq, Default)] pub struct Anchor { pub text: String, pub destination: Option, diff --git a/src/syntax/content/parser/token/code.rs b/src/syntax/content/parser/token/code.rs index c463873..743bb94 100644 --- a/src/syntax/content/parser/token/code.rs +++ b/src/syntax/content/parser/token/code.rs @@ -2,7 +2,7 @@ use crate::{ syntax::content::{Parseable, Lexeme}, }; -#[derive(Debug, Eq, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub struct Code { open: bool, } diff --git a/src/syntax/content/parser/token/header.rs b/src/syntax/content/parser/token/header.rs index e8d5574..177f04c 100644 --- a/src/syntax/content/parser/token/header.rs +++ b/src/syntax/content/parser/token/header.rs @@ -10,7 +10,7 @@ use crate::{ use std::fmt::Display; -#[derive(Debug, Eq, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub struct Header { open: Option, level: Level, @@ -112,7 +112,7 @@ impl Parseable for Header { } } -#[derive(Debug, Eq, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub enum Level { One, Two, diff --git a/src/syntax/content/parser/token/linebreak.rs b/src/syntax/content/parser/token/linebreak.rs index 5c9b93e..2341384 100644 --- a/src/syntax/content/parser/token/linebreak.rs +++ b/src/syntax/content/parser/token/linebreak.rs @@ -2,7 +2,7 @@ use crate::{ syntax::content::{Parseable, parser::lexeme::Lexeme}, }; -#[derive(Debug, Eq, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub struct LineBreak {} impl Parseable for LineBreak { diff --git a/src/syntax/content/parser/token/literal.rs b/src/syntax/content/parser/token/literal.rs index 57954b1..d311633 100644 --- a/src/syntax/content/parser/token/literal.rs +++ b/src/syntax/content/parser/token/literal.rs @@ -1,6 +1,6 @@ use crate::syntax::content::{Parseable, parser::lexeme::Lexeme}; -#[derive(Debug, Eq, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub struct Literal { text: String, } diff --git a/src/syntax/content/parser/token/oblique.rs b/src/syntax/content/parser/token/oblique.rs index 136bb99..f4852b6 100644 --- a/src/syntax/content/parser/token/oblique.rs +++ b/src/syntax/content/parser/token/oblique.rs @@ -2,7 +2,7 @@ use crate::{ syntax::content::{Parseable, Lexeme}, }; -#[derive(Debug, Eq, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub struct Oblique { open: bool, } diff --git a/src/syntax/content/parser/token/paragraph.rs b/src/syntax/content/parser/token/paragraph.rs index 8beb82e..b0def3d 100644 --- a/src/syntax/content/parser/token/paragraph.rs +++ b/src/syntax/content/parser/token/paragraph.rs @@ -1,6 +1,6 @@ use crate::syntax::content::{Parseable, parser::lexeme::Lexeme}; -#[derive(Debug, Eq, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub struct Paragraph { open: Option, } diff --git a/src/syntax/content/parser/token/preformat.rs b/src/syntax/content/parser/token/preformat.rs index e75e37a..999804e 100644 --- a/src/syntax/content/parser/token/preformat.rs +++ b/src/syntax/content/parser/token/preformat.rs @@ -2,7 +2,7 @@ use crate::{ syntax::content::{Parseable, Lexeme}, }; -#[derive(Debug, Eq, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub struct PreFormat { open: Option, } diff --git a/src/syntax/content/parser/token/span.rs b/src/syntax/content/parser/token/span.rs index 1eb95a5..9b55c91 100644 --- a/src/syntax/content/parser/token/span.rs +++ b/src/syntax/content/parser/token/span.rs @@ -1,6 +1,6 @@ use crate::syntax::content::{Parseable, parser::lexeme::Lexeme}; -#[derive(Debug, Eq, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub struct Span { open: Option, }