#![allow(clippy::match_same_arms, clippy::too_many_lines)]
use num_derive::FromPrimitive;
#[derive(Clone, Debug, PartialEq, Eq, FromPrimitive)]
pub enum Go {
End = 0,
Identifier = 1,
SourceFileToken1 = 2,
SEMI = 3,
Anon4 = 4,
Package = 5,
Import = 6,
DOT = 7,
BlankIdentifier = 8,
LPAREN = 9,
RPAREN = 10,
Const = 11,
COMMA = 12,
EQ = 13,
Var = 14,
Func = 15,
LBRACK = 16,
RBRACK = 17,
DOTDOTDOT = 18,
Type = 19,
STAR = 20,
Struct = 21,
TILDE = 22,
LBRACE = 23,
RBRACE = 24,
Interface = 25,
PIPE = 26,
Map = 27,
Chan = 28,
LTDASH = 29,
COLONEQ = 30,
PLUSPLUS = 31,
DASHDASH = 32,
STAREQ = 33,
SLASHEQ = 34,
PERCENTEQ = 35,
LTLTEQ = 36,
GTGTEQ = 37,
AMPEQ = 38,
AMPCARETEQ = 39,
PLUSEQ = 40,
DASHEQ = 41,
PIPEEQ = 42,
CARETEQ = 43,
COLON = 44,
Fallthrough = 45,
Break = 46,
Continue = 47,
Goto = 48,
Return = 49,
Go = 50,
Defer = 51,
If = 52,
Else = 53,
For = 54,
Range = 55,
Switch = 56,
Case = 57,
Default = 58,
Select = 59,
Identifier2 = 60,
Identifier3 = 61,
PLUS = 62,
DASH = 63,
BANG = 64,
CARET = 65,
AMP = 66,
SLASH = 67,
PERCENT = 68,
LTLT = 69,
GTGT = 70,
AMPCARET = 71,
EQEQ = 72,
BANGEQ = 73,
LT = 74,
LTEQ = 75,
GT = 76,
GTEQ = 77,
AMPAMP = 78,
PIPEPIPE = 79,
BQUOTE = 80,
RawStringLiteralContent = 81,
DQUOTE = 82,
InterpretedStringLiteralContent = 83,
DQUOTE2 = 84,
EscapeSequence = 85,
IntLiteral = 86,
FloatLiteral = 87,
ImaginaryLiteral = 88,
RuneLiteral = 89,
Nil = 90,
True = 91,
False = 92,
Iota = 93,
Comment = 94,
SourceFile = 95,
PackageClause = 96,
ImportDeclaration = 97,
ImportSpec = 98,
Dot = 99,
ImportSpecList = 100,
Declaration = 101,
ConstDeclaration = 102,
ConstSpec = 103,
VarDeclaration = 104,
VarSpec = 105,
VarSpecList = 106,
FunctionDeclaration = 107,
MethodDeclaration = 108,
TypeParameterList = 109,
TypeParameterDeclaration = 110,
ParameterList = 111,
ParameterDeclaration = 112,
VariadicParameterDeclaration = 113,
TypeAlias = 114,
TypeDeclaration = 115,
TypeSpec = 116,
ExpressionList = 117,
ParenthesizedType = 118,
SimpleType = 119,
GenericType = 120,
TypeArguments = 121,
PointerType = 122,
ArrayType = 123,
ImplicitLengthArrayType = 124,
SliceType = 125,
StructType = 126,
NegatedType = 127,
FieldDeclarationList = 128,
FieldDeclaration = 129,
InterfaceType = 130,
MethodElem = 131,
TypeElem = 132,
MapType = 133,
ChannelType = 134,
FunctionType = 135,
Block = 136,
StatementList = 137,
Statement = 138,
EmptyStatement = 139,
SimpleStatement = 140,
ExpressionStatement = 141,
SendStatement = 142,
ReceiveStatement = 143,
IncStatement = 144,
DecStatement = 145,
AssignmentStatement = 146,
ShortVarDeclaration = 147,
LabeledStatement = 148,
LabeledStatement2 = 149,
FallthroughStatement = 150,
BreakStatement = 151,
ContinueStatement = 152,
GotoStatement = 153,
ReturnStatement = 154,
GoStatement = 155,
DeferStatement = 156,
IfStatement = 157,
ForStatement = 158,
ForClause = 159,
RangeClause = 160,
ExpressionSwitchStatement = 161,
ExpressionCase = 162,
DefaultCase = 163,
TypeSwitchStatement = 164,
TypeSwitchHeader = 165,
TypeCase = 166,
SelectStatement = 167,
CommunicationCase = 168,
Expression = 169,
ParenthesizedExpression = 170,
CallExpression = 171,
VariadicArgument = 172,
ArgumentList = 173,
ArgumentList2 = 174,
SelectorExpression = 175,
IndexExpression = 176,
SliceExpression = 177,
TypeAssertionExpression = 178,
TypeConversionExpression = 179,
TypeInstantiationExpression = 180,
CompositeLiteral = 181,
LiteralValue = 182,
LiteralElement = 183,
KeyedElement = 184,
FuncLiteral = 185,
UnaryExpression = 186,
BinaryExpression = 187,
QualifiedType = 188,
RawStringLiteral = 189,
InterpretedStringLiteral = 190,
SourceFileRepeat1 = 191,
ImportSpecListRepeat1 = 192,
ConstDeclarationRepeat1 = 193,
ConstSpecRepeat1 = 194,
VarSpecRepeat1 = 195,
VarSpecListRepeat1 = 196,
TypeParameterListRepeat1 = 197,
ParameterListRepeat1 = 198,
TypeDeclarationRepeat1 = 199,
ExpressionListRepeat1 = 200,
TypeArgumentsRepeat1 = 201,
FieldDeclarationListRepeat1 = 202,
FieldDeclarationRepeat1 = 203,
InterfaceTypeRepeat1 = 204,
TypeElemRepeat1 = 205,
StatementListRepeat1 = 206,
ExpressionSwitchStatementRepeat1 = 207,
TypeSwitchStatementRepeat1 = 208,
TypeCaseRepeat1 = 209,
SelectStatementRepeat1 = 210,
ArgumentListRepeat1 = 211,
LiteralValueRepeat1 = 212,
InterpretedStringLiteralRepeat1 = 213,
FieldIdentifier = 214,
LabelName = 215,
PackageIdentifier = 216,
TypeConstraint = 217,
TypeIdentifier = 218,
Error = 219,
}
impl From<Go> for &'static str {
#[inline]
fn from(tok: Go) -> Self {
match tok {
Go::End => "end",
Go::Identifier => "identifier",
Go::SourceFileToken1 => "source_file_token1",
Go::SEMI => ";",
Go::Anon4 => "",
Go::Package => "package",
Go::Import => "import",
Go::DOT => ".",
Go::BlankIdentifier => "blank_identifier",
Go::LPAREN => "(",
Go::RPAREN => ")",
Go::Const => "const",
Go::COMMA => ",",
Go::EQ => "=",
Go::Var => "var",
Go::Func => "func",
Go::LBRACK => "[",
Go::RBRACK => "]",
Go::DOTDOTDOT => "...",
Go::Type => "type",
Go::STAR => "*",
Go::Struct => "struct",
Go::TILDE => "~",
Go::LBRACE => "{",
Go::RBRACE => "}",
Go::Interface => "interface",
Go::PIPE => "|",
Go::Map => "map",
Go::Chan => "chan",
Go::LTDASH => "<-",
Go::COLONEQ => ":=",
Go::PLUSPLUS => "++",
Go::DASHDASH => "--",
Go::STAREQ => "*=",
Go::SLASHEQ => "/=",
Go::PERCENTEQ => "%=",
Go::LTLTEQ => "<<=",
Go::GTGTEQ => ">>=",
Go::AMPEQ => "&=",
Go::AMPCARETEQ => "&^=",
Go::PLUSEQ => "+=",
Go::DASHEQ => "-=",
Go::PIPEEQ => "|=",
Go::CARETEQ => "^=",
Go::COLON => ":",
Go::Fallthrough => "fallthrough",
Go::Break => "break",
Go::Continue => "continue",
Go::Goto => "goto",
Go::Return => "return",
Go::Go => "go",
Go::Defer => "defer",
Go::If => "if",
Go::Else => "else",
Go::For => "for",
Go::Range => "range",
Go::Switch => "switch",
Go::Case => "case",
Go::Default => "default",
Go::Select => "select",
Go::Identifier2 => "identifier",
Go::Identifier3 => "identifier",
Go::PLUS => "+",
Go::DASH => "-",
Go::BANG => "!",
Go::CARET => "^",
Go::AMP => "&",
Go::SLASH => "/",
Go::PERCENT => "%",
Go::LTLT => "<<",
Go::GTGT => ">>",
Go::AMPCARET => "&^",
Go::EQEQ => "==",
Go::BANGEQ => "!=",
Go::LT => "<",
Go::LTEQ => "<=",
Go::GT => ">",
Go::GTEQ => ">=",
Go::AMPAMP => "&&",
Go::PIPEPIPE => "||",
Go::BQUOTE => "`",
Go::RawStringLiteralContent => "raw_string_literal_content",
Go::DQUOTE => "\"",
Go::InterpretedStringLiteralContent => "interpreted_string_literal_content",
Go::DQUOTE2 => "\"",
Go::EscapeSequence => "escape_sequence",
Go::IntLiteral => "int_literal",
Go::FloatLiteral => "float_literal",
Go::ImaginaryLiteral => "imaginary_literal",
Go::RuneLiteral => "rune_literal",
Go::Nil => "nil",
Go::True => "true",
Go::False => "false",
Go::Iota => "iota",
Go::Comment => "comment",
Go::SourceFile => "source_file",
Go::PackageClause => "package_clause",
Go::ImportDeclaration => "import_declaration",
Go::ImportSpec => "import_spec",
Go::Dot => "dot",
Go::ImportSpecList => "import_spec_list",
Go::Declaration => "_declaration",
Go::ConstDeclaration => "const_declaration",
Go::ConstSpec => "const_spec",
Go::VarDeclaration => "var_declaration",
Go::VarSpec => "var_spec",
Go::VarSpecList => "var_spec_list",
Go::FunctionDeclaration => "function_declaration",
Go::MethodDeclaration => "method_declaration",
Go::TypeParameterList => "type_parameter_list",
Go::TypeParameterDeclaration => "type_parameter_declaration",
Go::ParameterList => "parameter_list",
Go::ParameterDeclaration => "parameter_declaration",
Go::VariadicParameterDeclaration => "variadic_parameter_declaration",
Go::TypeAlias => "type_alias",
Go::TypeDeclaration => "type_declaration",
Go::TypeSpec => "type_spec",
Go::ExpressionList => "expression_list",
Go::ParenthesizedType => "parenthesized_type",
Go::SimpleType => "_simple_type",
Go::GenericType => "generic_type",
Go::TypeArguments => "type_arguments",
Go::PointerType => "pointer_type",
Go::ArrayType => "array_type",
Go::ImplicitLengthArrayType => "implicit_length_array_type",
Go::SliceType => "slice_type",
Go::StructType => "struct_type",
Go::NegatedType => "negated_type",
Go::FieldDeclarationList => "field_declaration_list",
Go::FieldDeclaration => "field_declaration",
Go::InterfaceType => "interface_type",
Go::MethodElem => "method_elem",
Go::TypeElem => "type_elem",
Go::MapType => "map_type",
Go::ChannelType => "channel_type",
Go::FunctionType => "function_type",
Go::Block => "block",
Go::StatementList => "statement_list",
Go::Statement => "_statement",
Go::EmptyStatement => "empty_statement",
Go::SimpleStatement => "_simple_statement",
Go::ExpressionStatement => "expression_statement",
Go::SendStatement => "send_statement",
Go::ReceiveStatement => "receive_statement",
Go::IncStatement => "inc_statement",
Go::DecStatement => "dec_statement",
Go::AssignmentStatement => "assignment_statement",
Go::ShortVarDeclaration => "short_var_declaration",
Go::LabeledStatement => "labeled_statement",
Go::LabeledStatement2 => "labeled_statement",
Go::FallthroughStatement => "fallthrough_statement",
Go::BreakStatement => "break_statement",
Go::ContinueStatement => "continue_statement",
Go::GotoStatement => "goto_statement",
Go::ReturnStatement => "return_statement",
Go::GoStatement => "go_statement",
Go::DeferStatement => "defer_statement",
Go::IfStatement => "if_statement",
Go::ForStatement => "for_statement",
Go::ForClause => "for_clause",
Go::RangeClause => "range_clause",
Go::ExpressionSwitchStatement => "expression_switch_statement",
Go::ExpressionCase => "expression_case",
Go::DefaultCase => "default_case",
Go::TypeSwitchStatement => "type_switch_statement",
Go::TypeSwitchHeader => "_type_switch_header",
Go::TypeCase => "type_case",
Go::SelectStatement => "select_statement",
Go::CommunicationCase => "communication_case",
Go::Expression => "_expression",
Go::ParenthesizedExpression => "parenthesized_expression",
Go::CallExpression => "call_expression",
Go::VariadicArgument => "variadic_argument",
Go::ArgumentList => "argument_list",
Go::ArgumentList2 => "argument_list",
Go::SelectorExpression => "selector_expression",
Go::IndexExpression => "index_expression",
Go::SliceExpression => "slice_expression",
Go::TypeAssertionExpression => "type_assertion_expression",
Go::TypeConversionExpression => "type_conversion_expression",
Go::TypeInstantiationExpression => "type_instantiation_expression",
Go::CompositeLiteral => "composite_literal",
Go::LiteralValue => "literal_value",
Go::LiteralElement => "literal_element",
Go::KeyedElement => "keyed_element",
Go::FuncLiteral => "func_literal",
Go::UnaryExpression => "unary_expression",
Go::BinaryExpression => "binary_expression",
Go::QualifiedType => "qualified_type",
Go::RawStringLiteral => "raw_string_literal",
Go::InterpretedStringLiteral => "interpreted_string_literal",
Go::SourceFileRepeat1 => "source_file_repeat1",
Go::ImportSpecListRepeat1 => "import_spec_list_repeat1",
Go::ConstDeclarationRepeat1 => "const_declaration_repeat1",
Go::ConstSpecRepeat1 => "const_spec_repeat1",
Go::VarSpecRepeat1 => "var_spec_repeat1",
Go::VarSpecListRepeat1 => "var_spec_list_repeat1",
Go::TypeParameterListRepeat1 => "type_parameter_list_repeat1",
Go::ParameterListRepeat1 => "parameter_list_repeat1",
Go::TypeDeclarationRepeat1 => "type_declaration_repeat1",
Go::ExpressionListRepeat1 => "expression_list_repeat1",
Go::TypeArgumentsRepeat1 => "type_arguments_repeat1",
Go::FieldDeclarationListRepeat1 => "field_declaration_list_repeat1",
Go::FieldDeclarationRepeat1 => "field_declaration_repeat1",
Go::InterfaceTypeRepeat1 => "interface_type_repeat1",
Go::TypeElemRepeat1 => "type_elem_repeat1",
Go::StatementListRepeat1 => "statement_list_repeat1",
Go::ExpressionSwitchStatementRepeat1 => "expression_switch_statement_repeat1",
Go::TypeSwitchStatementRepeat1 => "type_switch_statement_repeat1",
Go::TypeCaseRepeat1 => "type_case_repeat1",
Go::SelectStatementRepeat1 => "select_statement_repeat1",
Go::ArgumentListRepeat1 => "argument_list_repeat1",
Go::LiteralValueRepeat1 => "literal_value_repeat1",
Go::InterpretedStringLiteralRepeat1 => "interpreted_string_literal_repeat1",
Go::FieldIdentifier => "field_identifier",
Go::LabelName => "label_name",
Go::PackageIdentifier => "package_identifier",
Go::TypeConstraint => "type_constraint",
Go::TypeIdentifier => "type_identifier",
Go::Error => "ERROR",
}
}
}
impl From<u16> for Go {
#[inline]
fn from(x: u16) -> Self {
num::FromPrimitive::from_u16(x).unwrap_or(Self::Error)
}
}
impl PartialEq<u16> for Go {
#[inline]
fn eq(&self, x: &u16) -> bool {
*self == Into::<Self>::into(*x)
}
}
impl PartialEq<Go> for u16 {
#[inline]
fn eq(&self, x: &Go) -> bool {
*x == *self
}
}