djr 0.0.1

Djot parser written in pure Rust
Documentation
use std::ops::Range;

#[derive(Debug)]
pub(crate) struct Token {
    pub kind: TokenKind,
    pub range: Range<usize>,
}

impl Token {
    pub(crate) fn new(kind: TokenKind, range: Range<usize>) -> Self {
        Token { kind, range }
    }
}

#[derive(Clone, Copy, Debug)]
pub(crate) enum TokenKind {
    Blankline,
    SoftBreak,
    HardBreak,
    Indent(usize),
    Str,
    ThematicBreak,
    BlockAttributes,
    Heading(usize),
    CodeFence(usize),
    DivFence(usize),
    Blockquote,
    DefinitionList,
    TaskList,
    UnorderedList(UnorderedListType),
    OrderedList(OrderedListType),
    FootnoteDefinition,
    LinkDefinition,
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) enum UnorderedListType {
    Dash,
    Plus,
    Asterisk,
}

// All these ordered list types... Damn you, John!!
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) enum OrderedListType {
    DecimalPeriod,
    DecimalParen,
    DecimalEnclosed,
    LowerPeriod,
    LowerParen,
    LowerEnclosed,
    UpperPeriod,
    UpperParen,
    UpperEnclosed,
    LowerRomanPeriod,
    LowerRomanParen,
    LowerRomanEnclosed,
    UpperRomanPeriod,
    UpperRomanParen,
    UpperRomanEnclosed,
}