Add events and state for tokenizer
This commit is contained in:
@@ -6,6 +6,14 @@ use crate::util::constant::TAB_SIZE;
|
||||
/// Semantic label of a span.
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
||||
pub enum Name {
|
||||
// Whole task
|
||||
Task,
|
||||
// Content between starting :: and ending ::
|
||||
TaskContent,
|
||||
// Just the starting :: and ending ::
|
||||
TaskFence,
|
||||
// Either starting :: or ending ::
|
||||
TaskSequence,
|
||||
/// Attention sequence.
|
||||
///
|
||||
/// > 👉 **Note**: this is used while parsing but compiled away.
|
||||
|
||||
@@ -466,12 +466,34 @@ pub enum Name {
|
||||
TitleEscape,
|
||||
TitleInside,
|
||||
TitleNok,
|
||||
|
||||
TaskStart,
|
||||
TaskOpenSequence,
|
||||
TaskCloseSequence,
|
||||
// TaskOpenAfter,
|
||||
TaskContentStart,
|
||||
TaskContentInside,
|
||||
TaskContentEnd,
|
||||
TaskCloseStart,
|
||||
TaskCloseAfter,
|
||||
// TaskAfter,
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_lines)]
|
||||
/// Call the corresponding state for a state name.
|
||||
pub fn call(tokenizer: &mut Tokenizer, name: Name) -> State {
|
||||
let func = match name {
|
||||
Name::TaskStart => construct::task::start,
|
||||
Name::TaskOpenSequence => construct::task::open_sequence,
|
||||
// Name::TaskOpenAfter => construct::task::open_after,
|
||||
// Name::TaskAfter => construct::task::after,
|
||||
Name::TaskContentStart => construct::task::content_start,
|
||||
Name::TaskContentInside => construct::task::content_inside,
|
||||
Name::TaskContentEnd => construct::task::content_end,
|
||||
Name::TaskCloseStart => construct::task::close_start,
|
||||
Name::TaskCloseSequence => construct::task::close_sequence,
|
||||
Name::TaskCloseAfter => construct::task::close_after,
|
||||
|
||||
Name::AttentionStart => construct::attention::start,
|
||||
Name::AttentionInside => construct::attention::inside,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user