diff options
author | Aleksey Kladov <[email protected]> | 2018-08-01 08:40:07 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-01 08:40:07 +0100 |
commit | 966e9db2b83802dfb55d55bd3a26e69dced1bbd7 (patch) | |
tree | 6d3bda084eab1221bcad7602aa26a2c307850a72 /src/syntax_kinds | |
parent | b9189ed2db8cb1934e677a17fcc6282c66306df1 (diff) |
Extract libeditor
Diffstat (limited to 'src/syntax_kinds')
-rw-r--r-- | src/syntax_kinds/generated.rs | 41 | ||||
-rw-r--r-- | src/syntax_kinds/generated.rs.tera | 10 |
2 files changed, 51 insertions, 0 deletions
diff --git a/src/syntax_kinds/generated.rs b/src/syntax_kinds/generated.rs index 435be781c..cbcd0c4e1 100644 --- a/src/syntax_kinds/generated.rs +++ b/src/syntax_kinds/generated.rs | |||
@@ -169,6 +169,47 @@ pub enum SyntaxKind { | |||
169 | use self::SyntaxKind::*; | 169 | use self::SyntaxKind::*; |
170 | 170 | ||
171 | impl SyntaxKind { | 171 | impl SyntaxKind { |
172 | pub fn is_keyword(self) -> bool { | ||
173 | match self { | ||
174 | | USE_KW | ||
175 | | FN_KW | ||
176 | | STRUCT_KW | ||
177 | | ENUM_KW | ||
178 | | TRAIT_KW | ||
179 | | IMPL_KW | ||
180 | | TRUE_KW | ||
181 | | FALSE_KW | ||
182 | | AS_KW | ||
183 | | EXTERN_KW | ||
184 | | CRATE_KW | ||
185 | | MOD_KW | ||
186 | | PUB_KW | ||
187 | | SELF_KW | ||
188 | | SUPER_KW | ||
189 | | IN_KW | ||
190 | | WHERE_KW | ||
191 | | FOR_KW | ||
192 | | LOOP_KW | ||
193 | | WHILE_KW | ||
194 | | IF_KW | ||
195 | | ELSE_KW | ||
196 | | MATCH_KW | ||
197 | | CONST_KW | ||
198 | | STATIC_KW | ||
199 | | MUT_KW | ||
200 | | UNSAFE_KW | ||
201 | | TYPE_KW | ||
202 | | REF_KW | ||
203 | | LET_KW | ||
204 | | MOVE_KW | ||
205 | | AUTO_KW | ||
206 | | DEFAULT_KW | ||
207 | | UNION_KW | ||
208 | => true, | ||
209 | _ => false | ||
210 | } | ||
211 | } | ||
212 | |||
172 | pub(crate) fn info(self) -> &'static SyntaxInfo { | 213 | pub(crate) fn info(self) -> &'static SyntaxInfo { |
173 | match self { | 214 | match self { |
174 | SEMI => &SyntaxInfo { name: "SEMI" }, | 215 | SEMI => &SyntaxInfo { name: "SEMI" }, |
diff --git a/src/syntax_kinds/generated.rs.tera b/src/syntax_kinds/generated.rs.tera index d719c8312..4e2ee56c3 100644 --- a/src/syntax_kinds/generated.rs.tera +++ b/src/syntax_kinds/generated.rs.tera | |||
@@ -24,6 +24,16 @@ pub enum SyntaxKind { | |||
24 | use self::SyntaxKind::*; | 24 | use self::SyntaxKind::*; |
25 | 25 | ||
26 | impl SyntaxKind { | 26 | impl SyntaxKind { |
27 | pub fn is_keyword(self) -> bool { | ||
28 | match self { | ||
29 | {%- for kw in concat(a=keywords, b=contextual_keywords) %} | ||
30 | | {{kw | upper}}_KW | ||
31 | {%- endfor %} | ||
32 | => true, | ||
33 | _ => false | ||
34 | } | ||
35 | } | ||
36 | |||
27 | pub(crate) fn info(self) -> &'static SyntaxInfo { | 37 | pub(crate) fn info(self) -> &'static SyntaxInfo { |
28 | match self { | 38 | match self { |
29 | {%- for t in concat(a=single_byte_tokens, b=multi_byte_tokens) %} | 39 | {%- for t in concat(a=single_byte_tokens, b=multi_byte_tokens) %} |