big-code-analysis 2.0.0

Tool to compute and export code metrics
Documentation
// See `src/languages/mod.rs` for the rationale behind the per-file
// pedantic carve-outs below.
#![allow(clippy::match_same_arms, clippy::too_many_lines)]

// Code generated; DO NOT EDIT.

use num_derive::FromPrimitive;

#[derive(Clone, Debug, PartialEq, Eq, FromPrimitive)]
pub enum Irules {
    End = 0,
    SimpleWord = 1,
    LF = 2,
    SEMI = 3,
    Comment = 4,
    When = 5,
    EventName = 6,
    Priority = 7,
    Timing = 8,
    On = 9,
    Off = 10,
    Dict = 11,
    For2 = 12,
    Update = 13,
    With = 14,
    Regexp2 = 15,
    DASHabout = 16,
    DASHexpanded = 17,
    DASHindices = 18,
    DASHline = 19,
    DASHlinestop = 20,
    DASHlineanchor = 21,
    DASHnocase = 22,
    DASHall = 23,
    DASHinline = 24,
    DASHstart = 25,
    DASHDASH = 26,
    Switch2 = 27,
    DASHexact = 28,
    DASHglob = 29,
    DASHregexp = 30,
    DASHmatchvar = 31,
    DASHindexvar = 32,
    LBRACE = 33,
    RBRACE = 34,
    While2 = 35,
    Expr2 = 36,
    Foreach2 = 37,
    Global2 = 38,
    Namespace2 = 39,
    Try2 = 40,
    Trap = 41,
    Finally2 = 42,
    Unpack = 43,
    COLONCOLON = 44,
    IdentImm = 45,
    LPAREN = 46,
    RPAREN = 47,
    DOLLAR = 48,
    Id = 49,
    Set2 = 50,
    Proc = 51,
    Number = 52,
    Boolean = 53,
    LPAREN2 = 54,
    DASH = 55,
    PLUS = 56,
    TILDE = 57,
    BANG = 58,
    Not = 59,
    STARSTAR = 60,
    SLASH = 61,
    STAR = 62,
    PERCENT = 63,
    LTLT = 64,
    GTGT = 65,
    GT = 66,
    LT = 67,
    GTEQ = 68,
    LTEQ = 69,
    EQEQ = 70,
    BANGEQ = 71,
    Eq = 72,
    Ne = 73,
    StartsWith = 74,
    EndsWith = 75,
    Contains = 76,
    Equals = 77,
    Matches = 78,
    MatchesRegex = 79,
    MatchesGlob = 80,
    In = 81,
    Ni = 82,
    AMP = 83,
    CARET = 84,
    PIPE = 85,
    AMPAMP = 86,
    And = 87,
    PIPEPIPE = 88,
    Or = 89,
    QMARK = 90,
    COLON = 91,
    Elseif2 = 92,
    Else2 = 93,
    If2 = 94,
    Catch2 = 95,
    DQUOTE = 96,
    EscapedCharacter = 97,
    QuotedWordContent = 98,
    LBRACK = 99,
    RBRACK = 100,
    Concat = 101,
    Immediate = 102,
    SourceFile = 103,
    WhenEvent = 104,
    EventModifier = 105,
    DictFor = 106,
    DictUpdate = 107,
    DictWith = 108,
    Regexp = 109,
    Switch = 110,
    SwitchArm = 111,
    For = 112,
    While = 113,
    ExprCmd = 114,
    Foreach = 115,
    Global = 116,
    Namespace = 117,
    Try = 118,
    OnHandler = 119,
    TrapHandler = 120,
    Finally = 121,
    Command2 = 122,
    Command = 123,
    WordList = 124,
    WordSimple = 125,
    ConcatWord = 126,
    NsDelim = 127,
    Id2 = 128,
    ArrayIndex = 129,
    VariableSubstitution = 130,
    BracedId = 131,
    BracedWord = 132,
    BracedWordSimple = 133,
    Set = 134,
    Procedure = 135,
    ArgumentWord = 136,
    Argument = 137,
    Arguments = 138,
    ExprAtomNoBrace = 139,
    Expr3 = 140,
    Expr = 141,
    UnaryExpr = 142,
    BinopExpr = 143,
    TernaryExpr = 144,
    Elseif = 145,
    Else = 146,
    If = 147,
    Conditional = 148,
    Catch = 149,
    QuotedWord = 150,
    CommandSubstitution = 151,
    SourceFileRepeat1 = 152,
    WhenEventRepeat1 = 153,
    DictUpdateRepeat1 = 154,
    RegexpRepeat1 = 155,
    RegexpRepeat2 = 156,
    SwitchRepeat1 = 157,
    SwitchRepeat2 = 158,
    SwitchRepeat3 = 159,
    TryRepeat1 = 160,
    WordListRepeat1 = 161,
    WordSimpleRepeat1 = 162,
    ConcatWordRepeat1 = 163,
    IdImmediateRepeat1 = 164,
    BracedWordRepeat1 = 165,
    BracedWordRepeat2 = 166,
    ArgumentsRepeat1 = 167,
    IfRepeat1 = 168,
    QuotedWordRepeat1 = 169,
    Error = 170,
}

