aboutsummaryrefslogtreecommitdiffstats
path: root/src/resolve.rs
blob: 1106880da7569fae429a14b9b7ee2e44333ef8d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use crate::construct;
use crate::tokenizer::Tokenizer;

/// Names of functions that resolve.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum Name {
    Label,
    Attention,
    HeadingAtx,
    HeadingSetext,
    List,
    Paragraph,
    Data,
    String,
    Text,
}

/// Call the corresponding resolver.
pub fn call(tokenizer: &mut Tokenizer, name: Name) {
    let func = match name {
        Name::Label => construct::label_end::resolve,
        Name::Attention => construct::attention::resolve,
        Name::HeadingAtx => construct::heading_atx::resolve,
        Name::HeadingSetext => construct::heading_setext::resolve,
        Name::List => construct::list_item::resolve,
        Name::Paragraph => construct::paragraph::resolve,
        Name::Data => construct::partial_data::resolve,
        Name::String => construct::string::resolve,
        Name::Text => construct::text::resolve,
    };

    func(tokenizer);
}