aboutsummaryrefslogtreecommitdiff
path: root/src/syntax_kinds
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-07-30 16:02:13 +0100
committerAleksey Kladov <[email protected]>2018-07-30 16:02:13 +0100
commit60e8a845cafb9630caa034b886368160a12dcd64 (patch)
treeb72110591d851266ba5cd4b81a72c50021589b4f /src/syntax_kinds
parent7fb7cfc2d1cd2781a20e4034b12384566d13c728 (diff)
simplify codegen
Diffstat (limited to 'src/syntax_kinds')
-rw-r--r--src/syntax_kinds/generated.rs65
-rw-r--r--src/syntax_kinds/generated.rs.tera35
2 files changed, 40 insertions, 60 deletions
diff --git a/src/syntax_kinds/generated.rs b/src/syntax_kinds/generated.rs
index de0d1c51d..9dcf8992f 100644
--- a/src/syntax_kinds/generated.rs
+++ b/src/syntax_kinds/generated.rs
@@ -40,22 +40,6 @@ pub enum SyntaxKind {
40 NEQ, 40 NEQ,
41 MINUS, 41 MINUS,
42 THIN_ARROW, 42 THIN_ARROW,
43 ERROR,
44 IDENT,
45 UNDERSCORE,
46 WHITESPACE,
47 INT_NUMBER,
48 FLOAT_NUMBER,
49 LIFETIME,
50 CHAR,
51 BYTE,
52 STRING,
53 RAW_STRING,
54 BYTE_STRING,
55 RAW_BYTE_STRING,
56 COMMENT,
57 DOC_COMMENT,
58 SHEBANG,
59 USE_KW, 43 USE_KW,
60 FN_KW, 44 FN_KW,
61 STRUCT_KW, 45 STRUCT_KW,
@@ -88,6 +72,22 @@ pub enum SyntaxKind {
88 AUTO_KW, 72 AUTO_KW,
89 DEFAULT_KW, 73 DEFAULT_KW,
90 UNION_KW, 74 UNION_KW,
75 ERROR,
76 IDENT,
77 UNDERSCORE,
78 WHITESPACE,
79 INT_NUMBER,
80 FLOAT_NUMBER,
81 LIFETIME,
82 CHAR,
83 BYTE,
84 STRING,
85 RAW_STRING,
86 BYTE_STRING,
87 RAW_BYTE_STRING,
88 COMMENT,
89 DOC_COMMENT,
90 SHEBANG,
91 FILE, 91 FILE,
92 STRUCT_ITEM, 92 STRUCT_ITEM,
93 ENUM_ITEM, 93 ENUM_ITEM,
@@ -186,22 +186,6 @@ impl SyntaxKind {
186 NEQ => &SyntaxInfo { name: "NEQ" }, 186 NEQ => &SyntaxInfo { name: "NEQ" },
187 MINUS => &SyntaxInfo { name: "MINUS" }, 187 MINUS => &SyntaxInfo { name: "MINUS" },
188 THIN_ARROW => &SyntaxInfo { name: "THIN_ARROW" }, 188 THIN_ARROW => &SyntaxInfo { name: "THIN_ARROW" },
189 ERROR => &SyntaxInfo { name: "ERROR" },
190 IDENT => &SyntaxInfo { name: "IDENT" },
191 UNDERSCORE => &SyntaxInfo { name: "UNDERSCORE" },
192 WHITESPACE => &SyntaxInfo { name: "WHITESPACE" },
193 INT_NUMBER => &SyntaxInfo { name: "INT_NUMBER" },
194 FLOAT_NUMBER => &SyntaxInfo { name: "FLOAT_NUMBER" },
195 LIFETIME => &SyntaxInfo { name: "LIFETIME" },
196 CHAR => &SyntaxInfo { name: "CHAR" },
197 BYTE => &SyntaxInfo { name: "BYTE" },
198 STRING => &SyntaxInfo { name: "STRING" },
199 RAW_STRING => &SyntaxInfo { name: "RAW_STRING" },
200 BYTE_STRING => &SyntaxInfo { name: "BYTE_STRING" },
201 RAW_BYTE_STRING => &SyntaxInfo { name: "RAW_BYTE_STRING" },
202 COMMENT => &SyntaxInfo { name: "COMMENT" },
203 DOC_COMMENT => &SyntaxInfo { name: "DOC_COMMENT" },
204 SHEBANG => &SyntaxInfo { name: "SHEBANG" },
205 USE_KW => &SyntaxInfo { name: "USE_KW" }, 189 USE_KW => &SyntaxInfo { name: "USE_KW" },
206 FN_KW => &SyntaxInfo { name: "FN_KW" }, 190 FN_KW => &SyntaxInfo { name: "FN_KW" },
207 STRUCT_KW => &SyntaxInfo { name: "STRUCT_KW" }, 191 STRUCT_KW => &SyntaxInfo { name: "STRUCT_KW" },
@@ -234,6 +218,22 @@ impl SyntaxKind {
234 AUTO_KW => &SyntaxInfo { name: "AUTO_KW" }, 218 AUTO_KW => &SyntaxInfo { name: "AUTO_KW" },
235 DEFAULT_KW => &SyntaxInfo { name: "DEFAULT_KW" }, 219 DEFAULT_KW => &SyntaxInfo { name: "DEFAULT_KW" },
236 UNION_KW => &SyntaxInfo { name: "UNION_KW" }, 220 UNION_KW => &SyntaxInfo { name: "UNION_KW" },
221 ERROR => &SyntaxInfo { name: "ERROR" },
222 IDENT => &SyntaxInfo { name: "IDENT" },
223 UNDERSCORE => &SyntaxInfo { name: "UNDERSCORE" },
224 WHITESPACE => &SyntaxInfo { name: "WHITESPACE" },
225 INT_NUMBER => &SyntaxInfo { name: "INT_NUMBER" },
226 FLOAT_NUMBER => &SyntaxInfo { name: "FLOAT_NUMBER" },
227 LIFETIME => &SyntaxInfo { name: "LIFETIME" },
228 CHAR => &SyntaxInfo { name: "CHAR" },
229 BYTE => &SyntaxInfo { name: "BYTE" },
230 STRING => &SyntaxInfo { name: "STRING" },
231 RAW_STRING => &SyntaxInfo { name: "RAW_STRING" },
232 BYTE_STRING => &SyntaxInfo { name: "BYTE_STRING" },
233 RAW_BYTE_STRING => &SyntaxInfo { name: "RAW_BYTE_STRING" },
234 COMMENT => &SyntaxInfo { name: "COMMENT" },
235 DOC_COMMENT => &SyntaxInfo { name: "DOC_COMMENT" },
236 SHEBANG => &SyntaxInfo { name: "SHEBANG" },
237 FILE => &SyntaxInfo { name: "FILE" }, 237 FILE => &SyntaxInfo { name: "FILE" },
238 STRUCT_ITEM => &SyntaxInfo { name: "STRUCT_ITEM" }, 238 STRUCT_ITEM => &SyntaxInfo { name: "STRUCT_ITEM" },
239 ENUM_ITEM => &SyntaxInfo { name: "ENUM_ITEM" }, 239 ENUM_ITEM => &SyntaxInfo { name: "ENUM_ITEM" },
@@ -285,7 +285,6 @@ impl SyntaxKind {
285 LIFETIME_PARAM => &SyntaxInfo { name: "LIFETIME_PARAM" }, 285 LIFETIME_PARAM => &SyntaxInfo { name: "LIFETIME_PARAM" },
286 TYPE_PARAM_LIST => &SyntaxInfo { name: "TYPE_PARAM_LIST" }, 286 TYPE_PARAM_LIST => &SyntaxInfo { name: "TYPE_PARAM_LIST" },
287 TYPE_ARG_LIST => &SyntaxInfo { name: "TYPE_ARG_LIST" }, 287 TYPE_ARG_LIST => &SyntaxInfo { name: "TYPE_ARG_LIST" },
288
289 TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" }, 288 TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" },
290 EOF => &SyntaxInfo { name: "EOF" }, 289 EOF => &SyntaxInfo { name: "EOF" },
291 } 290 }
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)]
7pub enum SyntaxKind { 7pub 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::*;
35impl SyntaxKind { 26impl 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 }