impl From<Irules> for &'static str {
    #[inline]
    fn from(tok: Irules) -> Self {
        match tok {
            Irules::End => "end",
            Irules::SimpleWord => "simple_word",
            Irules::LF => "\n",
            Irules::SEMI => ";",
            Irules::Comment => "comment",
            Irules::When => "when",
            Irules::EventName => "event_name",
            Irules::Priority => "priority",
            Irules::Timing => "timing",
            Irules::On => "on",
            Irules::Off => "off",
            Irules::Dict => "dict",
            Irules::For2 => "for",
            Irules::Update => "update",
            Irules::With => "with",
            Irules::Regexp2 => "regexp",
            Irules::DASHabout => "-about",
            Irules::DASHexpanded => "-expanded",
            Irules::DASHindices => "-indices",
            Irules::DASHline => "-line",
            Irules::DASHlinestop => "-linestop",
            Irules::DASHlineanchor => "-lineanchor",
            Irules::DASHnocase => "-nocase",
            Irules::DASHall => "-all",
            Irules::DASHinline => "-inline",
            Irules::DASHstart => "-start",
            Irules::DASHDASH => "--",
            Irules::Switch2 => "switch",
            Irules::DASHexact => "-exact",
            Irules::DASHglob => "-glob",
            Irules::DASHregexp => "-regexp",
            Irules::DASHmatchvar => "-matchvar",
            Irules::DASHindexvar => "-indexvar",
            Irules::LBRACE => "{",
            Irules::RBRACE => "}",
            Irules::While2 => "while",
            Irules::Expr2 => "expr",
            Irules::Foreach2 => "foreach",
            Irules::Global2 => "global",
            Irules::Namespace2 => "namespace",
            Irules::Try2 => "try",
            Irules::Trap => "trap",
            Irules::Finally2 => "finally",
            Irules::Unpack => "unpack",
            Irules::COLONCOLON => "::",
            Irules::IdentImm => "_ident_imm",
            Irules::LPAREN => "(",
            Irules::RPAREN => ")",
            Irules::DOLLAR => "$",
            Irules::Id => "id",
            Irules::Set2 => "set",
            Irules::Proc => "proc",
            Irules::Number => "number",
            Irules::Boolean => "_boolean",
            Irules::LPAREN2 => "(",
            Irules::DASH => "-",
            Irules::PLUS => "+",
            Irules::TILDE => "~",
            Irules::BANG => "!",
            Irules::Not => "not",
            Irules::STARSTAR => "**",
            Irules::SLASH => "/",
            Irules::STAR => "*",
            Irules::PERCENT => "%",
            Irules::LTLT => "<<",
            Irules::GTGT => ">>",
            Irules::GT => ">",
            Irules::LT => "<",
            Irules::GTEQ => ">=",
            Irules::LTEQ => "<=",
            Irules::EQEQ => "==",
            Irules::BANGEQ => "!=",
            Irules::Eq => "eq",
            Irules::Ne => "ne",
            Irules::StartsWith => "starts_with",
            Irules::EndsWith => "ends_with",
            Irules::Contains => "contains",
            Irules::Equals => "equals",
            Irules::Matches => "matches",
            Irules::MatchesRegex => "matches_regex",
            Irules::MatchesGlob => "matches_glob",
            Irules::In => "in",
            Irules::Ni => "ni",
            Irules::AMP => "&",
            Irules::CARET => "^",
            Irules::PIPE => "|",
            Irules::AMPAMP => "&&",
            Irules::And => "and",
            Irules::PIPEPIPE => "||",
            Irules::Or => "or",
            Irules::QMARK => "?",
            Irules::COLON => ":",
            Irules::Elseif2 => "elseif",
            Irules::Else2 => "else",
            Irules::If2 => "if",
            Irules::Catch2 => "catch",
            Irules::DQUOTE => "\"",
            Irules::EscapedCharacter => "escaped_character",
            Irules::QuotedWordContent => "_quoted_word_content",
            Irules::LBRACK => "[",
            Irules::RBRACK => "]",
            Irules::Concat => "_concat",
            Irules::Immediate => "_immediate",
            Irules::SourceFile => "source_file",
            Irules::WhenEvent => "when_event",
            Irules::EventModifier => "event_modifier",
            Irules::DictFor => "dict_for",
            Irules::DictUpdate => "dict_update",
            Irules::DictWith => "dict_with",
            Irules::Regexp => "regexp",
            Irules::Switch => "switch",
            Irules::SwitchArm => "switch_arm",
            Irules::For => "for",
            Irules::While => "while",
            Irules::ExprCmd => "expr_cmd",
            Irules::Foreach => "foreach",
            Irules::Global => "global",
            Irules::Namespace => "namespace",
            Irules::Try => "try",
            Irules::OnHandler => "on_handler",
            Irules::TrapHandler => "trap_handler",
            Irules::Finally => "finally",
            Irules::Command2 => "_command",
            Irules::Command => "command",
            Irules::WordList => "word_list",
            Irules::WordSimple => "_word_simple",
            Irules::ConcatWord => "_concat_word",
            Irules::NsDelim => "_ns_delim",
            Irules::Id2 => "id",
            Irules::ArrayIndex => "array_index",
            Irules::VariableSubstitution => "variable_substitution",
            Irules::BracedId => "_braced_id",
            Irules::BracedWord => "braced_word",
            Irules::BracedWordSimple => "braced_word_simple",
            Irules::Set => "set",
            Irules::Procedure => "procedure",
            Irules::ArgumentWord => "_argument_word",
            Irules::Argument => "argument",
            Irules::Arguments => "arguments",
            Irules::ExprAtomNoBrace => "_expr_atom_no_brace",
            Irules::Expr3 => "_expr",
            Irules::Expr => "expr",
            Irules::UnaryExpr => "unary_expr",
            Irules::BinopExpr => "binop_expr",
            Irules::TernaryExpr => "ternary_expr",
            Irules::Elseif => "elseif",
            Irules::Else => "else",
            Irules::If => "if",
            Irules::Conditional => "_conditional",
            Irules::Catch => "catch",
            Irules::QuotedWord => "quoted_word",
            Irules::CommandSubstitution => "command_substitution",
            Irules::SourceFileRepeat1 => "source_file_repeat1",
            Irules::WhenEventRepeat1 => "when_event_repeat1",
            Irules::DictUpdateRepeat1 => "dict_update_repeat1",
            Irules::RegexpRepeat1 => "regexp_repeat1",
            Irules::RegexpRepeat2 => "regexp_repeat2",
            Irules::SwitchRepeat1 => "switch_repeat1",
            Irules::SwitchRepeat2 => "switch_repeat2",
            Irules::SwitchRepeat3 => "switch_repeat3",
            Irules::TryRepeat1 => "try_repeat1",
            Irules::WordListRepeat1 => "word_list_repeat1",
            Irules::WordSimpleRepeat1 => "_word_simple_repeat1",
            Irules::ConcatWordRepeat1 => "_concat_word_repeat1",
            Irules::IdImmediateRepeat1 => "_id_immediate_repeat1",
            Irules::BracedWordRepeat1 => "braced_word_repeat1",
            Irules::BracedWordRepeat2 => "braced_word_repeat2",
            Irules::ArgumentsRepeat1 => "arguments_repeat1",
            Irules::IfRepeat1 => "if_repeat1",
            Irules::QuotedWordRepeat1 => "quoted_word_repeat1",
            Irules::Error => "ERROR",
        }
    }
}

impl From<u16> for Irules {
    #[inline]
    fn from(x: u16) -> Self {
        num_traits::FromPrimitive::from_u16(x).unwrap_or(Self::Error)
    }
}

// Irules == u16
impl PartialEq<u16> for Irules {
    #[inline]
    fn eq(&self, x: &u16) -> bool {
        *self == Into::<Self>::into(*x)
    }
}

// u16 == Irules
impl PartialEq<Irules> for u16 {
    #[inline]
    fn eq(&self, x: &Irules) -> bool {
        *x == *self
    }
}