shimmer_syntax 0.0.0

Parser of shimmer
Documentation
/// Represents an AST element.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct Element<'a> {
    /// Index of the start of the element (inclusive).
    start: u32,
    /// Index of the end of the element (exclusive).
    end: u32,
    /// Type of the element.
    kind: ElementKind<'a>,
}

/// Represents the type of an element and corresponding data.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ElementKind<'a> {
    /// See <https://www.mediawiki.org/wiki/Specs/HTML#Behavior_switches>
    BehaviorSwitch {
        text: &'a str,
    },

    /// See <https://www.mediawiki.org/wiki/Specs/HTML#Wiki_links>
    Wikilink {
        href: &'a str,
    },

    /// See <https://www.mediawiki.org/wiki/Specs/HTML#External_links>
    Extlink {
        href: &'a str,
    },

    Hr,

    /// See <https://www.mediawiki.org/wiki/Specs/HTML#HTML_entities>
    Entity {
        text: &'a str,
    },

    Comment {
        text: &'a str,
    },

    Ol,
    Ul,
    Dd,
    Dt,
}