Derive Debug and Clone for tokens and parser state
This commit is contained in:
parent
312901ddf6
commit
8d204503a8
12 changed files with 18 additions and 13 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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<String>,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use crate::{
|
|||
syntax::content::{Parseable, Lexeme},
|
||||
};
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct Code {
|
||||
open: bool,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use crate::{
|
|||
|
||||
use std::fmt::Display;
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct Header {
|
||||
open: Option<bool>,
|
||||
level: Level,
|
||||
|
|
@ -112,7 +112,7 @@ impl Parseable for Header {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub enum Level {
|
||||
One,
|
||||
Two,
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use crate::{
|
|||
syntax::content::{Parseable, Lexeme},
|
||||
};
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct Oblique {
|
||||
open: bool,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<bool>,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use crate::{
|
|||
syntax::content::{Parseable, Lexeme},
|
||||
};
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct PreFormat {
|
||||
open: Option<bool>,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<bool>,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue