#![allow(clippy::match_same_arms, clippy::too_many_lines)]
use num_derive::FromPrimitive;
#[derive(Clone, Debug, PartialEq, Eq, FromPrimitive)]
pub enum Tcl {
End = 0,
SimpleWord = 1,
LF = 2,
SEMI = 3,
Comment = 4,
Regexp2 = 5,
While2 = 6,
Expr2 = 7,
Foreach2 = 8,
Global2 = 9,
Namespace2 = 10,
Try2 = 11,
On = 12,
Error = 13,
Finally2 = 14,
Unpack = 15,
COLONCOLON = 16,
IdentImm = 17,
Ident = 18,
COLONCOLON2 = 19,
LPAREN = 20,
RPAREN = 21,
DOLLAR = 22,
LBRACE = 23,
VariableSubstitutionToken1 = 24,
RBRACE = 25,
Set2 = 26,
Proc = 27,
Number = 28,
Boolean = 29,
LPAREN2 = 30,
DASH = 31,
PLUS = 32,
TILDE = 33,
BANG = 34,
STARSTAR = 35,
SLASH = 36,
STAR = 37,
PERCENT = 38,
LTLT = 39,
GTGT = 40,
GT = 41,
LT = 42,
GTEQ = 43,
LTEQ = 44,
EQEQ = 45,
BANGEQ = 46,
Eq = 47,
Ne = 48,
In = 49,
Ni = 50,
AMP = 51,
CARET = 52,
PIPE = 53,
AMPAMP = 54,
PIPEPIPE = 55,
QMARK = 56,
COLON = 57,
Elseif2 = 58,
Else2 = 59,
If2 = 60,
Catch2 = 61,
DQUOTE = 62,
EscapedCharacter = 63,
QuotedWordContent = 64,
LBRACK = 65,
RBRACK = 66,
Concat = 67,
Immediate = 68,
SourceFile = 69,
Regexp = 70,
While = 71,
ExprCmd = 72,
Foreach = 73,
Global = 74,
Namespace = 75,
Try = 76,
Finally = 77,
Command2 = 78,
Command = 79,
WordList = 80,
WordSimple = 81,
ConcatWord = 82,
NsDelim = 83,
Id = 84,
Id2 = 85,
ArrayIndex = 86,
VariableSubstitution = 87,
BracedWord = 88,
BracedWordSimple = 89,
Set = 90,
Procedure = 91,
ArgumentWord = 92,
Argument = 93,
Arguments = 94,
ExprAtomNoBrace = 95,
Expr3 = 96,
Expr = 97,
UnaryExpr = 98,
BinopExpr = 99,
TernaryExpr = 100,
Elseif = 101,
Else = 102,
If = 103,
Conditional = 104,
Catch = 105,
QuotedWord = 106,
CommandSubstitution = 107,
SourceFileRepeat1 = 108,
RegexpRepeat1 = 109,
WordListRepeat1 = 110,
WordSimpleRepeat1 = 111,
ConcatWordRepeat1 = 112,
IdImmediateRepeat1 = 113,
BracedWordRepeat1 = 114,
BracedWordRepeat2 = 115,
BracedWordSimpleRepeat1 = 116,
ArgumentsRepeat1 = 117,
IfRepeat1 = 118,
QuotedWordRepeat1 = 119,
Error2 = 120,
}
impl From<Tcl> for &'static str {
#[inline]
fn from(tok: Tcl) -> Self {
match tok {
Tcl::End => "end",
Tcl::SimpleWord => "simple_word",
Tcl::LF => "\n",
Tcl::SEMI => ";",
Tcl::Comment => "comment",
Tcl::Regexp2 => "regexp",
Tcl::While2 => "while",
Tcl::Expr2 => "expr",
Tcl::Foreach2 => "foreach",
Tcl::Global2 => "global",
Tcl::Namespace2 => "namespace",
Tcl::Try2 => "try",
Tcl::On => "on",
Tcl::Error => "error",
Tcl::Finally2 => "finally",
Tcl::Unpack => "unpack",
Tcl::COLONCOLON => "::",
Tcl::IdentImm => "_ident_imm",
Tcl::Ident => "_ident",
Tcl::COLONCOLON2 => "::",
Tcl::LPAREN => "(",
Tcl::RPAREN => ")",
Tcl::DOLLAR => "$",
Tcl::LBRACE => "{",
Tcl::VariableSubstitutionToken1 => "variable_substitution_token1",
Tcl::RBRACE => "}",
Tcl::Set2 => "set",
Tcl::Proc => "proc",
Tcl::Number => "number",
Tcl::Boolean => "_boolean",
Tcl::LPAREN2 => "(",
Tcl::DASH => "-",
Tcl::PLUS => "+",
Tcl::TILDE => "~",
Tcl::BANG => "!",
Tcl::STARSTAR => "**",
Tcl::SLASH => "/",
Tcl::STAR => "*",
Tcl::PERCENT => "%",
Tcl::LTLT => "<<",
Tcl::GTGT => ">>",
Tcl::GT => ">",
Tcl::LT => "<",
Tcl::GTEQ => ">=",
Tcl::LTEQ => "<=",
Tcl::EQEQ => "==",
Tcl::BANGEQ => "!=",
Tcl::Eq => "eq",
Tcl::Ne => "ne",
Tcl::In => "in",
Tcl::Ni => "ni",
Tcl::AMP => "&",
Tcl::CARET => "^",
Tcl::PIPE => "|",
Tcl::AMPAMP => "&&",
Tcl::PIPEPIPE => "||",
Tcl::QMARK => "?",
Tcl::COLON => ":",
Tcl::Elseif2 => "elseif",
Tcl::Else2 => "else",
Tcl::If2 => "if",
Tcl::Catch2 => "catch",
Tcl::DQUOTE => "\"",
Tcl::EscapedCharacter => "escaped_character",
Tcl::QuotedWordContent => "_quoted_word_content",
Tcl::LBRACK => "[",
Tcl::RBRACK => "]",
Tcl::Concat => "_concat",
Tcl::Immediate => "_immediate",
Tcl::SourceFile => "source_file",
Tcl::Regexp => "regexp",
Tcl::While => "while",
Tcl::ExprCmd => "expr_cmd",
Tcl::Foreach => "foreach",
Tcl::Global => "global",
Tcl::Namespace => "namespace",
Tcl::Try => "try",
Tcl::Finally => "finally",
Tcl::Command2 => "_command",
Tcl::Command => "command",
Tcl::WordList => "word_list",
Tcl::WordSimple => "_word_simple",
Tcl::ConcatWord => "_concat_word",
Tcl::NsDelim => "_ns_delim",
Tcl::Id => "id",
Tcl::Id2 => "id",
Tcl::ArrayIndex => "array_index",
Tcl::VariableSubstitution => "variable_substitution",
Tcl::BracedWord => "braced_word",
Tcl::BracedWordSimple => "braced_word_simple",
Tcl::Set => "set",
Tcl::Procedure => "procedure",
Tcl::ArgumentWord => "_argument_word",
Tcl::Argument => "argument",
Tcl::Arguments => "arguments",
Tcl::ExprAtomNoBrace => "_expr_atom_no_brace",
Tcl::Expr3 => "_expr",
Tcl::Expr => "expr",
Tcl::UnaryExpr => "unary_expr",
Tcl::BinopExpr => "binop_expr",
Tcl::TernaryExpr => "ternary_expr",
Tcl::Elseif => "elseif",
Tcl::Else => "else",
Tcl::If => "if",
Tcl::Conditional => "_conditional",
Tcl::Catch => "catch",
Tcl::QuotedWord => "quoted_word",
Tcl::CommandSubstitution => "command_substitution",
Tcl::SourceFileRepeat1 => "source_file_repeat1",
Tcl::RegexpRepeat1 => "regexp_repeat1",
Tcl::WordListRepeat1 => "word_list_repeat1",
Tcl::WordSimpleRepeat1 => "_word_simple_repeat1",
Tcl::ConcatWordRepeat1 => "_concat_word_repeat1",
Tcl::IdImmediateRepeat1 => "_id_immediate_repeat1",
Tcl::BracedWordRepeat1 => "braced_word_repeat1",
Tcl::BracedWordRepeat2 => "braced_word_repeat2",
Tcl::BracedWordSimpleRepeat1 => "braced_word_simple_repeat1",
Tcl::ArgumentsRepeat1 => "arguments_repeat1",
Tcl::IfRepeat1 => "if_repeat1",
Tcl::QuotedWordRepeat1 => "quoted_word_repeat1",
Tcl::Error2 => "ERROR",
}
}
}
impl From<u16> for Tcl {
#[inline]
fn from(x: u16) -> Self {
num::FromPrimitive::from_u16(x).unwrap_or(Self::Error)
}
}
impl PartialEq<u16> for Tcl {
#[inline]
fn eq(&self, x: &u16) -> bool {
*self == Into::<Self>::into(*x)
}
}
impl PartialEq<Tcl> for u16 {
#[inline]
fn eq(&self, x: &Tcl) -> bool {
*x == *self
}
}