diff options
author | Aleksey Kladov <[email protected]> | 2018-07-30 16:02:13 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-07-30 16:02:13 +0100 |
commit | 60e8a845cafb9630caa034b886368160a12dcd64 (patch) | |
tree | b72110591d851266ba5cd4b81a72c50021589b4f /src/syntax_kinds/generated.rs.tera | |
parent | 7fb7cfc2d1cd2781a20e4034b12384566d13c728 (diff) |
simplify codegen
Diffstat (limited to 'src/syntax_kinds/generated.rs.tera')
-rw-r--r-- | src/syntax_kinds/generated.rs.tera | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/src/syntax_kinds/generated.rs.tera b/src/syntax_kinds/generated.rs.tera index 21e471b71..2a47c6632 100644 --- a/src/syntax_kinds/generated.rs.tera +++ b/src/syntax_kinds/generated.rs.tera | |||
@@ -5,23 +5,14 @@ use super::SyntaxInfo; | |||
5 | /// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`. | 5 | /// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`. |
6 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] | 6 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] |
7 | pub enum SyntaxKind { | 7 | pub enum SyntaxKind { |
8 | {%- for t in single_byte_tokens %} | 8 | {%- for t in concat(a=single_byte_tokens, b=multi_byte_tokens) %} |
9 | {{t.1}}, | ||
10 | {%- endfor -%} | ||
11 | {% for t in multi_byte_tokens %} | ||
12 | {{t.1}}, | 9 | {{t.1}}, |
13 | {%- endfor -%} | 10 | {%- endfor -%} |
14 | {% for t in tokens %} | 11 | {% for kw in concat(a=keywords, b=contextual_keywords) %} |
15 | {{t}}, | ||
16 | {%- endfor -%} | ||
17 | {% for kw in keywords %} | ||
18 | {{kw | upper}}_KW, | 12 | {{kw | upper}}_KW, |
19 | {%- endfor -%} | 13 | {%- endfor -%} |
20 | {% for kw in contextual_keywords %} | 14 | {% for t in concat(a=tokens, b=nodes) %} |
21 | {{kw | upper}}_KW, | 15 | {{t}}, |
22 | {%- endfor -%} | ||
23 | {% for node in nodes %} | ||
24 | {{node}}, | ||
25 | {%- endfor %} | 16 | {%- endfor %} |
26 | // Technical SyntaxKinds: they appear temporally during parsing, | 17 | // Technical SyntaxKinds: they appear temporally during parsing, |
27 | // but never end up in the final tree | 18 | // but never end up in the final tree |
@@ -35,25 +26,15 @@ use self::SyntaxKind::*; | |||
35 | impl SyntaxKind { | 26 | impl SyntaxKind { |
36 | pub(crate) fn info(self) -> &'static SyntaxInfo { | 27 | pub(crate) fn info(self) -> &'static SyntaxInfo { |
37 | match self { | 28 | match self { |
38 | {%- for t in single_byte_tokens %} | 29 | {%- for t in concat(a=single_byte_tokens, b=multi_byte_tokens) %} |
39 | {{t.1}} => &SyntaxInfo { name: "{{t.1}}" }, | 30 | {{t.1}} => &SyntaxInfo { name: "{{t.1}}" }, |
40 | {%- endfor -%} | 31 | {%- endfor -%} |
41 | {% for t in multi_byte_tokens %} | 32 | {% for kw in concat(a=keywords, b=contextual_keywords) %} |
42 | {{t.1}} => &SyntaxInfo { name: "{{t.1}}" }, | ||
43 | {%- endfor -%} | ||
44 | {% for t in tokens %} | ||
45 | {{t}} => &SyntaxInfo { name: "{{t}}" }, | ||
46 | {%- endfor -%} | ||
47 | {% for kw in keywords %} | ||
48 | {{kw | upper}}_KW => &SyntaxInfo { name: "{{kw | upper}}_KW" }, | 33 | {{kw | upper}}_KW => &SyntaxInfo { name: "{{kw | upper}}_KW" }, |
49 | {%- endfor -%} | 34 | {%- endfor -%} |
50 | {% for kw in contextual_keywords %} | 35 | {% for t in concat(a=tokens, b=nodes) %} |
51 | {{kw | upper}}_KW => &SyntaxInfo { name: "{{kw | upper}}_KW" }, | 36 | {{t}} => &SyntaxInfo { name: "{{t}}" }, |
52 | {%- endfor -%} | ||
53 | {% for node in nodes %} | ||
54 | {{node}} => &SyntaxInfo { name: "{{node}}" }, | ||
55 | {%- endfor %} | 37 | {%- endfor %} |
56 | |||
57 | TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" }, | 38 | TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" }, |
58 | EOF => &SyntaxInfo { name: "EOF" }, | 39 | EOF => &SyntaxInfo { name: "EOF" }, |
59 | } | 40 | } |