Add events and state for tokenizer

This commit is contained in:
Lukas Stancik
2026-04-04 07:46:04 +00:00
parent d12ef37dd5
commit e3f33fe66a
2 changed files with 30 additions and 0 deletions
+8
View File
@@ -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.
+22
View File
@@ -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,