rust-code-analysis 0.0.24

Tool to compute and export code metrics
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
// Code generated; DO NOT EDIT.

#[derive(Clone, Debug, PartialEq, FromPrimitive)]
pub enum Python {
    End = 0,
    Identifier = 1,
    Import = 2,
    DOT = 3,
    From = 4,
    Future = 5,
    LPAREN = 6,
    RPAREN = 7,
    COMMA = 8,
    As = 9,
    STAR = 10,
    Print = 11,
    GTGT = 12,
    Assert = 13,
    COLONEQ = 14,
    Return = 15,
    Del = 16,
    Raise = 17,
    Pass = 18,
    Break = 19,
    Continue = 20,
    If = 21,
    COLON = 22,
    Elif = 23,
    Else = 24,
    Async = 25,
    For = 26,
    In = 27,
    While = 28,
    Try = 29,
    Except = 30,
    Finally = 31,
    With = 32,
    Def = 33,
    DASHGT = 34,
    STARSTAR = 35,
    Global = 36,
    Nonlocal = 37,
    Exec = 38,
    Class = 39,
    AT = 40,
    LBRACK = 41,
    RBRACK = 42,
    EQ = 43,
    Not = 44,
    And = 45,
    Or = 46,
    PLUS = 47,
    DASH = 48,
    SLASH = 49,
    PERCENT = 50,
    SLASHSLASH = 51,
    PIPE = 52,
    AMP = 53,
    CARET = 54,
    LTLT = 55,
    TILDE = 56,
    LT = 57,
    LTEQ = 58,
    EQEQ = 59,
    BANGEQ = 60,
    GTEQ = 61,
    GT = 62,
    LTGT = 63,
    Is = 64,
    Lambda3 = 65,
    PLUSEQ = 66,
    DASHEQ = 67,
    STAREQ = 68,
    SLASHEQ = 69,
    ATEQ = 70,
    SLASHSLASHEQ = 71,
    PERCENTEQ = 72,
    STARSTAREQ = 73,
    GTGTEQ = 74,
    LTLTEQ = 75,
    AMPEQ = 76,
    CARETEQ = 77,
    PIPEEQ = 78,
    Yield2 = 79,
    Ellipsis = 80,
    LBRACE = 81,
    RBRACE = 82,
    EscapeSequence = 83,
    NotEscapeSequence = 84,
    FormatSpecifierToken1 = 85,
    TypeConversion = 86,
    Integer = 87,
    Float = 88,
    Await2 = 89,
    True = 90,
    False = 91,
    None = 92,
    Comment = 93,
    Semicolon = 94,
    Newline = 95,
    Indent = 96,
    Dedent = 97,
    DQUOTE = 98,
    StringContent = 99,
    DQUOTE2 = 100,
    Module = 101,
    Statement = 102,
    SimpleStatements = 103,
    ImportStatement = 104,
    ImportPrefix = 105,
    RelativeImport = 106,
    FutureImportStatement = 107,
    ImportFromStatement = 108,
    ImportList = 109,
    AliasedImport = 110,
    WildcardImport = 111,
    PrintStatement = 112,
    Chevron = 113,
    AssertStatement = 114,
    ExpressionStatement = 115,
    NamedExpression = 116,
    ReturnStatement = 117,
    DeleteStatement = 118,
    RaiseStatement = 119,
    PassStatement = 120,
    BreakStatement = 121,
    ContinueStatement = 122,
    IfStatement = 123,
    ElifClause = 124,
    ElseClause = 125,
    ForStatement = 126,
    WhileStatement = 127,
    TryStatement = 128,
    ExceptClause = 129,
    FinallyClause = 130,
    WithStatement = 131,
    WithClause = 132,
    WithItem = 133,
    FunctionDefinition = 134,
    Parameters = 135,
    LambdaParameters = 136,
    ListSplat = 137,
    DictionarySplat = 138,
    GlobalStatement = 139,
    NonlocalStatement = 140,
    ExecStatement = 141,
    ClassDefinition = 142,
    ParenthesizedListSplat = 143,
    ArgumentList = 144,
    DecoratedDefinition = 145,
    Decorator = 146,
    Block = 147,
    ExpressionList = 148,
    DottedName = 149,
    Parameters2 = 150,
    Patterns = 151,
    Parameter = 152,
    Pattern = 153,
    TuplePattern = 154,
    ListPattern = 155,
    DefaultParameter = 156,
    TypedDefaultParameter = 157,
    ListSplatPattern = 158,
    DictionarySplatPattern = 159,
    ExpressionWithinForInClause = 160,
    Expression = 161,
    PrimaryExpression = 162,
    NotOperator = 163,
    BooleanOperator = 164,
    BinaryOperator = 165,
    UnaryOperator = 166,
    ComparisonOperator = 167,
    Lambda = 168,
    Lambda2 = 169,
    Assignment = 170,
    AugmentedAssignment = 171,
    PatternList = 172,
    RightHandSide = 173,
    Yield = 174,
    Attribute = 175,
    Subscript = 176,
    Slice = 177,
    Call = 178,
    TypedParameter = 179,
    Type = 180,
    KeywordArgument = 181,
    List = 182,
    Set = 183,
    Tuple = 184,
    Dictionary = 185,
    Pair = 186,
    ListComprehension = 187,
    DictionaryComprehension = 188,
    SetComprehension = 189,
    GeneratorExpression = 190,
    ComprehensionClauses = 191,
    ParenthesizedExpression = 192,
    CollectionElements = 193,
    ForInClause = 194,
    IfClause = 195,
    ConditionalExpression = 196,
    ConcatenatedString = 197,
    String = 198,
    Interpolation = 199,
    FormatSpecifier = 200,
    FormatExpression = 201,
    Await = 202,
    ModuleRepeat1 = 203,
    SimpleStatementsRepeat1 = 204,
    ImportPrefixRepeat1 = 205,
    ImportListRepeat1 = 206,
    PrintStatementRepeat1 = 207,
    AssertStatementRepeat1 = 208,
    IfStatementRepeat1 = 209,
    TryStatementRepeat1 = 210,
    WithClauseRepeat1 = 211,
    GlobalStatementRepeat1 = 212,
    ArgumentListRepeat1 = 213,
    DecoratedDefinitionRepeat1 = 214,
    DottedNameRepeat1 = 215,
    ParametersRepeat1 = 216,
    PatternsRepeat1 = 217,
    ComparisonOperatorRepeat1 = 218,
    SubscriptRepeat1 = 219,
    DictionaryRepeat1 = 220,
    ComprehensionClausesRepeat1 = 221,
    CollectionElementsRepeat1 = 222,
    ForInClauseRepeat1 = 223,
    ConcatenatedStringRepeat1 = 224,
    StringRepeat1 = 225,
    FormatSpecifierRepeat1 = 226,
    Error = 227,
}

