Skip to main content

big_code_analysis_ast/languages/
language_tcl.rs

1// See `src/languages/mod.rs` for the rationale behind the per-file
2// pedantic carve-outs below.
3#![allow(clippy::match_same_arms, clippy::too_many_lines)]
4// One variant per grammar kind id, named after the rule; the name is
5// the documentation and there is nothing per-variant to add.
6#![allow(missing_docs)]
7
8// Code generated; DO NOT EDIT.
9
10use num_derive::FromPrimitive;
11
12#[derive(Clone, Debug, PartialEq, Eq, FromPrimitive)]
13pub enum Tcl {
14    End = 0,
15    SimpleWord = 1,
16    LF = 2,
17    SEMI = 3,
18    Comment = 4,
19    Regexp2 = 5,
20    While2 = 6,
21    Expr2 = 7,
22    Foreach2 = 8,
23    Global2 = 9,
24    Namespace2 = 10,
25    Try2 = 11,
26    On = 12,
27    Error = 13,
28    Finally2 = 14,
29    Unpack = 15,
30    COLONCOLON = 16,
31    IdentImm = 17,
32    Ident = 18,
33    COLONCOLON2 = 19,
34    LPAREN = 20,
35    RPAREN = 21,
36    DOLLAR = 22,
37    LBRACE = 23,
38    VariableSubstitutionToken1 = 24,
39    RBRACE = 25,
40    Set2 = 26,
41    Proc = 27,
42    Number = 28,
43    Boolean = 29,
44    LPAREN2 = 30,
45    DASH = 31,
46    PLUS = 32,
47    TILDE = 33,
48    BANG = 34,
49    STARSTAR = 35,
50    SLASH = 36,
51    STAR = 37,
52    PERCENT = 38,
53    LTLT = 39,
54    GTGT = 40,
55    GT = 41,
56    LT = 42,
57    GTEQ = 43,
58    LTEQ = 44,
59    EQEQ = 45,
60    BANGEQ = 46,
61    Eq = 47,
62    Ne = 48,
63    In = 49,
64    Ni = 50,
65    AMP = 51,
66    CARET = 52,
67    PIPE = 53,
68    AMPAMP = 54,
69    PIPEPIPE = 55,
70    QMARK = 56,
71    COLON = 57,
72    Elseif2 = 58,
73    Else2 = 59,
74    If2 = 60,
75    Catch2 = 61,
76    DQUOTE = 62,
77    EscapedCharacter = 63,
78    QuotedWordContent = 64,
79    LBRACK = 65,
80    RBRACK = 66,
81    Concat = 67,
82    Immediate = 68,
83    SourceFile = 69,
84    Regexp = 70,
85    While = 71,
86    ExprCmd = 72,
87    Foreach = 73,
88    Global = 74,
89    Namespace = 75,
90    Try = 76,
91    Finally = 77,
92    Command2 = 78,
93    Command = 79,
94    WordList = 80,
95    WordSimple = 81,
96    ConcatWord = 82,
97    NsDelim = 83,
98    Id = 84,
99    Id2 = 85,
100    ArrayIndex = 86,
101    VariableSubstitution = 87,
102    BracedWord = 88,
103    BracedWordSimple = 89,
104    Set = 90,
105    Procedure = 91,
106    ArgumentWord = 92,
107    Argument = 93,
108    Arguments = 94,
109    ExprAtomNoBrace = 95,
110    Expr3 = 96,
111    Expr = 97,
112    UnaryExpr = 98,
113    BinopExpr = 99,
114    TernaryExpr = 100,
115    Elseif = 101,
116    Else = 102,
117    If = 103,
118    Conditional = 104,
119    Catch = 105,
120    QuotedWord = 106,
121    CommandSubstitution = 107,
122    SourceFileRepeat1 = 108,
123    RegexpRepeat1 = 109,
124    WordListRepeat1 = 110,
125    WordSimpleRepeat1 = 111,
126    ConcatWordRepeat1 = 112,
127    IdImmediateRepeat1 = 113,
128    BracedWordRepeat1 = 114,
129    BracedWordRepeat2 = 115,
130    BracedWordSimpleRepeat1 = 116,
131    ArgumentsRepeat1 = 117,
132    IfRepeat1 = 118,
133    QuotedWordRepeat1 = 119,
134    Error2 = 120,
135}
136
137impl From<Tcl> for &'static str {
138    #[inline]
139    fn from(tok: Tcl) -> Self {
140        match tok {
141            Tcl::End => "end",
142            Tcl::SimpleWord => "simple_word",
143            Tcl::LF => "\n",
144            Tcl::SEMI => ";",
145            Tcl::Comment => "comment",
146            Tcl::Regexp2 => "regexp",
147            Tcl::While2 => "while",
148            Tcl::Expr2 => "expr",
149            Tcl::Foreach2 => "foreach",
150            Tcl::Global2 => "global",
151            Tcl::Namespace2 => "namespace",
152            Tcl::Try2 => "try",
153            Tcl::On => "on",
154            Tcl::Error => "error",
155            Tcl::Finally2 => "finally",
156            Tcl::Unpack => "unpack",
157            Tcl::COLONCOLON => "::",
158            Tcl::IdentImm => "_ident_imm",
159            Tcl::Ident => "_ident",
160            Tcl::COLONCOLON2 => "::",
161            Tcl::LPAREN => "(",
162            Tcl::RPAREN => ")",
163            Tcl::DOLLAR => "$",
164            Tcl::LBRACE => "{",
165            Tcl::VariableSubstitutionToken1 => "variable_substitution_token1",
166            Tcl::RBRACE => "}",
167            Tcl::Set2 => "set",
168            Tcl::Proc => "proc",
169            Tcl::Number => "number",
170            Tcl::Boolean => "_boolean",
171            Tcl::LPAREN2 => "(",
172            Tcl::DASH => "-",
173            Tcl::PLUS => "+",
174            Tcl::TILDE => "~",
175            Tcl::BANG => "!",
176            Tcl::STARSTAR => "**",
177            Tcl::SLASH => "/",
178            Tcl::STAR => "*",
179            Tcl::PERCENT => "%",
180            Tcl::LTLT => "<<",
181            Tcl::GTGT => ">>",
182            Tcl::GT => ">",
183            Tcl::LT => "<",
184            Tcl::GTEQ => ">=",
185            Tcl::LTEQ => "<=",
186            Tcl::EQEQ => "==",
187            Tcl::BANGEQ => "!=",
188            Tcl::Eq => "eq",
189            Tcl::Ne => "ne",
190            Tcl::In => "in",
191            Tcl::Ni => "ni",
192            Tcl::AMP => "&",
193            Tcl::CARET => "^",
194            Tcl::PIPE => "|",
195            Tcl::AMPAMP => "&&",
196            Tcl::PIPEPIPE => "||",
197            Tcl::QMARK => "?",
198            Tcl::COLON => ":",
199            Tcl::Elseif2 => "elseif",
200            Tcl::Else2 => "else",
201            Tcl::If2 => "if",
202            Tcl::Catch2 => "catch",
203            Tcl::DQUOTE => "\"",
204            Tcl::EscapedCharacter => "escaped_character",
205            Tcl::QuotedWordContent => "_quoted_word_content",
206            Tcl::LBRACK => "[",
207            Tcl::RBRACK => "]",
208            Tcl::Concat => "_concat",
209            Tcl::Immediate => "_immediate",
210            Tcl::SourceFile => "source_file",
211            Tcl::Regexp => "regexp",
212            Tcl::While => "while",
213            Tcl::ExprCmd => "expr_cmd",
214            Tcl::Foreach => "foreach",
215            Tcl::Global => "global",
216            Tcl::Namespace => "namespace",
217            Tcl::Try => "try",
218            Tcl::Finally => "finally",
219            Tcl::Command2 => "_command",
220            Tcl::Command => "command",
221            Tcl::WordList => "word_list",
222            Tcl::WordSimple => "_word_simple",
223            Tcl::ConcatWord => "_concat_word",
224            Tcl::NsDelim => "_ns_delim",
225            Tcl::Id => "id",
226            Tcl::Id2 => "id",
227            Tcl::ArrayIndex => "array_index",
228            Tcl::VariableSubstitution => "variable_substitution",
229            Tcl::BracedWord => "braced_word",
230            Tcl::BracedWordSimple => "braced_word_simple",
231            Tcl::Set => "set",
232            Tcl::Procedure => "procedure",
233            Tcl::ArgumentWord => "_argument_word",
234            Tcl::Argument => "argument",
235            Tcl::Arguments => "arguments",
236            Tcl::ExprAtomNoBrace => "_expr_atom_no_brace",
237            Tcl::Expr3 => "_expr",
238            Tcl::Expr => "expr",
239            Tcl::UnaryExpr => "unary_expr",
240            Tcl::BinopExpr => "binop_expr",
241            Tcl::TernaryExpr => "ternary_expr",
242            Tcl::Elseif => "elseif",
243            Tcl::Else => "else",
244            Tcl::If => "if",
245            Tcl::Conditional => "_conditional",
246            Tcl::Catch => "catch",
247            Tcl::QuotedWord => "quoted_word",
248            Tcl::CommandSubstitution => "command_substitution",
249            Tcl::SourceFileRepeat1 => "source_file_repeat1",
250            Tcl::RegexpRepeat1 => "regexp_repeat1",
251            Tcl::WordListRepeat1 => "word_list_repeat1",
252            Tcl::WordSimpleRepeat1 => "_word_simple_repeat1",
253            Tcl::ConcatWordRepeat1 => "_concat_word_repeat1",
254            Tcl::IdImmediateRepeat1 => "_id_immediate_repeat1",
255            Tcl::BracedWordRepeat1 => "braced_word_repeat1",
256            Tcl::BracedWordRepeat2 => "braced_word_repeat2",
257            Tcl::BracedWordSimpleRepeat1 => "braced_word_simple_repeat1",
258            Tcl::ArgumentsRepeat1 => "arguments_repeat1",
259            Tcl::IfRepeat1 => "if_repeat1",
260            Tcl::QuotedWordRepeat1 => "quoted_word_repeat1",
261            Tcl::Error2 => "ERROR",
262        }
263    }
264}
265
266impl From<u16> for Tcl {
267    #[inline]
268    fn from(x: u16) -> Self {
269        num_traits::FromPrimitive::from_u16(x).unwrap_or(Self::Error2)
270    }
271}
272
273// Tcl == u16
274impl PartialEq<u16> for Tcl {
275    #[inline]
276    fn eq(&self, x: &u16) -> bool {
277        *self == Into::<Self>::into(*x)
278    }
279}
280
281// u16 == Tcl
282impl PartialEq<Tcl> for u16 {
283    #[inline]
284    fn eq(&self, x: &Tcl) -> bool {
285        *x == *self
286    }
287}