big-code-analysis 1.1.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 Lua {
    End = 0,
    Identifier = 1,
    HashBangLine = 2,
    Return = 3,
    SEMI = 4,
    EQ = 5,
    COMMA = 6,
    COLONCOLON = 7,
    BreakStatement = 8,
    Goto = 9,
    Do = 10,
    End2 = 11,
    While = 12,
    Repeat = 13,
    Until = 14,
    If = 15,
    Then = 16,
    Elseif = 17,
    Else = 18,
    For = 19,
    In = 20,
    Function = 21,
    Local = 22,
    Global = 23,
    DOT = 24,
    COLON = 25,
    STAR = 26,
    LT = 27,
    GT = 28,
    Nil = 29,
    False = 30,
    True = 31,
    Number = 32,
    DQUOTE = 33,
    SQUOTE = 34,
    DoublequoteStringContentToken1 = 35,
    SinglequoteStringContentToken1 = 36,
    EscapeSequence = 37,
    VarargExpression = 38,
    LPAREN = 39,
    RPAREN = 40,
    LBRACK = 41,
    RBRACK = 42,
    LBRACE = 43,
    RBRACE = 44,
    Or = 45,
    And = 46,
    LTEQ = 47,
    EQEQ = 48,
    TILDEEQ = 49,
    GTEQ = 50,
    PIPE = 51,
    TILDE = 52,
    AMP = 53,
    LTLT = 54,
    GTGT = 55,
    PLUS = 56,
    DASH = 57,
    SLASH = 58,
    SLASHSLASH = 59,
    PERCENT = 60,
    DOTDOT = 61,
    CARET = 62,
    Not = 63,
    HASH = 64,
    DASHDASH = 65,
    CommentContent = 66,
    LBRACKLBRACK = 67,
    CommentContent2 = 68,
    RBRACKRBRACK = 69,
    LBRACKLBRACK2 = 70,
    StringContent = 71,
    RBRACKRBRACK2 = 72,
    Chunk = 73,
    Block = 74,
    Statement = 75,
    ReturnStatement = 76,
    EmptyStatement = 77,
    AssignmentStatement = 78,
    VariableList = 79,
    ExpressionList = 80,
    LabelStatement = 81,
    GotoStatement = 82,
    DoStatement = 83,
    WhileStatement = 84,
    RepeatStatement = 85,
    IfStatement = 86,
    ElseifStatement = 87,
    ElseStatement = 88,
    ForStatement = 89,
    ForGenericClause = 90,
    ForNumericClause = 91,
    VariableList2 = 92,
    Declaration = 93,
    FunctionDeclaration = 94,
    FunctionDeclaration2 = 95,
    FunctionDeclaration3 = 96,
    FunctionName = 97,
    FunctionNamePrefixExpression = 98,
    DotIndexExpression = 99,
    MethodIndexExpression = 100,
    VariableDeclaration = 101,
    VariableDeclaration2 = 102,
    AssignmentStatement2 = 103,
    VariableList3 = 104,
    ImplicitVariableDeclaration = 105,
    Attribute = 106,
    ExpressionList2 = 107,
    Expression = 108,
    String = 109,
    QuoteString = 110,
    DoublequoteStringContent = 111,
    SinglequoteStringContent = 112,
    BlockString = 113,
    FunctionDefinition = 114,
    FunctionBody = 115,
    Parameters = 116,
    ParameterList = 117,
    VarargParameter = 118,
    PrefixExpression = 119,
    Variable = 120,
    BracketIndexExpression = 121,
    DotIndexExpression2 = 122,
    FunctionCall = 123,
    MethodIndexExpression2 = 124,
    Arguments = 125,
    ParenthesizedExpression = 126,
    TableConstructor = 127,
    FieldList = 128,
    FieldSep = 129,
    Field = 130,
    BinaryExpression = 131,
    UnaryExpression = 132,
    Comment = 133,
    ContextualKeyword = 134,
    ChunkRepeat1 = 135,
    VariableAssignmentVarlistRepeat1 = 136,
    VariableAssignmentExplistRepeat1 = 137,
    IfStatementRepeat1 = 138,
    NameListRepeat1 = 139,
    AttNameListRepeat1 = 140,
    ExpressionListRepeat1 = 141,
    FieldListRepeat1 = 142,
    Error = 143,
}

