#![allow(clippy::match_same_arms, clippy::too_many_lines)]
use num_derive::FromPrimitive;
#[derive(Clone, Debug, PartialEq, Eq, FromPrimitive)]
pub enum Bash {
End = 0,
Word = 1,
For = 2,
Select = 3,
In = 4,
LPARENLPAREN = 5,
RPARENRPAREN = 6,
SEMI = 7,
COMMA = 8,
EQ = 9,
PLUSPLUS = 10,
DASHDASH = 11,
PLUSEQ = 12,
DASHEQ = 13,
STAREQ = 14,
SLASHEQ = 15,
PERCENTEQ = 16,
STARSTAREQ = 17,
LTLTEQ = 18,
GTGTEQ = 19,
AMPEQ = 20,
CARETEQ = 21,
PIPEEQ = 22,
PIPEPIPE = 23,
DASHo = 24,
AMPAMP = 25,
DASHa = 26,
PIPE = 27,
CARET = 28,
AMP = 29,
EQEQ = 30,
BANGEQ = 31,
LT = 32,
GT = 33,
LTEQ = 34,
GTEQ = 35,
LTLT = 36,
GTGT = 37,
PLUS = 38,
DASH = 39,
STAR = 40,
SLASH = 41,
PERCENT = 42,
STARSTAR = 43,
LPAREN = 44,
RPAREN = 45,
Word2 = 46,
While = 47,
Until = 48,
Do = 49,
Done = 50,
If = 51,
Then = 52,
Fi = 53,
Elif = 54,
Else = 55,
Case = 56,
Esac = 57,
SEMISEMI = 58,
SEMIAMP = 59,
SEMISEMIAMP = 60,
Function = 61,
LBRACE = 62,
RBRACE = 63,
PIPEAMP = 64,
BANG = 65,
LBRACK = 66,
RBRACK = 67,
LBRACKLBRACK = 68,
RBRACKRBRACK = 69,
Declare = 70,
Typeset = 71,
Export = 72,
Readonly = 73,
Local = 74,
Unset = 75,
Unsetenv = 76,
EQTILDE = 77,
AMPGT = 78,
AMPGTGT = 79,
LTAMP = 80,
GTAMP = 81,
GTPIPE = 82,
LTAMPDASH = 83,
GTAMPDASH = 84,
LTLTDASH = 85,
HeredocRedirectToken1 = 86,
LTLTLT = 87,
QMARK = 88,
COLON = 89,
PLUSPLUS2 = 90,
DASHDASH2 = 91,
DASH2 = 92,
PLUS2 = 93,
TILDE = 94,
DOLLARLPARENLPAREN = 95,
DOLLARLBRACK = 96,
Number = 97,
DOTDOT = 98,
RBRACE2 = 99,
BQUOTEBQUOTE = 100,
DOLLAR = 101,
SpecialCharacter = 102,
DQUOTE = 103,
StringContent = 104,
RawString = 105,
AnsiCString = 106,
NumberToken1 = 107,
NumberToken2 = 108,
HASH = 109,
DOLLARLBRACE = 110,
RBRACE3 = 111,
BANG2 = 112,
AT = 113,
STAR2 = 114,
HASH2 = 115,
EQ2 = 116,
COLONEQ = 117,
DASH3 = 118,
COLONDASH = 119,
PLUS3 = 120,
COLONPLUS = 121,
QMARK2 = 122,
COLONQMARK = 123,
PERCENTPERCENT = 124,
Regex = 125,
SLASHSLASH = 126,
SLASHHASH = 127,
SLASHPERCENT = 128,
COMMACOMMA = 129,
CARETCARET = 130,
U = 131,
U2 = 132,
L = 133,
Q = 134,
E = 135,
P = 136,
A = 137,
K = 138,
A2 = 139,
K2 = 140,
DOLLARLPAREN = 141,
BQUOTE = 142,
DOLLARBQUOTE = 143,
LTLPAREN = 144,
GTLPAREN = 145,
Comment = 146,
Word3 = 147,
VariableName = 148,
VariableName2 = 149,
SpecialVariableName = 150,
SpecialVariableName2 = 151,
HeredocStart = 152,
HeredocBody = 153,
HeredocBodyBeginning = 154,
HeredocContent = 155,
HeredocEnd = 156,
FileDescriptor = 157,
EmptyValue = 158,
Concat = 159,
VariableName3 = 160,
TestOperator = 161,
Regex2 = 162,
Regex3 = 163,
Regex4 = 164,
Word4 = 165,
ExtglobPattern = 166,
DOLLAR2 = 167,
LBRACE2 = 168,
HASHHASH = 169,
HASH3 = 170,
BANG3 = 171,
EQ3 = 172,
ErrorRecovery = 173,
Program = 174,
Statements = 175,
TerminatedStatement = 176,
StatementNotPipeline = 177,
RedirectedStatement = 178,
ForStatement = 179,
CStyleForStatement = 180,
ForBody = 181,
CExpression = 182,
CExpressionNotAssignment = 183,
VariableAssignment = 184,
UnaryExpression = 185,
BinaryExpression = 186,
PostfixExpression = 187,
ParenthesizedExpression = 188,
WhileStatement = 189,
DoGroup = 190,
IfStatement = 191,
ElifClause = 192,
ElseClause = 193,
CaseStatement = 194,
CaseItem = 195,
CaseItem2 = 196,
FunctionDefinition = 197,
CompoundStatement = 198,
Subshell = 199,
Pipeline = 200,
List = 201,
NegatedCommand = 202,
TestCommand = 203,
BinaryExpression2 = 204,
DeclarationCommand = 205,
UnsetCommand = 206,
Command = 207,
CommandName = 208,
VariableAssignment2 = 209,
VariableAssignments = 210,
Subscript = 211,
FileRedirect = 212,
HeredocRedirect = 213,
Pipeline2 = 214,
HeredocExpression = 215,
HeredocCommand = 216,
HeredocBody3 = 217,
HeredocBody2 = 218,
SimpleHeredocBody = 219,
HerestringRedirect = 220,
Expression = 221,
BinaryExpression3 = 222,
TernaryExpression = 223,
UnaryExpression2 = 224,
PostfixExpression2 = 225,
ParenthesizedExpression2 = 226,
ArithmeticExpansion = 227,
BraceExpression = 228,
ArithmeticExpression = 229,
ArithmeticLiteral = 230,
BinaryExpression4 = 231,
TernaryExpression2 = 232,
UnaryExpression3 = 233,
PostfixExpression3 = 234,
ParenthesizedExpression3 = 235,
Concatenation = 236,
String = 237,
TranslatedString = 238,
Array = 239,
Number2 = 240,
SimpleExpansion = 241,
Expansion = 242,
ExpansionBody = 243,
ExpansionExpression = 244,
ExpansionRegex = 245,
ExpansionRegexReplacement = 246,
ExpansionRegexRemoval = 247,
ExpansionMaxLength = 248,
ExpansionMaxLengthExpression = 249,
BinaryExpression5 = 250,
ExpansionOperator = 251,
Concatenation2 = 252,
CommandSubstitution = 253,
ProcessSubstitution = 254,
ExtglobBlob = 255,
CTerminator = 256,
StatementsRepeat1 = 257,
RedirectedStatementRepeat1 = 258,
RedirectedStatementRepeat2 = 259,
ForStatementRepeat1 = 260,
ForBodyRepeat1 = 261,
IfStatementRepeat1 = 262,
CaseStatementRepeat1 = 263,
CaseItemRepeat1 = 264,
CompoundStatementRepeat1 = 265,
PipelineRepeat1 = 266,
DeclarationCommandRepeat1 = 267,
UnsetCommandRepeat1 = 268,
CommandRepeat1 = 269,
CommandRepeat2 = 270,
VariableAssignmentsRepeat1 = 271,
HeredocBodyRepeat1 = 272,
LiteralRepeat1 = 273,
ArithmeticExpansionRepeat1 = 274,
ConcatenationRepeat1 = 275,
StringRepeat1 = 276,
ExpansionBodyRepeat1 = 277,
ExpansionRegexRepeat1 = 278,
ConcatenationInExpansionRepeat1 = 279,
Error = 280,
}
impl From<Bash> for &'static str {
#[inline]
fn from(tok: Bash) -> Self {
match tok {
Bash::End => "end",
Bash::Word => "word",
Bash::For => "for",
Bash::Select => "select",
Bash::In => "in",
Bash::LPARENLPAREN => "((",
Bash::RPARENRPAREN => "))",
Bash::SEMI => ";",
Bash::COMMA => ",",
Bash::EQ => "=",
Bash::PLUSPLUS => "++",
Bash::DASHDASH => "--",
Bash::PLUSEQ => "+=",
Bash::DASHEQ => "-=",
Bash::STAREQ => "*=",
Bash::SLASHEQ => "/=",
Bash::PERCENTEQ => "%=",
Bash::STARSTAREQ => "**=",
Bash::LTLTEQ => "<<=",
Bash::GTGTEQ => ">>=",
Bash::AMPEQ => "&=",
Bash::CARETEQ => "^=",
Bash::PIPEEQ => "|=",
Bash::PIPEPIPE => "||",
Bash::DASHo => "-o",
Bash::AMPAMP => "&&",
Bash::DASHa => "-a",
Bash::PIPE => "|",
Bash::CARET => "^",
Bash::AMP => "&",
Bash::EQEQ => "==",
Bash::BANGEQ => "!=",
Bash::LT => "<",
Bash::GT => ">",
Bash::LTEQ => "<=",
Bash::GTEQ => ">=",
Bash::LTLT => "<<",
Bash::GTGT => ">>",
Bash::PLUS => "+",
Bash::DASH => "-",
Bash::STAR => "*",
Bash::SLASH => "/",
Bash::PERCENT => "%",
Bash::STARSTAR => "**",
Bash::LPAREN => "(",
Bash::RPAREN => ")",
Bash::Word2 => "word",
Bash::While => "while",
Bash::Until => "until",
Bash::Do => "do",
Bash::Done => "done",
Bash::If => "if",
Bash::Then => "then",
Bash::Fi => "fi",
Bash::Elif => "elif",
Bash::Else => "else",
Bash::Case => "case",
Bash::Esac => "esac",
Bash::SEMISEMI => ";;",
Bash::SEMIAMP => ";&",
Bash::SEMISEMIAMP => ";;&",
Bash::Function => "function",
Bash::LBRACE => "{",
Bash::RBRACE => "}",
Bash::PIPEAMP => "|&",
Bash::BANG => "!",
Bash::LBRACK => "[",
Bash::RBRACK => "]",
Bash::LBRACKLBRACK => "[[",
Bash::RBRACKRBRACK => "]]",
Bash::Declare => "declare",
Bash::Typeset => "typeset",
Bash::Export => "export",
Bash::Readonly => "readonly",
Bash::Local => "local",
Bash::Unset => "unset",
Bash::Unsetenv => "unsetenv",
Bash::EQTILDE => "=~",
Bash::AMPGT => "&>",
Bash::AMPGTGT => "&>>",
Bash::LTAMP => "<&",
Bash::GTAMP => ">&",
Bash::GTPIPE => ">|",
Bash::LTAMPDASH => "<&-",
Bash::GTAMPDASH => ">&-",
Bash::LTLTDASH => "<<-",
Bash::HeredocRedirectToken1 => "heredoc_redirect_token1",
Bash::LTLTLT => "<<<",
Bash::QMARK => "?",
Bash::COLON => ":",
Bash::PLUSPLUS2 => "++",
Bash::DASHDASH2 => "--",
Bash::DASH2 => "-",
Bash::PLUS2 => "+",
Bash::TILDE => "~",
Bash::DOLLARLPARENLPAREN => "$((",
Bash::DOLLARLBRACK => "$[",
Bash::Number => "number",
Bash::DOTDOT => "..",
Bash::RBRACE2 => "}",
Bash::BQUOTEBQUOTE => "``",
Bash::DOLLAR => "$",
Bash::SpecialCharacter => "_special_character",
Bash::DQUOTE => "\"",
Bash::StringContent => "string_content",
Bash::RawString => "raw_string",
Bash::AnsiCString => "ansi_c_string",
Bash::NumberToken1 => "number_token1",
Bash::NumberToken2 => "number_token2",
Bash::HASH => "#",
Bash::DOLLARLBRACE => "${",
Bash::RBRACE3 => "}",
Bash::BANG2 => "!",
Bash::AT => "@",
Bash::STAR2 => "*",
Bash::HASH2 => "#",
Bash::EQ2 => "=",
Bash::COLONEQ => ":=",
Bash::DASH3 => "-",
Bash::COLONDASH => ":-",
Bash::PLUS3 => "+",
Bash::COLONPLUS => ":+",
Bash::QMARK2 => "?",
Bash::COLONQMARK => ":?",
Bash::PERCENTPERCENT => "%%",
Bash::Regex => "regex",
Bash::SLASHSLASH => "//",
Bash::SLASHHASH => "/#",
Bash::SLASHPERCENT => "/%",
Bash::COMMACOMMA => ",,",
Bash::CARETCARET => "^^",
Bash::U => "U",
Bash::U2 => "u",
Bash::L => "L",
Bash::Q => "Q",
Bash::E => "E",
Bash::P => "P",
Bash::A => "A",
Bash::K => "K",
Bash::A2 => "a",
Bash::K2 => "k",
Bash::DOLLARLPAREN => "$(",
Bash::BQUOTE => "`",
Bash::DOLLARBQUOTE => "$`",
Bash::LTLPAREN => "<(",
Bash::GTLPAREN => ">(",
Bash::Comment => "comment",
Bash::Word3 => "word",
Bash::VariableName => "variable_name",
Bash::VariableName2 => "variable_name",
Bash::SpecialVariableName => "special_variable_name",
Bash::SpecialVariableName2 => "special_variable_name",
Bash::HeredocStart => "heredoc_start",
Bash::HeredocBody => "heredoc_body",
Bash::HeredocBodyBeginning => "_heredoc_body_beginning",
Bash::HeredocContent => "heredoc_content",
Bash::HeredocEnd => "heredoc_end",
Bash::FileDescriptor => "file_descriptor",
Bash::EmptyValue => "_empty_value",
Bash::Concat => "_concat",
Bash::VariableName3 => "variable_name",
Bash::TestOperator => "test_operator",
Bash::Regex2 => "regex",
Bash::Regex3 => "regex",
Bash::Regex4 => "regex",
Bash::Word4 => "word",
Bash::ExtglobPattern => "extglob_pattern",
Bash::DOLLAR2 => "$",
Bash::LBRACE2 => "{",
Bash::HASHHASH => "##",
Bash::HASH3 => "#",
Bash::BANG3 => "!",
Bash::EQ3 => "=",
Bash::ErrorRecovery => "__error_recovery",
Bash::Program => "program",
Bash::Statements => "_statements",
Bash::TerminatedStatement => "_terminated_statement",
Bash::StatementNotPipeline => "_statement_not_pipeline",
Bash::RedirectedStatement => "redirected_statement",
Bash::ForStatement => "for_statement",
Bash::CStyleForStatement => "c_style_for_statement",
Bash::ForBody => "_for_body",
Bash::CExpression => "_c_expression",
Bash::CExpressionNotAssignment => "_c_expression_not_assignment",
Bash::VariableAssignment => "variable_assignment",
Bash::UnaryExpression => "unary_expression",
Bash::BinaryExpression => "binary_expression",
Bash::PostfixExpression => "postfix_expression",
Bash::ParenthesizedExpression => "parenthesized_expression",
Bash::WhileStatement => "while_statement",
Bash::DoGroup => "do_group",
Bash::IfStatement => "if_statement",
Bash::ElifClause => "elif_clause",
Bash::ElseClause => "else_clause",
Bash::CaseStatement => "case_statement",
Bash::CaseItem => "case_item",
Bash::CaseItem2 => "case_item",
Bash::FunctionDefinition => "function_definition",
Bash::CompoundStatement => "compound_statement",
Bash::Subshell => "subshell",
Bash::Pipeline => "pipeline",
Bash::List => "list",
Bash::NegatedCommand => "negated_command",
Bash::TestCommand => "test_command",
Bash::BinaryExpression2 => "binary_expression",
Bash::DeclarationCommand => "declaration_command",
Bash::UnsetCommand => "unset_command",
Bash::Command => "command",
Bash::CommandName => "command_name",
Bash::VariableAssignment2 => "variable_assignment",
Bash::VariableAssignments => "variable_assignments",
Bash::Subscript => "subscript",
Bash::FileRedirect => "file_redirect",
Bash::HeredocRedirect => "heredoc_redirect",
Bash::Pipeline2 => "pipeline",
Bash::HeredocExpression => "_heredoc_expression",
Bash::HeredocCommand => "_heredoc_command",
Bash::HeredocBody3 => "_heredoc_body",
Bash::HeredocBody2 => "heredoc_body",
Bash::SimpleHeredocBody => "_simple_heredoc_body",
Bash::HerestringRedirect => "herestring_redirect",
Bash::Expression => "_expression",
Bash::BinaryExpression3 => "binary_expression",
Bash::TernaryExpression => "ternary_expression",
Bash::UnaryExpression2 => "unary_expression",
Bash::PostfixExpression2 => "postfix_expression",
Bash::ParenthesizedExpression2 => "parenthesized_expression",
Bash::ArithmeticExpansion => "arithmetic_expansion",
Bash::BraceExpression => "brace_expression",
Bash::ArithmeticExpression => "_arithmetic_expression",
Bash::ArithmeticLiteral => "_arithmetic_literal",
Bash::BinaryExpression4 => "binary_expression",
Bash::TernaryExpression2 => "ternary_expression",
Bash::UnaryExpression3 => "unary_expression",
Bash::PostfixExpression3 => "postfix_expression",
Bash::ParenthesizedExpression3 => "parenthesized_expression",
Bash::Concatenation => "concatenation",
Bash::String => "string",
Bash::TranslatedString => "translated_string",
Bash::Array => "array",
Bash::Number2 => "number",
Bash::SimpleExpansion => "simple_expansion",
Bash::Expansion => "expansion",
Bash::ExpansionBody => "_expansion_body",
Bash::ExpansionExpression => "_expansion_expression",
Bash::ExpansionRegex => "_expansion_regex",
Bash::ExpansionRegexReplacement => "_expansion_regex_replacement",
Bash::ExpansionRegexRemoval => "_expansion_regex_removal",
Bash::ExpansionMaxLength => "_expansion_max_length",
Bash::ExpansionMaxLengthExpression => "_expansion_max_length_expression",
Bash::BinaryExpression5 => "binary_expression",
Bash::ExpansionOperator => "_expansion_operator",
Bash::Concatenation2 => "concatenation",
Bash::CommandSubstitution => "command_substitution",
Bash::ProcessSubstitution => "process_substitution",
Bash::ExtglobBlob => "_extglob_blob",
Bash::CTerminator => "_c_terminator",
Bash::StatementsRepeat1 => "_statements_repeat1",
Bash::RedirectedStatementRepeat1 => "redirected_statement_repeat1",
Bash::RedirectedStatementRepeat2 => "redirected_statement_repeat2",
Bash::ForStatementRepeat1 => "for_statement_repeat1",
Bash::ForBodyRepeat1 => "_for_body_repeat1",
Bash::IfStatementRepeat1 => "if_statement_repeat1",
Bash::CaseStatementRepeat1 => "case_statement_repeat1",
Bash::CaseItemRepeat1 => "case_item_repeat1",
Bash::CompoundStatementRepeat1 => "compound_statement_repeat1",
Bash::PipelineRepeat1 => "pipeline_repeat1",
Bash::DeclarationCommandRepeat1 => "declaration_command_repeat1",
Bash::UnsetCommandRepeat1 => "unset_command_repeat1",
Bash::CommandRepeat1 => "command_repeat1",
Bash::CommandRepeat2 => "command_repeat2",
Bash::VariableAssignmentsRepeat1 => "variable_assignments_repeat1",
Bash::HeredocBodyRepeat1 => "heredoc_body_repeat1",
Bash::LiteralRepeat1 => "_literal_repeat1",
Bash::ArithmeticExpansionRepeat1 => "arithmetic_expansion_repeat1",
Bash::ConcatenationRepeat1 => "concatenation_repeat1",
Bash::StringRepeat1 => "string_repeat1",
Bash::ExpansionBodyRepeat1 => "_expansion_body_repeat1",
Bash::ExpansionRegexRepeat1 => "_expansion_regex_repeat1",
Bash::ConcatenationInExpansionRepeat1 => "_concatenation_in_expansion_repeat1",
Bash::Error => "ERROR",
}
}
}
impl From<u16> for Bash {
#[inline]
fn from(x: u16) -> Self {
num::FromPrimitive::from_u16(x).unwrap_or(Self::Error)
}
}
impl PartialEq<u16> for Bash {
#[inline]
fn eq(&self, x: &u16) -> bool {
*self == Into::<Self>::into(*x)
}
}
impl PartialEq<Bash> for u16 {
#[inline]
fn eq(&self, x: &Bash) -> bool {
*x == *self
}
}