impl From<Python> for &'static str {
    #[inline(always)]
    fn from(tok: Python) -> Self {
        match tok {
            Python::End => "end",
            Python::Identifier => "identifier",
            Python::Import => "import",
            Python::DOT => ".",
            Python::From => "from",
            Python::Future => "__future__",
            Python::LPAREN => "(",
            Python::RPAREN => ")",
            Python::COMMA => ",",
            Python::As => "as",
            Python::STAR => "*",
            Python::Print => "print",
            Python::GTGT => ">>",
            Python::Assert => "assert",
            Python::COLONEQ => ":=",
            Python::Return => "return",
            Python::Del => "del",
            Python::Raise => "raise",
            Python::Pass => "pass",
            Python::Break => "break",
            Python::Continue => "continue",
            Python::If => "if",
            Python::COLON => ":",
            Python::Elif => "elif",
            Python::Else => "else",
            Python::Async => "async",
            Python::For => "for",
            Python::In => "in",
            Python::While => "while",
            Python::Try => "try",
            Python::Except => "except",
            Python::Finally => "finally",
            Python::With => "with",
            Python::Def => "def",
            Python::DASHGT => "->",
            Python::STARSTAR => "**",
            Python::Global => "global",
            Python::Nonlocal => "nonlocal",
            Python::Exec => "exec",
            Python::Class => "class",
            Python::AT => "@",
            Python::LBRACK => "[",
            Python::RBRACK => "]",
            Python::EQ => "=",
            Python::Not => "not",
            Python::And => "and",
            Python::Or => "or",
            Python::PLUS => "+",
            Python::DASH => "-",
            Python::SLASH => "/",
            Python::PERCENT => "%",
            Python::SLASHSLASH => "//",
            Python::PIPE => "|",
            Python::AMP => "&",
            Python::CARET => "^",
            Python::LTLT => "<<",
            Python::TILDE => "~",
            Python::LT => "<",
            Python::LTEQ => "<=",
            Python::EQEQ => "==",
            Python::BANGEQ => "!=",
            Python::GTEQ => ">=",
            Python::GT => ">",
            Python::LTGT => "<>",
            Python::Is => "is",
            Python::Lambda3 => "lambda",
            Python::PLUSEQ => "+=",
            Python::DASHEQ => "-=",
            Python::STAREQ => "*=",
            Python::SLASHEQ => "/=",
            Python::ATEQ => "@=",
            Python::SLASHSLASHEQ => "//=",
            Python::PERCENTEQ => "%=",
            Python::STARSTAREQ => "**=",
            Python::GTGTEQ => ">>=",
            Python::LTLTEQ => "<<=",
            Python::AMPEQ => "&=",
            Python::CARETEQ => "^=",
            Python::PIPEEQ => "|=",
            Python::Yield2 => "yield",
            Python::Ellipsis => "ellipsis",
            Python::LBRACE => "{",
            Python::RBRACE => "}",
            Python::EscapeSequence => "escape_sequence",
            Python::NotEscapeSequence => "_not_escape_sequence",
            Python::FormatSpecifierToken1 => "format_specifier_token1",
            Python::TypeConversion => "type_conversion",
            Python::Integer => "integer",
            Python::Float => "float",
            Python::Await2 => "await",
            Python::True => "true",
            Python::False => "false",
            Python::None => "none",
            Python::Comment => "comment",
            Python::Semicolon => "_semicolon",
            Python::Newline => "_newline",
            Python::Indent => "_indent",
            Python::Dedent => "_dedent",
            Python::DQUOTE => "\"",
            Python::StringContent => "_string_content",
            Python::DQUOTE2 => "\"",
            Python::Module => "module",
            Python::Statement => "_statement",
            Python::SimpleStatements => "_simple_statements",
            Python::ImportStatement => "import_statement",
            Python::ImportPrefix => "import_prefix",
            Python::RelativeImport => "relative_import",
            Python::FutureImportStatement => "future_import_statement",
            Python::ImportFromStatement => "import_from_statement",
            Python::ImportList => "_import_list",
            Python::AliasedImport => "aliased_import",
            Python::WildcardImport => "wildcard_import",
            Python::PrintStatement => "print_statement",
            Python::Chevron => "chevron",
            Python::AssertStatement => "assert_statement",
            Python::ExpressionStatement => "expression_statement",
            Python::NamedExpression => "named_expression",
            Python::ReturnStatement => "return_statement",
            Python::DeleteStatement => "delete_statement",
            Python::RaiseStatement => "raise_statement",
            Python::PassStatement => "pass_statement",
            Python::BreakStatement => "break_statement",
            Python::ContinueStatement => "continue_statement",
            Python::IfStatement => "if_statement",
            Python::ElifClause => "elif_clause",
            Python::ElseClause => "else_clause",
            Python::ForStatement => "for_statement",
            Python::WhileStatement => "while_statement",
            Python::TryStatement => "try_statement",
            Python::ExceptClause => "except_clause",
            Python::FinallyClause => "finally_clause",
            Python::WithStatement => "with_statement",
            Python::WithClause => "with_clause",
            Python::WithItem => "with_item",
            Python::FunctionDefinition => "function_definition",
            Python::Parameters => "parameters",
            Python::LambdaParameters => "lambda_parameters",
            Python::ListSplat => "list_splat",
            Python::DictionarySplat => "dictionary_splat",
            Python::GlobalStatement => "global_statement",
            Python::NonlocalStatement => "nonlocal_statement",
            Python::ExecStatement => "exec_statement",
            Python::ClassDefinition => "class_definition",
            Python::ParenthesizedListSplat => "parenthesized_list_splat",
            Python::ArgumentList => "argument_list",
            Python::DecoratedDefinition => "decorated_definition",
            Python::Decorator => "decorator",
            Python::Block => "block",
            Python::ExpressionList => "expression_list",
            Python::DottedName => "dotted_name",
            Python::Parameters2 => "_parameters",
            Python::Patterns => "_patterns",
            Python::Parameter => "parameter",
            Python::Pattern => "pattern",
            Python::TuplePattern => "tuple_pattern",
            Python::ListPattern => "list_pattern",
            Python::DefaultParameter => "default_parameter",
            Python::TypedDefaultParameter => "typed_default_parameter",
            Python::ListSplatPattern => "list_splat_pattern",
            Python::DictionarySplatPattern => "dictionary_splat_pattern",
            Python::ExpressionWithinForInClause => "_expression_within_for_in_clause",
            Python::Expression => "expression",
            Python::PrimaryExpression => "primary_expression",
            Python::NotOperator => "not_operator",
            Python::BooleanOperator => "boolean_operator",
            Python::BinaryOperator => "binary_operator",
            Python::UnaryOperator => "unary_operator",
            Python::ComparisonOperator => "comparison_operator",
            Python::Lambda => "lambda",
            Python::Lambda2 => "lambda",
            Python::Assignment => "assignment",
            Python::AugmentedAssignment => "augmented_assignment",
            Python::PatternList => "pattern_list",
            Python::RightHandSide => "_right_hand_side",
            Python::Yield => "yield",
            Python::Attribute => "attribute",
            Python::Subscript => "subscript",
            Python::Slice => "slice",
            Python::Call => "call",
            Python::TypedParameter => "typed_parameter",
            Python::Type => "type",
            Python::KeywordArgument => "keyword_argument",
            Python::List => "list",
            Python::Set => "set",
            Python::Tuple => "tuple",
            Python::Dictionary => "dictionary",
            Python::Pair => "pair",
            Python::ListComprehension => "list_comprehension",
            Python::DictionaryComprehension => "dictionary_comprehension",
            Python::SetComprehension => "set_comprehension",
            Python::GeneratorExpression => "generator_expression",
            Python::ComprehensionClauses => "_comprehension_clauses",
            Python::ParenthesizedExpression => "parenthesized_expression",
            Python::CollectionElements => "_collection_elements",
            Python::ForInClause => "for_in_clause",
            Python::IfClause => "if_clause",
            Python::ConditionalExpression => "conditional_expression",
            Python::ConcatenatedString => "concatenated_string",
            Python::String => "string",
            Python::Interpolation => "interpolation",
            Python::FormatSpecifier => "format_specifier",
            Python::FormatExpression => "format_expression",
            Python::Await => "await",
            Python::ModuleRepeat1 => "module_repeat1",
            Python::SimpleStatementsRepeat1 => "_simple_statements_repeat1",
            Python::ImportPrefixRepeat1 => "import_prefix_repeat1",
            Python::ImportListRepeat1 => "_import_list_repeat1",
            Python::PrintStatementRepeat1 => "print_statement_repeat1",
            Python::AssertStatementRepeat1 => "assert_statement_repeat1",
            Python::IfStatementRepeat1 => "if_statement_repeat1",
            Python::TryStatementRepeat1 => "try_statement_repeat1",
            Python::WithClauseRepeat1 => "with_clause_repeat1",
            Python::GlobalStatementRepeat1 => "global_statement_repeat1",
            Python::ArgumentListRepeat1 => "argument_list_repeat1",
            Python::DecoratedDefinitionRepeat1 => "decorated_definition_repeat1",
            Python::DottedNameRepeat1 => "dotted_name_repeat1",
            Python::ParametersRepeat1 => "_parameters_repeat1",
            Python::PatternsRepeat1 => "_patterns_repeat1",
            Python::ComparisonOperatorRepeat1 => "comparison_operator_repeat1",
            Python::SubscriptRepeat1 => "subscript_repeat1",
            Python::DictionaryRepeat1 => "dictionary_repeat1",
            Python::ComprehensionClausesRepeat1 => "_comprehension_clauses_repeat1",
            Python::CollectionElementsRepeat1 => "_collection_elements_repeat1",
            Python::ForInClauseRepeat1 => "for_in_clause_repeat1",
            Python::ConcatenatedStringRepeat1 => "concatenated_string_repeat1",
            Python::StringRepeat1 => "string_repeat1",
            Python::FormatSpecifierRepeat1 => "format_specifier_repeat1",
            Python::Error => "ERROR",
        }
    }
}

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

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

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