aboutsummaryrefslogtreecommitdiff
path: root/crates/parser/src/syntax_kind
diff options
context:
space:
mode:
authorZac Pullar-Strecker <[email protected]>2020-08-24 10:19:53 +0100
committerZac Pullar-Strecker <[email protected]>2020-08-24 10:20:13 +0100
commit7bbca7a1b3f9293d2f5cc5745199bc5f8396f2f0 (patch)
treebdb47765991cb973b2cd5481a088fac636bd326c /crates/parser/src/syntax_kind
parentca464650eeaca6195891199a93f4f76cf3e7e697 (diff)
parente65d48d1fb3d4d91d9dc1148a7a836ff5c9a3c87 (diff)
Merge remote-tracking branch 'upstream/master' into 503-hover-doc-links
Diffstat (limited to 'crates/parser/src/syntax_kind')
-rw-r--r--crates/parser/src/syntax_kind/generated.rs367
1 files changed, 367 insertions, 0 deletions
diff --git a/crates/parser/src/syntax_kind/generated.rs b/crates/parser/src/syntax_kind/generated.rs
new file mode 100644
index 000000000..192ecd864
--- /dev/null
+++ b/crates/parser/src/syntax_kind/generated.rs
@@ -0,0 +1,367 @@
1//! Generated file, do not edit by hand, see `xtask/src/codegen`
2
3#![allow(bad_style, missing_docs, unreachable_pub)]
4#[doc = r" The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT`."]
5#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
6#[repr(u16)]
7pub enum SyntaxKind {
8 #[doc(hidden)]
9 TOMBSTONE,
10 #[doc(hidden)]
11 EOF,
12 SEMICOLON,
13 COMMA,
14 L_PAREN,
15 R_PAREN,
16 L_CURLY,
17 R_CURLY,
18 L_BRACK,
19 R_BRACK,
20 L_ANGLE,
21 R_ANGLE,
22 AT,
23 POUND,
24 TILDE,
25 QUESTION,
26 DOLLAR,
27 AMP,
28 PIPE,
29 PLUS,
30 STAR,
31 SLASH,
32 CARET,
33 PERCENT,
34 UNDERSCORE,
35 DOT,
36 DOT2,
37 DOT3,
38 DOT2EQ,
39 COLON,
40 COLON2,
41 EQ,
42 EQ2,
43 FAT_ARROW,
44 BANG,
45 NEQ,
46 MINUS,
47 THIN_ARROW,
48 LTEQ,
49 GTEQ,
50 PLUSEQ,
51 MINUSEQ,
52 PIPEEQ,
53 AMPEQ,
54 CARETEQ,
55 SLASHEQ,
56 STAREQ,
57 PERCENTEQ,
58 AMP2,
59 PIPE2,
60 SHL,
61 SHR,
62 SHLEQ,
63 SHREQ,
64 AS_KW,
65 ASYNC_KW,
66 AWAIT_KW,
67 BOX_KW,
68 BREAK_KW,
69 CONST_KW,
70 CONTINUE_KW,
71 CRATE_KW,
72 DYN_KW,
73 ELSE_KW,
74 ENUM_KW,
75 EXTERN_KW,
76 FALSE_KW,
77 FN_KW,
78 FOR_KW,
79 IF_KW,
80 IMPL_KW,
81 IN_KW,
82 LET_KW,
83 LOOP_KW,
84 MACRO_KW,
85 MATCH_KW,
86 MOD_KW,
87 MOVE_KW,
88 MUT_KW,
89 PUB_KW,
90 REF_KW,
91 RETURN_KW,
92 SELF_KW,
93 STATIC_KW,
94 STRUCT_KW,
95 SUPER_KW,
96 TRAIT_KW,
97 TRUE_KW,
98 TRY_KW,
99 TYPE_KW,
100 UNSAFE_KW,
101 USE_KW,
102 WHERE_KW,
103 WHILE_KW,
104 AUTO_KW,
105 DEFAULT_KW,
106 EXISTENTIAL_KW,
107 UNION_KW,
108 RAW_KW,
109 INT_NUMBER,
110 FLOAT_NUMBER,
111 CHAR,
112 BYTE,
113 STRING,
114 RAW_STRING,
115 BYTE_STRING,
116 RAW_BYTE_STRING,
117 ERROR,
118 IDENT,
119 WHITESPACE,
120 LIFETIME,
121 COMMENT,
122 SHEBANG,
123 L_DOLLAR,
124 R_DOLLAR,
125 SOURCE_FILE,
126 STRUCT,
127 UNION,
128 ENUM,
129 FN,
130 RET_TYPE,
131 EXTERN_CRATE,
132 MODULE,
133 USE,
134 STATIC,
135 CONST,
136 TRAIT,
137 IMPL,
138 TYPE_ALIAS,
139 MACRO_CALL,
140 TOKEN_TREE,
141 MACRO_DEF,
142 PAREN_TYPE,
143 TUPLE_TYPE,
144 NEVER_TYPE,
145 PATH_TYPE,
146 PTR_TYPE,
147 ARRAY_TYPE,
148 SLICE_TYPE,
149 REF_TYPE,
150 INFER_TYPE,
151 FN_PTR_TYPE,
152 FOR_TYPE,
153 IMPL_TRAIT_TYPE,
154 DYN_TRAIT_TYPE,
155 OR_PAT,
156 PAREN_PAT,
157 REF_PAT,
158 BOX_PAT,
159 IDENT_PAT,
160 WILDCARD_PAT,
161 REST_PAT,
162 PATH_PAT,
163 RECORD_PAT,
164 RECORD_PAT_FIELD_LIST,
165 RECORD_PAT_FIELD,
166 TUPLE_STRUCT_PAT,
167 TUPLE_PAT,
168 SLICE_PAT,
169 RANGE_PAT,
170 LITERAL_PAT,
171 MACRO_PAT,
172 TUPLE_EXPR,
173 ARRAY_EXPR,
174 PAREN_EXPR,
175 PATH_EXPR,
176 CLOSURE_EXPR,
177 IF_EXPR,
178 WHILE_EXPR,
179 CONDITION,
180 LOOP_EXPR,
181 FOR_EXPR,
182 CONTINUE_EXPR,
183 BREAK_EXPR,
184 LABEL,
185 BLOCK_EXPR,
186 RETURN_EXPR,
187 MATCH_EXPR,
188 MATCH_ARM_LIST,
189 MATCH_ARM,
190 MATCH_GUARD,
191 RECORD_EXPR,
192 RECORD_EXPR_FIELD_LIST,
193 RECORD_EXPR_FIELD,
194 EFFECT_EXPR,
195 BOX_EXPR,
196 CALL_EXPR,
197 INDEX_EXPR,
198 METHOD_CALL_EXPR,
199 FIELD_EXPR,
200 AWAIT_EXPR,
201 TRY_EXPR,
202 CAST_EXPR,
203 REF_EXPR,
204 PREFIX_EXPR,
205 RANGE_EXPR,
206 BIN_EXPR,
207 EXTERN_BLOCK,
208 EXTERN_ITEM_LIST,
209 VARIANT,
210 RECORD_FIELD_LIST,
211 RECORD_FIELD,
212 TUPLE_FIELD_LIST,
213 TUPLE_FIELD,
214 VARIANT_LIST,
215 ITEM_LIST,
216 ASSOC_ITEM_LIST,
217 ATTR,
218 META_ITEM,
219 USE_TREE,
220 USE_TREE_LIST,
221 PATH,
222 PATH_SEGMENT,
223 LITERAL,
224 RENAME,
225 VISIBILITY,
226 WHERE_CLAUSE,
227 WHERE_PRED,
228 ABI,
229 NAME,
230 NAME_REF,
231 LET_STMT,
232 EXPR_STMT,
233 GENERIC_PARAM_LIST,
234 GENERIC_PARAM,
235 LIFETIME_PARAM,
236 TYPE_PARAM,
237 CONST_PARAM,
238 GENERIC_ARG_LIST,
239 LIFETIME_ARG,
240 TYPE_ARG,
241 ASSOC_TYPE_ARG,
242 CONST_ARG,
243 PARAM_LIST,
244 PARAM,
245 SELF_PARAM,
246 ARG_LIST,
247 TYPE_BOUND,
248 TYPE_BOUND_LIST,
249 MACRO_ITEMS,
250 MACRO_STMTS,
251 #[doc(hidden)]
252 __LAST,
253}
254use self::SyntaxKind::*;
255impl SyntaxKind {
256 pub fn is_keyword(self) -> bool {
257 match self {
258 AS_KW | ASYNC_KW | AWAIT_KW | BOX_KW | BREAK_KW | CONST_KW | CONTINUE_KW | CRATE_KW
259 | DYN_KW | ELSE_KW | ENUM_KW | EXTERN_KW | FALSE_KW | FN_KW | FOR_KW | IF_KW
260 | IMPL_KW | IN_KW | LET_KW | LOOP_KW | MACRO_KW | MATCH_KW | MOD_KW | MOVE_KW
261 | MUT_KW | PUB_KW | REF_KW | RETURN_KW | SELF_KW | STATIC_KW | STRUCT_KW | SUPER_KW
262 | TRAIT_KW | TRUE_KW | TRY_KW | TYPE_KW | UNSAFE_KW | USE_KW | WHERE_KW | WHILE_KW
263 | AUTO_KW | DEFAULT_KW | EXISTENTIAL_KW | UNION_KW | RAW_KW => true,
264 _ => false,
265 }
266 }
267 pub fn is_punct(self) -> bool {
268 match self {
269 SEMICOLON | COMMA | L_PAREN | R_PAREN | L_CURLY | R_CURLY | L_BRACK | R_BRACK
270 | L_ANGLE | R_ANGLE | AT | POUND | TILDE | QUESTION | DOLLAR | AMP | PIPE | PLUS
271 | STAR | SLASH | CARET | PERCENT | UNDERSCORE | DOT | DOT2 | DOT3 | DOT2EQ | COLON
272 | COLON2 | EQ | EQ2 | FAT_ARROW | BANG | NEQ | MINUS | THIN_ARROW | LTEQ | GTEQ
273 | PLUSEQ | MINUSEQ | PIPEEQ | AMPEQ | CARETEQ | SLASHEQ | STAREQ | PERCENTEQ | AMP2
274 | PIPE2 | SHL | SHR | SHLEQ | SHREQ => true,
275 _ => false,
276 }
277 }
278 pub fn is_literal(self) -> bool {
279 match self {
280 INT_NUMBER | FLOAT_NUMBER | CHAR | BYTE | STRING | RAW_STRING | BYTE_STRING
281 | RAW_BYTE_STRING => true,
282 _ => false,
283 }
284 }
285 pub fn from_keyword(ident: &str) -> Option<SyntaxKind> {
286 let kw = match ident {
287 "as" => AS_KW,
288 "async" => ASYNC_KW,
289 "await" => AWAIT_KW,
290 "box" => BOX_KW,
291 "break" => BREAK_KW,
292 "const" => CONST_KW,
293 "continue" => CONTINUE_KW,
294 "crate" => CRATE_KW,
295 "dyn" => DYN_KW,
296 "else" => ELSE_KW,
297 "enum" => ENUM_KW,
298 "extern" => EXTERN_KW,
299 "false" => FALSE_KW,
300 "fn" => FN_KW,
301 "for" => FOR_KW,
302 "if" => IF_KW,
303 "impl" => IMPL_KW,
304 "in" => IN_KW,
305 "let" => LET_KW,
306 "loop" => LOOP_KW,
307 "macro" => MACRO_KW,
308 "match" => MATCH_KW,
309 "mod" => MOD_KW,
310 "move" => MOVE_KW,
311 "mut" => MUT_KW,
312 "pub" => PUB_KW,
313 "ref" => REF_KW,
314 "return" => RETURN_KW,
315 "self" => SELF_KW,
316 "static" => STATIC_KW,
317 "struct" => STRUCT_KW,
318 "super" => SUPER_KW,
319 "trait" => TRAIT_KW,
320 "true" => TRUE_KW,
321 "try" => TRY_KW,
322 "type" => TYPE_KW,
323 "unsafe" => UNSAFE_KW,
324 "use" => USE_KW,
325 "where" => WHERE_KW,
326 "while" => WHILE_KW,
327 _ => return None,
328 };
329 Some(kw)
330 }
331 pub fn from_char(c: char) -> Option<SyntaxKind> {
332 let tok = match c {
333 ';' => SEMICOLON,
334 ',' => COMMA,
335 '(' => L_PAREN,
336 ')' => R_PAREN,
337 '{' => L_CURLY,
338 '}' => R_CURLY,
339 '[' => L_BRACK,
340 ']' => R_BRACK,
341 '<' => L_ANGLE,
342 '>' => R_ANGLE,
343 '@' => AT,
344 '#' => POUND,
345 '~' => TILDE,
346 '?' => QUESTION,
347 '$' => DOLLAR,
348 '&' => AMP,
349 '|' => PIPE,
350 '+' => PLUS,
351 '*' => STAR,
352 '/' => SLASH,
353 '^' => CARET,
354 '%' => PERCENT,
355 '_' => UNDERSCORE,
356 '.' => DOT,
357 ':' => COLON,
358 '=' => EQ,
359 '!' => BANG,
360 '-' => MINUS,
361 _ => return None,
362 };
363 Some(tok)
364 }
365}
366#[macro_export]
367macro_rules ! T { [ ; ] => { $ crate :: SyntaxKind :: SEMICOLON } ; [ , ] => { $ crate :: SyntaxKind :: COMMA } ; [ '(' ] => { $ crate :: SyntaxKind :: L_PAREN } ; [ ')' ] => { $ crate :: SyntaxKind :: R_PAREN } ; [ '{' ] => { $ crate :: SyntaxKind :: L_CURLY } ; [ '}' ] => { $ crate :: SyntaxKind :: R_CURLY } ; [ '[' ] => { $ crate :: SyntaxKind :: L_BRACK } ; [ ']' ] => { $ crate :: SyntaxKind :: R_BRACK } ; [ < ] => { $ crate :: SyntaxKind :: L_ANGLE } ; [ > ] => { $ crate :: SyntaxKind :: R_ANGLE } ; [ @ ] => { $ crate :: SyntaxKind :: AT } ; [ # ] => { $ crate :: SyntaxKind :: POUND } ; [ ~ ] => { $ crate :: SyntaxKind :: TILDE } ; [ ? ] => { $ crate :: SyntaxKind :: QUESTION } ; [ $ ] => { $ crate :: SyntaxKind :: DOLLAR } ; [ & ] => { $ crate :: SyntaxKind :: AMP } ; [ | ] => { $ crate :: SyntaxKind :: PIPE } ; [ + ] => { $ crate :: SyntaxKind :: PLUS } ; [ * ] => { $ crate :: SyntaxKind :: STAR } ; [ / ] => { $ crate :: SyntaxKind :: SLASH } ; [ ^ ] => { $ crate :: SyntaxKind :: CARET } ; [ % ] => { $ crate :: SyntaxKind :: PERCENT } ; [ _ ] => { $ crate :: SyntaxKind :: UNDERSCORE } ; [ . ] => { $ crate :: SyntaxKind :: DOT } ; [ .. ] => { $ crate :: SyntaxKind :: DOT2 } ; [ ... ] => { $ crate :: SyntaxKind :: DOT3 } ; [ ..= ] => { $ crate :: SyntaxKind :: DOT2EQ } ; [ : ] => { $ crate :: SyntaxKind :: COLON } ; [ :: ] => { $ crate :: SyntaxKind :: COLON2 } ; [ = ] => { $ crate :: SyntaxKind :: EQ } ; [ == ] => { $ crate :: SyntaxKind :: EQ2 } ; [ => ] => { $ crate :: SyntaxKind :: FAT_ARROW } ; [ ! ] => { $ crate :: SyntaxKind :: BANG } ; [ != ] => { $ crate :: SyntaxKind :: NEQ } ; [ - ] => { $ crate :: SyntaxKind :: MINUS } ; [ -> ] => { $ crate :: SyntaxKind :: THIN_ARROW } ; [ <= ] => { $ crate :: SyntaxKind :: LTEQ } ; [ >= ] => { $ crate :: SyntaxKind :: GTEQ } ; [ += ] => { $ crate :: SyntaxKind :: PLUSEQ } ; [ -= ] => { $ crate :: SyntaxKind :: MINUSEQ } ; [ |= ] => { $ crate :: SyntaxKind :: PIPEEQ } ; [ &= ] => { $ crate :: SyntaxKind :: AMPEQ } ; [ ^= ] => { $ crate :: SyntaxKind :: CARETEQ } ; [ /= ] => { $ crate :: SyntaxKind :: SLASHEQ } ; [ *= ] => { $ crate :: SyntaxKind :: STAREQ } ; [ %= ] => { $ crate :: SyntaxKind :: PERCENTEQ } ; [ && ] => { $ crate :: SyntaxKind :: AMP2 } ; [ || ] => { $ crate :: SyntaxKind :: PIPE2 } ; [ << ] => { $ crate :: SyntaxKind :: SHL } ; [ >> ] => { $ crate :: SyntaxKind :: SHR } ; [ <<= ] => { $ crate :: SyntaxKind :: SHLEQ } ; [ >>= ] => { $ crate :: SyntaxKind :: SHREQ } ; [ as ] => { $ crate :: SyntaxKind :: AS_KW } ; [ async ] => { $ crate :: SyntaxKind :: ASYNC_KW } ; [ await ] => { $ crate :: SyntaxKind :: AWAIT_KW } ; [ box ] => { $ crate :: SyntaxKind :: BOX_KW } ; [ break ] => { $ crate :: SyntaxKind :: BREAK_KW } ; [ const ] => { $ crate :: SyntaxKind :: CONST_KW } ; [ continue ] => { $ crate :: SyntaxKind :: CONTINUE_KW } ; [ crate ] => { $ crate :: SyntaxKind :: CRATE_KW } ; [ dyn ] => { $ crate :: SyntaxKind :: DYN_KW } ; [ else ] => { $ crate :: SyntaxKind :: ELSE_KW } ; [ enum ] => { $ crate :: SyntaxKind :: ENUM_KW } ; [ extern ] => { $ crate :: SyntaxKind :: EXTERN_KW } ; [ false ] => { $ crate :: SyntaxKind :: FALSE_KW } ; [ fn ] => { $ crate :: SyntaxKind :: FN_KW } ; [ for ] => { $ crate :: SyntaxKind :: FOR_KW } ; [ if ] => { $ crate :: SyntaxKind :: IF_KW } ; [ impl ] => { $ crate :: SyntaxKind :: IMPL_KW } ; [ in ] => { $ crate :: SyntaxKind :: IN_KW } ; [ let ] => { $ crate :: SyntaxKind :: LET_KW } ; [ loop ] => { $ crate :: SyntaxKind :: LOOP_KW } ; [ macro ] => { $ crate :: SyntaxKind :: MACRO_KW } ; [ match ] => { $ crate :: SyntaxKind :: MATCH_KW } ; [ mod ] => { $ crate :: SyntaxKind :: MOD_KW } ; [ move ] => { $ crate :: SyntaxKind :: MOVE_KW } ; [ mut ] => { $ crate :: SyntaxKind :: MUT_KW } ; [ pub ] => { $ crate :: SyntaxKind :: PUB_KW } ; [ ref ] => { $ crate :: SyntaxKind :: REF_KW } ; [ return ] => { $ crate :: SyntaxKind :: RETURN_KW } ; [ self ] => { $ crate :: SyntaxKind :: SELF_KW } ; [ static ] => { $ crate :: SyntaxKind :: STATIC_KW } ; [ struct ] => { $ crate :: SyntaxKind :: STRUCT_KW } ; [ super ] => { $ crate :: SyntaxKind :: SUPER_KW } ; [ trait ] => { $ crate :: SyntaxKind :: TRAIT_KW } ; [ true ] => { $ crate :: SyntaxKind :: TRUE_KW } ; [ try ] => { $ crate :: SyntaxKind :: TRY_KW } ; [ type ] => { $ crate :: SyntaxKind :: TYPE_KW } ; [ unsafe ] => { $ crate :: SyntaxKind :: UNSAFE_KW } ; [ use ] => { $ crate :: SyntaxKind :: USE_KW } ; [ where ] => { $ crate :: SyntaxKind :: WHERE_KW } ; [ while ] => { $ crate :: SyntaxKind :: WHILE_KW } ; [ auto ] => { $ crate :: SyntaxKind :: AUTO_KW } ; [ default ] => { $ crate :: SyntaxKind :: DEFAULT_KW } ; [ existential ] => { $ crate :: SyntaxKind :: EXISTENTIAL_KW } ; [ union ] => { $ crate :: SyntaxKind :: UNION_KW } ; [ raw ] => { $ crate :: SyntaxKind :: RAW_KW } ; [ lifetime ] => { $ crate :: SyntaxKind :: LIFETIME } ; [ ident ] => { $ crate :: SyntaxKind :: IDENT } ; [ shebang ] => { $ crate :: SyntaxKind :: SHEBANG } ; }