Skip to main content

big_code_analysis_ast/languages/
language_ccomment.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 Ccomment {
14    End = 0,
15    Nothing = 1,
16    PreprocContinuationLine = 2,
17    PreprocLine = 3,
18    DefineToken1 = 4,
19    StringLiteralToken1 = 5,
20    CharLiteralToken1 = 6,
21    Comment = 7,
22    RawStringLiteral = 8,
23    TranslationUnit = 9,
24    TopLevelItem = 10,
25    Define = 11,
26    StringLiteral = 12,
27    CharLiteral = 13,
28    TranslationUnitRepeat1 = 14,
29    DefineRepeat1 = 15,
30    Error = 16,
31}
32
33impl From<Ccomment> for &'static str {
34    #[inline]
35    fn from(tok: Ccomment) -> Self {
36        match tok {
37            Ccomment::End => "end",
38            Ccomment::Nothing => "nothing",
39            Ccomment::PreprocContinuationLine => "preproc_continuation_line",
40            Ccomment::PreprocLine => "preproc_line",
41            Ccomment::DefineToken1 => "define_token1",
42            Ccomment::StringLiteralToken1 => "string_literal_token1",
43            Ccomment::CharLiteralToken1 => "char_literal_token1",
44            Ccomment::Comment => "comment",
45            Ccomment::RawStringLiteral => "raw_string_literal",
46            Ccomment::TranslationUnit => "translation_unit",
47            Ccomment::TopLevelItem => "_top_level_item",
48            Ccomment::Define => "define",
49            Ccomment::StringLiteral => "string_literal",
50            Ccomment::CharLiteral => "char_literal",
51            Ccomment::TranslationUnitRepeat1 => "translation_unit_repeat1",
52            Ccomment::DefineRepeat1 => "define_repeat1",
53            Ccomment::Error => "ERROR",
54        }
55    }
56}
57
58impl From<u16> for Ccomment {
59    #[inline]
60    fn from(x: u16) -> Self {
61        num_traits::FromPrimitive::from_u16(x).unwrap_or(Self::Error)
62    }
63}
64
65// Ccomment == u16
66impl PartialEq<u16> for Ccomment {
67    #[inline]
68    fn eq(&self, x: &u16) -> bool {
69        *self == Into::<Self>::into(*x)
70    }
71}
72
73// u16 == Ccomment
74impl PartialEq<Ccomment> for u16 {
75    #[inline]
76    fn eq(&self, x: &Ccomment) -> bool {
77        *x == *self
78    }
79}