limu 0.1.0

A diagram layout engine. It reads Mermaid and leaves the drawing to your program.
Documentation
//! The tokens of a state diagram, as Pele's tokens.ts has them.

/// A token's type, Pele's T. The names are Pele's as they are, as the grammar's are.
#[allow(
    non_camel_case_types,
    clippy::upper_case_acronyms,
    clippy::enum_variant_names
)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) enum T {
    END,
    ERROR,
    NL,
    SD,
    DESCR,
    ARROW,
    HIDE_EMPTY,
    scale,
    WIDTH,
    COMPOSIT_STATE,
    STRUCT_START,
    STRUCT_STOP,
    STATE_DESCR,
    AS,
    ID,
    FORK,
    JOIN,
    CHOICE,
    CONCURRENT,
    note,
    NOTE_TEXT,
    acc_title,
    acc_title_value,
    acc_descr,
    acc_descr_value,
    acc_descr_multiline_value,
    CLICK,
    STRING,
    HREF,
    classDef,
    CLASSDEF_ID,
    DEFAULT_CLASSDEF_ID,
    CLASSDEF_STYLEOPTS,
    DEFAULT,
    style,
    STYLE_IDS,
    STYLEDEF_STYLEOPTS,
    class,
    CLASSENTITY_IDS,
    STYLECLASS,
    direction_tb,
    direction_bt,
    direction_rl,
    direction_lr,
    EDGE_STATE,
    STYLE_SEPARATOR,
    left_of,
    right_of,
    INVALID,
}

/// The direction tokens, in the order of Pele's T, which is the order the grammar tries them.
pub(crate) const DIRECTION_TOKENS: [T; 4] = [
    T::direction_tb,
    T::direction_bt,
    T::direction_rl,
    T::direction_lr,
];

impl T {
    /// The token's name, as Jison's errors name it, Pele's TOKEN_NAMES.
    pub(crate) fn name(self) -> &'static str {
        TOKEN_NAMES[self as usize]
    }
}

const TOKEN_NAMES: [&str; T::INVALID as usize + 1] = [
    "$end",
    "INVALID",
    "NL",
    "SD",
    "DESCR",
    "-->",
    "HIDE_EMPTY",
    "scale",
    "WIDTH",
    "COMPOSIT_STATE",
    "STRUCT_START",
    "STRUCT_STOP",
    "STATE_DESCR",
    "AS",
    "ID",
    "FORK",
    "JOIN",
    "CHOICE",
    "CONCURRENT",
    "note",
    "NOTE_TEXT",
    "acc_title",
    "acc_title_value",
    "acc_descr",
    "acc_descr_value",
    "acc_descr_multiline_value",
    "CLICK",
    "STRING",
    "HREF",
    "classDef",
    "CLASSDEF_ID",
    "DEFAULT_CLASSDEF_ID",
    "CLASSDEF_STYLEOPTS",
    "DEFAULT",
    "style",
    "STYLE_IDS",
    "STYLEDEF_STYLEOPTS",
    "class",
    "CLASSENTITY_IDS",
    "STYLECLASS",
    "direction_tb",
    "direction_bt",
    "direction_rl",
    "direction_lr",
    "EDGE_STATE",
    "STYLE_SEPARATOR",
    "left_of",
    "right_of",
    "INVALID",
];