Skip to content

Commit 264d1f0

Browse files
committed
Regenerate grammars
1 parent f0335a7 commit 264d1f0

10 files changed

Lines changed: 2577 additions & 3369 deletions

src/languages/language_ccomment.rs

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,38 +21,28 @@ pub enum Ccomment {
2121
Error = 16,
2222
}
2323

24-
#[allow(clippy::unreadable_literal)]
25-
static KEYS: phf::Map<&'static str, Ccomment> = ::phf::Map {
26-
key: 15467950696543387533,
27-
disps: &[(1, 0), (0, 13), (5, 8), (7, 15)],
28-
entries: &[
29-
("define_token1", Ccomment::DefineToken1),
30-
("nothing", Ccomment::Nothing),
31-
("char_literal", Ccomment::CharLiteral),
32-
("translation_unit", Ccomment::TranslationUnit),
33-
("define", Ccomment::Define),
34-
(
35-
"preproc_continuation_line",
36-
Ccomment::PreprocContinuationLine,
37-
),
38-
("string_literal_token1", Ccomment::StringLiteralToken1),
39-
("ERROR", Ccomment::Error),
40-
("_top_level_item", Ccomment::TopLevelItem),
41-
("char_literal_token1", Ccomment::CharLiteralToken1),
42-
("comment", Ccomment::Comment),
43-
("translation_unit_repeat1", Ccomment::TranslationUnitRepeat1),
44-
("preproc_line", Ccomment::PreprocLine),
45-
("string_literal", Ccomment::StringLiteral),
46-
("define_repeat1", Ccomment::DefineRepeat1),
47-
("raw_string_literal", Ccomment::RawStringLiteral),
48-
("end", Ccomment::End),
49-
],
50-
};
51-
52-
impl From<&str> for Ccomment {
24+
impl From<Ccomment> for &'static str {
5325
#[inline(always)]
54-
fn from(key: &str) -> Self {
55-
KEYS.get(key).unwrap().clone()
26+
fn from(tok: Ccomment) -> Self {
27+
match tok {
28+
Ccomment::End => "end",
29+
Ccomment::Nothing => "nothing",
30+
Ccomment::PreprocContinuationLine => "preproc_continuation_line",
31+
Ccomment::PreprocLine => "preproc_line",
32+
Ccomment::DefineToken1 => "define_token1",
33+
Ccomment::StringLiteralToken1 => "string_literal_token1",
34+
Ccomment::CharLiteralToken1 => "char_literal_token1",
35+
Ccomment::Comment => "comment",
36+
Ccomment::RawStringLiteral => "raw_string_literal",
37+
Ccomment::TranslationUnit => "translation_unit",
38+
Ccomment::TopLevelItem => "_top_level_item",
39+
Ccomment::Define => "define",
40+
Ccomment::StringLiteral => "string_literal",
41+
Ccomment::CharLiteral => "char_literal",
42+
Ccomment::TranslationUnitRepeat1 => "translation_unit_repeat1",
43+
Ccomment::DefineRepeat1 => "define_repeat1",
44+
Ccomment::Error => "ERROR",
45+
}
5646
}
5747
}
5848

0 commit comments

Comments
 (0)