impl From<Lua> for &'static str {
    #[inline]
    fn from(tok: Lua) -> Self {
        match tok {
            Lua::End => "end",
            Lua::Identifier => "identifier",
            Lua::HashBangLine => "hash_bang_line",
            Lua::Return => "return",
            Lua::SEMI => ";",
            Lua::EQ => "=",
            Lua::COMMA => ",",
            Lua::COLONCOLON => "::",
            Lua::BreakStatement => "break_statement",
            Lua::Goto => "goto",
            Lua::Do => "do",
            Lua::End2 => "end",
            Lua::While => "while",
            Lua::Repeat => "repeat",
            Lua::Until => "until",
            Lua::If => "if",
            Lua::Then => "then",
            Lua::Elseif => "elseif",
            Lua::Else => "else",
            Lua::For => "for",
            Lua::In => "in",
            Lua::Function => "function",
            Lua::Local => "local",
            Lua::Global => "global",
            Lua::DOT => ".",
            Lua::COLON => ":",
            Lua::STAR => "*",
            Lua::LT => "<",
            Lua::GT => ">",
            Lua::Nil => "nil",
            Lua::False => "false",
            Lua::True => "true",
            Lua::Number => "number",
            Lua::DQUOTE => "\"",
            Lua::SQUOTE => "'",
            Lua::DoublequoteStringContentToken1 => "_doublequote_string_content_token1",
            Lua::SinglequoteStringContentToken1 => "_singlequote_string_content_token1",
            Lua::EscapeSequence => "escape_sequence",
            Lua::VarargExpression => "vararg_expression",
            Lua::LPAREN => "(",
            Lua::RPAREN => ")",
            Lua::LBRACK => "[",
            Lua::RBRACK => "]",
            Lua::LBRACE => "{",
            Lua::RBRACE => "}",
            Lua::Or => "or",
            Lua::And => "and",
            Lua::LTEQ => "<=",
            Lua::EQEQ => "==",
            Lua::TILDEEQ => "~=",
            Lua::GTEQ => ">=",
            Lua::PIPE => "|",
            Lua::TILDE => "~",
            Lua::AMP => "&",
            Lua::LTLT => "<<",
            Lua::GTGT => ">>",
            Lua::PLUS => "+",
            Lua::DASH => "-",
            Lua::SLASH => "/",
            Lua::SLASHSLASH => "//",
            Lua::PERCENT => "%",
            Lua::DOTDOT => "..",
            Lua::CARET => "^",
            Lua::Not => "not",
            Lua::HASH => "#",
            Lua::DASHDASH => "--",
            Lua::CommentContent => "comment_content",
            Lua::LBRACKLBRACK => "[[",
            Lua::CommentContent2 => "comment_content",
            Lua::RBRACKRBRACK => "]]",
            Lua::LBRACKLBRACK2 => "[[",
            Lua::StringContent => "string_content",
            Lua::RBRACKRBRACK2 => "]]",
            Lua::Chunk => "chunk",
            Lua::Block => "block",
            Lua::Statement => "statement",
            Lua::ReturnStatement => "return_statement",
            Lua::EmptyStatement => "empty_statement",
            Lua::AssignmentStatement => "assignment_statement",
            Lua::VariableList => "variable_list",
            Lua::ExpressionList => "expression_list",
            Lua::LabelStatement => "label_statement",
            Lua::GotoStatement => "goto_statement",
            Lua::DoStatement => "do_statement",
            Lua::WhileStatement => "while_statement",
            Lua::RepeatStatement => "repeat_statement",
            Lua::IfStatement => "if_statement",
            Lua::ElseifStatement => "elseif_statement",
            Lua::ElseStatement => "else_statement",
            Lua::ForStatement => "for_statement",
            Lua::ForGenericClause => "for_generic_clause",
            Lua::ForNumericClause => "for_numeric_clause",
            Lua::VariableList2 => "variable_list",
            Lua::Declaration => "declaration",
            Lua::FunctionDeclaration => "function_declaration",
            Lua::FunctionDeclaration2 => "function_declaration",
            Lua::FunctionDeclaration3 => "function_declaration",
            Lua::FunctionName => "_function_name",
            Lua::FunctionNamePrefixExpression => "_function_name_prefix_expression",
            Lua::DotIndexExpression => "dot_index_expression",
            Lua::MethodIndexExpression => "method_index_expression",
            Lua::VariableDeclaration => "variable_declaration",
            Lua::VariableDeclaration2 => "variable_declaration",
            Lua::AssignmentStatement2 => "assignment_statement",
            Lua::VariableList3 => "variable_list",
            Lua::ImplicitVariableDeclaration => "implicit_variable_declaration",
            Lua::Attribute => "attribute",
            Lua::ExpressionList2 => "expression_list",
            Lua::Expression => "expression",
            Lua::String => "string",
            Lua::QuoteString => "_quote_string",
            Lua::DoublequoteStringContent => "_doublequote_string_content",
            Lua::SinglequoteStringContent => "_singlequote_string_content",
            Lua::BlockString => "_block_string",
            Lua::FunctionDefinition => "function_definition",
            Lua::FunctionBody => "_function_body",
            Lua::Parameters => "parameters",
            Lua::ParameterList => "_parameter_list",
            Lua::VarargParameter => "_vararg_parameter",
            Lua::PrefixExpression => "_prefix_expression",
            Lua::Variable => "variable",
            Lua::BracketIndexExpression => "bracket_index_expression",
            Lua::DotIndexExpression2 => "dot_index_expression",
            Lua::FunctionCall => "function_call",
            Lua::MethodIndexExpression2 => "method_index_expression",
            Lua::Arguments => "arguments",
            Lua::ParenthesizedExpression => "parenthesized_expression",
            Lua::TableConstructor => "table_constructor",
            Lua::FieldList => "_field_list",
            Lua::FieldSep => "_field_sep",
            Lua::Field => "field",
            Lua::BinaryExpression => "binary_expression",
            Lua::UnaryExpression => "unary_expression",
            Lua::Comment => "comment",
            Lua::ContextualKeyword => "_contextual_keyword",
            Lua::ChunkRepeat1 => "chunk_repeat1",
            Lua::VariableAssignmentVarlistRepeat1 => "_variable_assignment_varlist_repeat1",
            Lua::VariableAssignmentExplistRepeat1 => "_variable_assignment_explist_repeat1",
            Lua::IfStatementRepeat1 => "if_statement_repeat1",
            Lua::NameListRepeat1 => "_name_list_repeat1",
            Lua::AttNameListRepeat1 => "_att_name_list_repeat1",
            Lua::ExpressionListRepeat1 => "_expression_list_repeat1",
            Lua::FieldListRepeat1 => "_field_list_repeat1",
            Lua::Error => "ERROR",
        }
    }
}

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

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

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