diff options
Diffstat (limited to 'crates/ra_parser/src/syntax_kind')
-rw-r--r-- | crates/ra_parser/src/syntax_kind/generated.rs | 987 | ||||
-rw-r--r-- | crates/ra_parser/src/syntax_kind/generated.rs.tera | 128 |
2 files changed, 538 insertions, 577 deletions
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs index 4b5abb516..75f5fb64c 100644 --- a/crates/ra_parser/src/syntax_kind/generated.rs +++ b/crates/ra_parser/src/syntax_kind/generated.rs | |||
@@ -1,16 +1,11 @@ | |||
1 | // This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run | 1 | // Generated file, do not edit by hand, see `crate/ra_tools/src/codegen` |
2 | // Do not edit manually | ||
3 | 2 | ||
4 | #![allow(bad_style, missing_docs, unreachable_pub)] | 3 | #![allow(bad_style, missing_docs, unreachable_pub)] |
5 | #![cfg_attr(rustfmt, rustfmt_skip)] | ||
6 | use super::SyntaxInfo; | 4 | use super::SyntaxInfo; |
7 | 5 | #[doc = r" The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`."] | |
8 | /// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`. | ||
9 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] | 6 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] |
10 | #[repr(u16)] | 7 | #[repr(u16)] |
11 | pub enum SyntaxKind { | 8 | pub enum SyntaxKind { |
12 | // Technical SyntaxKinds: they appear temporally during parsing, | ||
13 | // but never end up in the final tree | ||
14 | #[doc(hidden)] | 9 | #[doc(hidden)] |
15 | TOMBSTONE, | 10 | TOMBSTONE, |
16 | #[doc(hidden)] | 11 | #[doc(hidden)] |
@@ -242,477 +237,280 @@ pub enum SyntaxKind { | |||
242 | TYPE_BOUND_LIST, | 237 | TYPE_BOUND_LIST, |
243 | MACRO_ITEMS, | 238 | MACRO_ITEMS, |
244 | MACRO_STMTS, | 239 | MACRO_STMTS, |
245 | // Technical kind so that we can cast from u16 safely | ||
246 | #[doc(hidden)] | 240 | #[doc(hidden)] |
247 | __LAST, | 241 | __LAST, |
248 | } | 242 | } |
249 | use self::SyntaxKind::*; | 243 | use self::SyntaxKind::*; |
250 | |||
251 | #[macro_export] | ||
252 | macro_rules! T { | ||
253 | (;) => { $crate::SyntaxKind::SEMI }; | ||
254 | (,) => { $crate::SyntaxKind::COMMA }; | ||
255 | ('(') => { $crate::SyntaxKind::L_PAREN }; | ||
256 | (')') => { $crate::SyntaxKind::R_PAREN }; | ||
257 | ('{') => { $crate::SyntaxKind::L_CURLY }; | ||
258 | ('}') => { $crate::SyntaxKind::R_CURLY }; | ||
259 | ('[') => { $crate::SyntaxKind::L_BRACK }; | ||
260 | (']') => { $crate::SyntaxKind::R_BRACK }; | ||
261 | (<) => { $crate::SyntaxKind::L_ANGLE }; | ||
262 | (>) => { $crate::SyntaxKind::R_ANGLE }; | ||
263 | (@) => { $crate::SyntaxKind::AT }; | ||
264 | (#) => { $crate::SyntaxKind::POUND }; | ||
265 | (~) => { $crate::SyntaxKind::TILDE }; | ||
266 | (?) => { $crate::SyntaxKind::QUESTION }; | ||
267 | ($) => { $crate::SyntaxKind::DOLLAR }; | ||
268 | (&) => { $crate::SyntaxKind::AMP }; | ||
269 | (|) => { $crate::SyntaxKind::PIPE }; | ||
270 | (+) => { $crate::SyntaxKind::PLUS }; | ||
271 | (*) => { $crate::SyntaxKind::STAR }; | ||
272 | (/) => { $crate::SyntaxKind::SLASH }; | ||
273 | (^) => { $crate::SyntaxKind::CARET }; | ||
274 | (%) => { $crate::SyntaxKind::PERCENT }; | ||
275 | (_) => { $crate::SyntaxKind::UNDERSCORE }; | ||
276 | (.) => { $crate::SyntaxKind::DOT }; | ||
277 | (..) => { $crate::SyntaxKind::DOTDOT }; | ||
278 | (...) => { $crate::SyntaxKind::DOTDOTDOT }; | ||
279 | (..=) => { $crate::SyntaxKind::DOTDOTEQ }; | ||
280 | (:) => { $crate::SyntaxKind::COLON }; | ||
281 | (::) => { $crate::SyntaxKind::COLONCOLON }; | ||
282 | (=) => { $crate::SyntaxKind::EQ }; | ||
283 | (==) => { $crate::SyntaxKind::EQEQ }; | ||
284 | (=>) => { $crate::SyntaxKind::FAT_ARROW }; | ||
285 | (!) => { $crate::SyntaxKind::EXCL }; | ||
286 | (!=) => { $crate::SyntaxKind::NEQ }; | ||
287 | (-) => { $crate::SyntaxKind::MINUS }; | ||
288 | (->) => { $crate::SyntaxKind::THIN_ARROW }; | ||
289 | (<=) => { $crate::SyntaxKind::LTEQ }; | ||
290 | (>=) => { $crate::SyntaxKind::GTEQ }; | ||
291 | (+=) => { $crate::SyntaxKind::PLUSEQ }; | ||
292 | (-=) => { $crate::SyntaxKind::MINUSEQ }; | ||
293 | (|=) => { $crate::SyntaxKind::PIPEEQ }; | ||
294 | (&=) => { $crate::SyntaxKind::AMPEQ }; | ||
295 | (^=) => { $crate::SyntaxKind::CARETEQ }; | ||
296 | (/=) => { $crate::SyntaxKind::SLASHEQ }; | ||
297 | (*=) => { $crate::SyntaxKind::STAREQ }; | ||
298 | (%=) => { $crate::SyntaxKind::PERCENTEQ }; | ||
299 | (&&) => { $crate::SyntaxKind::AMPAMP }; | ||
300 | (||) => { $crate::SyntaxKind::PIPEPIPE }; | ||
301 | (<<) => { $crate::SyntaxKind::SHL }; | ||
302 | (>>) => { $crate::SyntaxKind::SHR }; | ||
303 | (<<=) => { $crate::SyntaxKind::SHLEQ }; | ||
304 | (>>=) => { $crate::SyntaxKind::SHREQ }; | ||
305 | (async) => { $crate::SyntaxKind::ASYNC_KW }; | ||
306 | (use) => { $crate::SyntaxKind::USE_KW }; | ||
307 | (fn) => { $crate::SyntaxKind::FN_KW }; | ||
308 | (struct) => { $crate::SyntaxKind::STRUCT_KW }; | ||
309 | (enum) => { $crate::SyntaxKind::ENUM_KW }; | ||
310 | (trait) => { $crate::SyntaxKind::TRAIT_KW }; | ||
311 | (impl) => { $crate::SyntaxKind::IMPL_KW }; | ||
312 | (dyn) => { $crate::SyntaxKind::DYN_KW }; | ||
313 | (true) => { $crate::SyntaxKind::TRUE_KW }; | ||
314 | (false) => { $crate::SyntaxKind::FALSE_KW }; | ||
315 | (as) => { $crate::SyntaxKind::AS_KW }; | ||
316 | (extern) => { $crate::SyntaxKind::EXTERN_KW }; | ||
317 | (crate) => { $crate::SyntaxKind::CRATE_KW }; | ||
318 | (mod) => { $crate::SyntaxKind::MOD_KW }; | ||
319 | (pub) => { $crate::SyntaxKind::PUB_KW }; | ||
320 | (self) => { $crate::SyntaxKind::SELF_KW }; | ||
321 | (super) => { $crate::SyntaxKind::SUPER_KW }; | ||
322 | (in) => { $crate::SyntaxKind::IN_KW }; | ||
323 | (where) => { $crate::SyntaxKind::WHERE_KW }; | ||
324 | (for) => { $crate::SyntaxKind::FOR_KW }; | ||
325 | (loop) => { $crate::SyntaxKind::LOOP_KW }; | ||
326 | (while) => { $crate::SyntaxKind::WHILE_KW }; | ||
327 | (continue) => { $crate::SyntaxKind::CONTINUE_KW }; | ||
328 | (break) => { $crate::SyntaxKind::BREAK_KW }; | ||
329 | (if) => { $crate::SyntaxKind::IF_KW }; | ||
330 | (else) => { $crate::SyntaxKind::ELSE_KW }; | ||
331 | (match) => { $crate::SyntaxKind::MATCH_KW }; | ||
332 | (const) => { $crate::SyntaxKind::CONST_KW }; | ||
333 | (static) => { $crate::SyntaxKind::STATIC_KW }; | ||
334 | (mut) => { $crate::SyntaxKind::MUT_KW }; | ||
335 | (unsafe) => { $crate::SyntaxKind::UNSAFE_KW }; | ||
336 | (type) => { $crate::SyntaxKind::TYPE_KW }; | ||
337 | (ref) => { $crate::SyntaxKind::REF_KW }; | ||
338 | (let) => { $crate::SyntaxKind::LET_KW }; | ||
339 | (move) => { $crate::SyntaxKind::MOVE_KW }; | ||
340 | (return) => { $crate::SyntaxKind::RETURN_KW }; | ||
341 | (try) => { $crate::SyntaxKind::TRY_KW }; | ||
342 | (box) => { $crate::SyntaxKind::BOX_KW }; | ||
343 | (await) => { $crate::SyntaxKind::AWAIT_KW }; | ||
344 | (auto) => { $crate::SyntaxKind::AUTO_KW }; | ||
345 | (default) => { $crate::SyntaxKind::DEFAULT_KW }; | ||
346 | (existential) => { $crate::SyntaxKind::EXISTENTIAL_KW }; | ||
347 | (union) => { $crate::SyntaxKind::UNION_KW }; | ||
348 | } | ||
349 | |||
350 | impl From<u16> for SyntaxKind { | 244 | impl From<u16> for SyntaxKind { |
351 | fn from(d: u16) -> SyntaxKind { | 245 | fn from(d: u16) -> SyntaxKind { |
352 | assert!(d <= (__LAST as u16)); | 246 | assert!(d <= (__LAST as u16)); |
353 | unsafe { std::mem::transmute::<u16, SyntaxKind>(d) } | 247 | unsafe { std::mem::transmute::<u16, SyntaxKind>(d) } |
354 | } | 248 | } |
355 | } | 249 | } |
356 | |||
357 | impl From<SyntaxKind> for u16 { | 250 | impl From<SyntaxKind> for u16 { |
358 | fn from(k: SyntaxKind) -> u16 { | 251 | fn from(k: SyntaxKind) -> u16 { |
359 | k as u16 | 252 | k as u16 |
360 | } | 253 | } |
361 | } | 254 | } |
362 | |||
363 | impl SyntaxKind { | 255 | impl SyntaxKind { |
364 | pub fn is_keyword(self) -> bool { | 256 | pub fn is_keyword(self) -> bool { |
365 | match self { | 257 | match self { |
366 | | ASYNC_KW | 258 | ASYNC_KW | USE_KW | FN_KW | STRUCT_KW | ENUM_KW | TRAIT_KW | IMPL_KW | DYN_KW |
367 | | USE_KW | 259 | | TRUE_KW | FALSE_KW | AS_KW | EXTERN_KW | CRATE_KW | MOD_KW | PUB_KW | SELF_KW |
368 | | FN_KW | 260 | | SUPER_KW | IN_KW | WHERE_KW | FOR_KW | LOOP_KW | WHILE_KW | CONTINUE_KW |
369 | | STRUCT_KW | 261 | | BREAK_KW | IF_KW | ELSE_KW | MATCH_KW | CONST_KW | STATIC_KW | MUT_KW | UNSAFE_KW |
370 | | ENUM_KW | 262 | | TYPE_KW | REF_KW | LET_KW | MOVE_KW | RETURN_KW | TRY_KW | BOX_KW | AWAIT_KW |
371 | | TRAIT_KW | 263 | | AUTO_KW | DEFAULT_KW | EXISTENTIAL_KW | UNION_KW => true, |
372 | | IMPL_KW | 264 | _ => false, |
373 | | DYN_KW | ||
374 | | TRUE_KW | ||
375 | | FALSE_KW | ||
376 | | AS_KW | ||
377 | | EXTERN_KW | ||
378 | | CRATE_KW | ||
379 | | MOD_KW | ||
380 | | PUB_KW | ||
381 | | SELF_KW | ||
382 | | SUPER_KW | ||
383 | | IN_KW | ||
384 | | WHERE_KW | ||
385 | | FOR_KW | ||
386 | | LOOP_KW | ||
387 | | WHILE_KW | ||
388 | | CONTINUE_KW | ||
389 | | BREAK_KW | ||
390 | | IF_KW | ||
391 | | ELSE_KW | ||
392 | | MATCH_KW | ||
393 | | CONST_KW | ||
394 | | STATIC_KW | ||
395 | | MUT_KW | ||
396 | | UNSAFE_KW | ||
397 | | TYPE_KW | ||
398 | | REF_KW | ||
399 | | LET_KW | ||
400 | | MOVE_KW | ||
401 | | RETURN_KW | ||
402 | | TRY_KW | ||
403 | | BOX_KW | ||
404 | | AWAIT_KW | ||
405 | | AUTO_KW | ||
406 | | DEFAULT_KW | ||
407 | | EXISTENTIAL_KW | ||
408 | | UNION_KW | ||
409 | => true, | ||
410 | _ => false | ||
411 | } | 265 | } |
412 | } | 266 | } |
413 | |||
414 | pub fn is_punct(self) -> bool { | 267 | pub fn is_punct(self) -> bool { |
415 | match self { | 268 | match self { |
416 | | SEMI | 269 | SEMI | COMMA | L_PAREN | R_PAREN | L_CURLY | R_CURLY | L_BRACK | R_BRACK | L_ANGLE |
417 | | COMMA | 270 | | R_ANGLE | AT | POUND | TILDE | QUESTION | DOLLAR | AMP | PIPE | PLUS | STAR |
418 | | L_PAREN | 271 | | SLASH | CARET | PERCENT | UNDERSCORE | DOT | DOTDOT | DOTDOTDOT | DOTDOTEQ |
419 | | R_PAREN | 272 | | COLON | COLONCOLON | EQ | EQEQ | FAT_ARROW | EXCL | NEQ | MINUS | THIN_ARROW |
420 | | L_CURLY | 273 | | LTEQ | GTEQ | PLUSEQ | MINUSEQ | PIPEEQ | AMPEQ | CARETEQ | SLASHEQ | STAREQ |
421 | | R_CURLY | 274 | | PERCENTEQ | AMPAMP | PIPEPIPE | SHL | SHR | SHLEQ | SHREQ => true, |
422 | | L_BRACK | 275 | _ => false, |
423 | | R_BRACK | ||
424 | | L_ANGLE | ||
425 | | R_ANGLE | ||
426 | | AT | ||
427 | | POUND | ||
428 | | TILDE | ||
429 | | QUESTION | ||
430 | | DOLLAR | ||
431 | | AMP | ||
432 | | PIPE | ||
433 | | PLUS | ||
434 | | STAR | ||
435 | | SLASH | ||
436 | | CARET | ||
437 | | PERCENT | ||
438 | | UNDERSCORE | ||
439 | | DOT | ||
440 | | DOTDOT | ||
441 | | DOTDOTDOT | ||
442 | | DOTDOTEQ | ||
443 | | COLON | ||
444 | | COLONCOLON | ||
445 | | EQ | ||
446 | | EQEQ | ||
447 | | FAT_ARROW | ||
448 | | EXCL | ||
449 | | NEQ | ||
450 | | MINUS | ||
451 | | THIN_ARROW | ||
452 | | LTEQ | ||
453 | | GTEQ | ||
454 | | PLUSEQ | ||
455 | | MINUSEQ | ||
456 | | PIPEEQ | ||
457 | | AMPEQ | ||
458 | | CARETEQ | ||
459 | | SLASHEQ | ||
460 | | STAREQ | ||
461 | | PERCENTEQ | ||
462 | | AMPAMP | ||
463 | | PIPEPIPE | ||
464 | | SHL | ||
465 | | SHR | ||
466 | | SHLEQ | ||
467 | | SHREQ | ||
468 | => true, | ||
469 | _ => false | ||
470 | } | 276 | } |
471 | } | 277 | } |
472 | pub fn is_literal(self) -> bool { | 278 | pub fn is_literal(self) -> bool { |
473 | match self { | 279 | match self { |
474 | | INT_NUMBER | 280 | INT_NUMBER | FLOAT_NUMBER | CHAR | BYTE | STRING | RAW_STRING | BYTE_STRING |
475 | | FLOAT_NUMBER | 281 | | RAW_BYTE_STRING => true, |
476 | | CHAR | 282 | _ => false, |
477 | | BYTE | ||
478 | | STRING | ||
479 | | RAW_STRING | ||
480 | | BYTE_STRING | ||
481 | | RAW_BYTE_STRING | ||
482 | => true, | ||
483 | _ => false | ||
484 | } | 283 | } |
485 | } | 284 | } |
486 | |||
487 | pub(crate) fn info(self) -> &'static SyntaxInfo { | 285 | pub(crate) fn info(self) -> &'static SyntaxInfo { |
488 | match self { | 286 | match self { |
489 | SEMI => &SyntaxInfo { name: "SEMI" }, | 287 | SEMI => &SyntaxInfo { name: stringify!(SEMI) }, |
490 | COMMA => &SyntaxInfo { name: "COMMA" }, | 288 | COMMA => &SyntaxInfo { name: stringify!(COMMA) }, |
491 | L_PAREN => &SyntaxInfo { name: "L_PAREN" }, | 289 | L_PAREN => &SyntaxInfo { name: stringify!(L_PAREN) }, |
492 | R_PAREN => &SyntaxInfo { name: "R_PAREN" }, | 290 | R_PAREN => &SyntaxInfo { name: stringify!(R_PAREN) }, |
493 | L_CURLY => &SyntaxInfo { name: "L_CURLY" }, | 291 | L_CURLY => &SyntaxInfo { name: stringify!(L_CURLY) }, |
494 | R_CURLY => &SyntaxInfo { name: "R_CURLY" }, | 292 | R_CURLY => &SyntaxInfo { name: stringify!(R_CURLY) }, |
495 | L_BRACK => &SyntaxInfo { name: "L_BRACK" }, | 293 | L_BRACK => &SyntaxInfo { name: stringify!(L_BRACK) }, |
496 | R_BRACK => &SyntaxInfo { name: "R_BRACK" }, | 294 | R_BRACK => &SyntaxInfo { name: stringify!(R_BRACK) }, |
497 | L_ANGLE => &SyntaxInfo { name: "L_ANGLE" }, | 295 | L_ANGLE => &SyntaxInfo { name: stringify!(L_ANGLE) }, |
498 | R_ANGLE => &SyntaxInfo { name: "R_ANGLE" }, | 296 | R_ANGLE => &SyntaxInfo { name: stringify!(R_ANGLE) }, |
499 | AT => &SyntaxInfo { name: "AT" }, | 297 | AT => &SyntaxInfo { name: stringify!(AT) }, |
500 | POUND => &SyntaxInfo { name: "POUND" }, | 298 | POUND => &SyntaxInfo { name: stringify!(POUND) }, |
501 | TILDE => &SyntaxInfo { name: "TILDE" }, | 299 | TILDE => &SyntaxInfo { name: stringify!(TILDE) }, |
502 | QUESTION => &SyntaxInfo { name: "QUESTION" }, | 300 | QUESTION => &SyntaxInfo { name: stringify!(QUESTION) }, |
503 | DOLLAR => &SyntaxInfo { name: "DOLLAR" }, | 301 | DOLLAR => &SyntaxInfo { name: stringify!(DOLLAR) }, |
504 | AMP => &SyntaxInfo { name: "AMP" }, | 302 | AMP => &SyntaxInfo { name: stringify!(AMP) }, |
505 | PIPE => &SyntaxInfo { name: "PIPE" }, | 303 | PIPE => &SyntaxInfo { name: stringify!(PIPE) }, |
506 | PLUS => &SyntaxInfo { name: "PLUS" }, | 304 | PLUS => &SyntaxInfo { name: stringify!(PLUS) }, |
507 | STAR => &SyntaxInfo { name: "STAR" }, | 305 | STAR => &SyntaxInfo { name: stringify!(STAR) }, |
508 | SLASH => &SyntaxInfo { name: "SLASH" }, | 306 | SLASH => &SyntaxInfo { name: stringify!(SLASH) }, |
509 | CARET => &SyntaxInfo { name: "CARET" }, | 307 | CARET => &SyntaxInfo { name: stringify!(CARET) }, |
510 | PERCENT => &SyntaxInfo { name: "PERCENT" }, | 308 | PERCENT => &SyntaxInfo { name: stringify!(PERCENT) }, |
511 | UNDERSCORE => &SyntaxInfo { name: "UNDERSCORE" }, | 309 | UNDERSCORE => &SyntaxInfo { name: stringify!(UNDERSCORE) }, |
512 | DOT => &SyntaxInfo { name: "DOT" }, | 310 | DOT => &SyntaxInfo { name: stringify!(DOT) }, |
513 | DOTDOT => &SyntaxInfo { name: "DOTDOT" }, | 311 | DOTDOT => &SyntaxInfo { name: stringify!(DOTDOT) }, |
514 | DOTDOTDOT => &SyntaxInfo { name: "DOTDOTDOT" }, | 312 | DOTDOTDOT => &SyntaxInfo { name: stringify!(DOTDOTDOT) }, |
515 | DOTDOTEQ => &SyntaxInfo { name: "DOTDOTEQ" }, | 313 | DOTDOTEQ => &SyntaxInfo { name: stringify!(DOTDOTEQ) }, |
516 | COLON => &SyntaxInfo { name: "COLON" }, | 314 | COLON => &SyntaxInfo { name: stringify!(COLON) }, |
517 | COLONCOLON => &SyntaxInfo { name: "COLONCOLON" }, | 315 | COLONCOLON => &SyntaxInfo { name: stringify!(COLONCOLON) }, |
518 | EQ => &SyntaxInfo { name: "EQ" }, | 316 | EQ => &SyntaxInfo { name: stringify!(EQ) }, |
519 | EQEQ => &SyntaxInfo { name: "EQEQ" }, | 317 | EQEQ => &SyntaxInfo { name: stringify!(EQEQ) }, |
520 | FAT_ARROW => &SyntaxInfo { name: "FAT_ARROW" }, | 318 | FAT_ARROW => &SyntaxInfo { name: stringify!(FAT_ARROW) }, |
521 | EXCL => &SyntaxInfo { name: "EXCL" }, | 319 | EXCL => &SyntaxInfo { name: stringify!(EXCL) }, |
522 | NEQ => &SyntaxInfo { name: "NEQ" }, | 320 | NEQ => &SyntaxInfo { name: stringify!(NEQ) }, |
523 | MINUS => &SyntaxInfo { name: "MINUS" }, | 321 | MINUS => &SyntaxInfo { name: stringify!(MINUS) }, |
524 | THIN_ARROW => &SyntaxInfo { name: "THIN_ARROW" }, | 322 | THIN_ARROW => &SyntaxInfo { name: stringify!(THIN_ARROW) }, |
525 | LTEQ => &SyntaxInfo { name: "LTEQ" }, | 323 | LTEQ => &SyntaxInfo { name: stringify!(LTEQ) }, |
526 | GTEQ => &SyntaxInfo { name: "GTEQ" }, | 324 | GTEQ => &SyntaxInfo { name: stringify!(GTEQ) }, |
527 | PLUSEQ => &SyntaxInfo { name: "PLUSEQ" }, | 325 | PLUSEQ => &SyntaxInfo { name: stringify!(PLUSEQ) }, |
528 | MINUSEQ => &SyntaxInfo { name: "MINUSEQ" }, | 326 | MINUSEQ => &SyntaxInfo { name: stringify!(MINUSEQ) }, |
529 | PIPEEQ => &SyntaxInfo { name: "PIPEEQ" }, | 327 | PIPEEQ => &SyntaxInfo { name: stringify!(PIPEEQ) }, |
530 | AMPEQ => &SyntaxInfo { name: "AMPEQ" }, | 328 | AMPEQ => &SyntaxInfo { name: stringify!(AMPEQ) }, |
531 | CARETEQ => &SyntaxInfo { name: "CARETEQ" }, | 329 | CARETEQ => &SyntaxInfo { name: stringify!(CARETEQ) }, |
532 | SLASHEQ => &SyntaxInfo { name: "SLASHEQ" }, | 330 | SLASHEQ => &SyntaxInfo { name: stringify!(SLASHEQ) }, |
533 | STAREQ => &SyntaxInfo { name: "STAREQ" }, | 331 | STAREQ => &SyntaxInfo { name: stringify!(STAREQ) }, |
534 | PERCENTEQ => &SyntaxInfo { name: "PERCENTEQ" }, | 332 | PERCENTEQ => &SyntaxInfo { name: stringify!(PERCENTEQ) }, |
535 | AMPAMP => &SyntaxInfo { name: "AMPAMP" }, | 333 | AMPAMP => &SyntaxInfo { name: stringify!(AMPAMP) }, |
536 | PIPEPIPE => &SyntaxInfo { name: "PIPEPIPE" }, | 334 | PIPEPIPE => &SyntaxInfo { name: stringify!(PIPEPIPE) }, |
537 | SHL => &SyntaxInfo { name: "SHL" }, | 335 | SHL => &SyntaxInfo { name: stringify!(SHL) }, |
538 | SHR => &SyntaxInfo { name: "SHR" }, | 336 | SHR => &SyntaxInfo { name: stringify!(SHR) }, |
539 | SHLEQ => &SyntaxInfo { name: "SHLEQ" }, | 337 | SHLEQ => &SyntaxInfo { name: stringify!(SHLEQ) }, |
540 | SHREQ => &SyntaxInfo { name: "SHREQ" }, | 338 | SHREQ => &SyntaxInfo { name: stringify!(SHREQ) }, |
541 | ASYNC_KW => &SyntaxInfo { name: "ASYNC_KW" }, | 339 | ASYNC_KW => &SyntaxInfo { name: stringify!(ASYNC_KW) }, |
542 | USE_KW => &SyntaxInfo { name: "USE_KW" }, | 340 | USE_KW => &SyntaxInfo { name: stringify!(USE_KW) }, |
543 | FN_KW => &SyntaxInfo { name: "FN_KW" }, | 341 | FN_KW => &SyntaxInfo { name: stringify!(FN_KW) }, |
544 | STRUCT_KW => &SyntaxInfo { name: "STRUCT_KW" }, | 342 | STRUCT_KW => &SyntaxInfo { name: stringify!(STRUCT_KW) }, |
545 | ENUM_KW => &SyntaxInfo { name: "ENUM_KW" }, | 343 | ENUM_KW => &SyntaxInfo { name: stringify!(ENUM_KW) }, |
546 | TRAIT_KW => &SyntaxInfo { name: "TRAIT_KW" }, | 344 | TRAIT_KW => &SyntaxInfo { name: stringify!(TRAIT_KW) }, |
547 | IMPL_KW => &SyntaxInfo { name: "IMPL_KW" }, | 345 | IMPL_KW => &SyntaxInfo { name: stringify!(IMPL_KW) }, |
548 | DYN_KW => &SyntaxInfo { name: "DYN_KW" }, | 346 | DYN_KW => &SyntaxInfo { name: stringify!(DYN_KW) }, |
549 | TRUE_KW => &SyntaxInfo { name: "TRUE_KW" }, | 347 | TRUE_KW => &SyntaxInfo { name: stringify!(TRUE_KW) }, |
550 | FALSE_KW => &SyntaxInfo { name: "FALSE_KW" }, | 348 | FALSE_KW => &SyntaxInfo { name: stringify!(FALSE_KW) }, |
551 | AS_KW => &SyntaxInfo { name: "AS_KW" }, | 349 | AS_KW => &SyntaxInfo { name: stringify!(AS_KW) }, |
552 | EXTERN_KW => &SyntaxInfo { name: "EXTERN_KW" }, | 350 | EXTERN_KW => &SyntaxInfo { name: stringify!(EXTERN_KW) }, |
553 | CRATE_KW => &SyntaxInfo { name: "CRATE_KW" }, | 351 | CRATE_KW => &SyntaxInfo { name: stringify!(CRATE_KW) }, |
554 | MOD_KW => &SyntaxInfo { name: "MOD_KW" }, | 352 | MOD_KW => &SyntaxInfo { name: stringify!(MOD_KW) }, |
555 | PUB_KW => &SyntaxInfo { name: "PUB_KW" }, | 353 | PUB_KW => &SyntaxInfo { name: stringify!(PUB_KW) }, |
556 | SELF_KW => &SyntaxInfo { name: "SELF_KW" }, | 354 | SELF_KW => &SyntaxInfo { name: stringify!(SELF_KW) }, |
557 | SUPER_KW => &SyntaxInfo { name: "SUPER_KW" }, | 355 | SUPER_KW => &SyntaxInfo { name: stringify!(SUPER_KW) }, |
558 | IN_KW => &SyntaxInfo { name: "IN_KW" }, | 356 | IN_KW => &SyntaxInfo { name: stringify!(IN_KW) }, |
559 | WHERE_KW => &SyntaxInfo { name: "WHERE_KW" }, | 357 | WHERE_KW => &SyntaxInfo { name: stringify!(WHERE_KW) }, |
560 | FOR_KW => &SyntaxInfo { name: "FOR_KW" }, | 358 | FOR_KW => &SyntaxInfo { name: stringify!(FOR_KW) }, |
561 | LOOP_KW => &SyntaxInfo { name: "LOOP_KW" }, | 359 | LOOP_KW => &SyntaxInfo { name: stringify!(LOOP_KW) }, |
562 | WHILE_KW => &SyntaxInfo { name: "WHILE_KW" }, | 360 | WHILE_KW => &SyntaxInfo { name: stringify!(WHILE_KW) }, |
563 | CONTINUE_KW => &SyntaxInfo { name: "CONTINUE_KW" }, | 361 | CONTINUE_KW => &SyntaxInfo { name: stringify!(CONTINUE_KW) }, |
564 | BREAK_KW => &SyntaxInfo { name: "BREAK_KW" }, | 362 | BREAK_KW => &SyntaxInfo { name: stringify!(BREAK_KW) }, |
565 | IF_KW => &SyntaxInfo { name: "IF_KW" }, | 363 | IF_KW => &SyntaxInfo { name: stringify!(IF_KW) }, |
566 | ELSE_KW => &SyntaxInfo { name: "ELSE_KW" }, | 364 | ELSE_KW => &SyntaxInfo { name: stringify!(ELSE_KW) }, |
567 | MATCH_KW => &SyntaxInfo { name: "MATCH_KW" }, | 365 | MATCH_KW => &SyntaxInfo { name: stringify!(MATCH_KW) }, |
568 | CONST_KW => &SyntaxInfo { name: "CONST_KW" }, | 366 | CONST_KW => &SyntaxInfo { name: stringify!(CONST_KW) }, |
569 | STATIC_KW => &SyntaxInfo { name: "STATIC_KW" }, | 367 | STATIC_KW => &SyntaxInfo { name: stringify!(STATIC_KW) }, |
570 | MUT_KW => &SyntaxInfo { name: "MUT_KW" }, | 368 | MUT_KW => &SyntaxInfo { name: stringify!(MUT_KW) }, |
571 | UNSAFE_KW => &SyntaxInfo { name: "UNSAFE_KW" }, | 369 | UNSAFE_KW => &SyntaxInfo { name: stringify!(UNSAFE_KW) }, |
572 | TYPE_KW => &SyntaxInfo { name: "TYPE_KW" }, | 370 | TYPE_KW => &SyntaxInfo { name: stringify!(TYPE_KW) }, |
573 | REF_KW => &SyntaxInfo { name: "REF_KW" }, | 371 | REF_KW => &SyntaxInfo { name: stringify!(REF_KW) }, |
574 | LET_KW => &SyntaxInfo { name: "LET_KW" }, | 372 | LET_KW => &SyntaxInfo { name: stringify!(LET_KW) }, |
575 | MOVE_KW => &SyntaxInfo { name: "MOVE_KW" }, | 373 | MOVE_KW => &SyntaxInfo { name: stringify!(MOVE_KW) }, |
576 | RETURN_KW => &SyntaxInfo { name: "RETURN_KW" }, | 374 | RETURN_KW => &SyntaxInfo { name: stringify!(RETURN_KW) }, |
577 | TRY_KW => &SyntaxInfo { name: "TRY_KW" }, | 375 | TRY_KW => &SyntaxInfo { name: stringify!(TRY_KW) }, |
578 | BOX_KW => &SyntaxInfo { name: "BOX_KW" }, | 376 | BOX_KW => &SyntaxInfo { name: stringify!(BOX_KW) }, |
579 | AWAIT_KW => &SyntaxInfo { name: "AWAIT_KW" }, | 377 | AWAIT_KW => &SyntaxInfo { name: stringify!(AWAIT_KW) }, |
580 | AUTO_KW => &SyntaxInfo { name: "AUTO_KW" }, | 378 | AUTO_KW => &SyntaxInfo { name: stringify!(AUTO_KW) }, |
581 | DEFAULT_KW => &SyntaxInfo { name: "DEFAULT_KW" }, | 379 | DEFAULT_KW => &SyntaxInfo { name: stringify!(DEFAULT_KW) }, |
582 | EXISTENTIAL_KW => &SyntaxInfo { name: "EXISTENTIAL_KW" }, | 380 | EXISTENTIAL_KW => &SyntaxInfo { name: stringify!(EXISTENTIAL_KW) }, |
583 | UNION_KW => &SyntaxInfo { name: "UNION_KW" }, | 381 | UNION_KW => &SyntaxInfo { name: stringify!(UNION_KW) }, |
584 | INT_NUMBER => &SyntaxInfo { name: "INT_NUMBER" }, | 382 | INT_NUMBER => &SyntaxInfo { name: stringify!(INT_NUMBER) }, |
585 | FLOAT_NUMBER => &SyntaxInfo { name: "FLOAT_NUMBER" }, | 383 | FLOAT_NUMBER => &SyntaxInfo { name: stringify!(FLOAT_NUMBER) }, |
586 | CHAR => &SyntaxInfo { name: "CHAR" }, | 384 | CHAR => &SyntaxInfo { name: stringify!(CHAR) }, |
587 | BYTE => &SyntaxInfo { name: "BYTE" }, | 385 | BYTE => &SyntaxInfo { name: stringify!(BYTE) }, |
588 | STRING => &SyntaxInfo { name: "STRING" }, | 386 | STRING => &SyntaxInfo { name: stringify!(STRING) }, |
589 | RAW_STRING => &SyntaxInfo { name: "RAW_STRING" }, | 387 | RAW_STRING => &SyntaxInfo { name: stringify!(RAW_STRING) }, |
590 | BYTE_STRING => &SyntaxInfo { name: "BYTE_STRING" }, | 388 | BYTE_STRING => &SyntaxInfo { name: stringify!(BYTE_STRING) }, |
591 | RAW_BYTE_STRING => &SyntaxInfo { name: "RAW_BYTE_STRING" }, | 389 | RAW_BYTE_STRING => &SyntaxInfo { name: stringify!(RAW_BYTE_STRING) }, |
592 | ERROR => &SyntaxInfo { name: "ERROR" }, | 390 | ERROR => &SyntaxInfo { name: stringify!(ERROR) }, |
593 | IDENT => &SyntaxInfo { name: "IDENT" }, | 391 | IDENT => &SyntaxInfo { name: stringify!(IDENT) }, |
594 | WHITESPACE => &SyntaxInfo { name: "WHITESPACE" }, | 392 | WHITESPACE => &SyntaxInfo { name: stringify!(WHITESPACE) }, |
595 | LIFETIME => &SyntaxInfo { name: "LIFETIME" }, | 393 | LIFETIME => &SyntaxInfo { name: stringify!(LIFETIME) }, |
596 | COMMENT => &SyntaxInfo { name: "COMMENT" }, | 394 | COMMENT => &SyntaxInfo { name: stringify!(COMMENT) }, |
597 | SHEBANG => &SyntaxInfo { name: "SHEBANG" }, | 395 | SHEBANG => &SyntaxInfo { name: stringify!(SHEBANG) }, |
598 | L_DOLLAR => &SyntaxInfo { name: "L_DOLLAR" }, | 396 | L_DOLLAR => &SyntaxInfo { name: stringify!(L_DOLLAR) }, |
599 | R_DOLLAR => &SyntaxInfo { name: "R_DOLLAR" }, | 397 | R_DOLLAR => &SyntaxInfo { name: stringify!(R_DOLLAR) }, |
600 | SOURCE_FILE => &SyntaxInfo { name: "SOURCE_FILE" }, | 398 | SOURCE_FILE => &SyntaxInfo { name: stringify!(SOURCE_FILE) }, |
601 | STRUCT_DEF => &SyntaxInfo { name: "STRUCT_DEF" }, | 399 | STRUCT_DEF => &SyntaxInfo { name: stringify!(STRUCT_DEF) }, |
602 | ENUM_DEF => &SyntaxInfo { name: "ENUM_DEF" }, | 400 | ENUM_DEF => &SyntaxInfo { name: stringify!(ENUM_DEF) }, |
603 | FN_DEF => &SyntaxInfo { name: "FN_DEF" }, | 401 | FN_DEF => &SyntaxInfo { name: stringify!(FN_DEF) }, |
604 | RET_TYPE => &SyntaxInfo { name: "RET_TYPE" }, | 402 | RET_TYPE => &SyntaxInfo { name: stringify!(RET_TYPE) }, |
605 | EXTERN_CRATE_ITEM => &SyntaxInfo { name: "EXTERN_CRATE_ITEM" }, | 403 | EXTERN_CRATE_ITEM => &SyntaxInfo { name: stringify!(EXTERN_CRATE_ITEM) }, |
606 | MODULE => &SyntaxInfo { name: "MODULE" }, | 404 | MODULE => &SyntaxInfo { name: stringify!(MODULE) }, |
607 | USE_ITEM => &SyntaxInfo { name: "USE_ITEM" }, | 405 | USE_ITEM => &SyntaxInfo { name: stringify!(USE_ITEM) }, |
608 | STATIC_DEF => &SyntaxInfo { name: "STATIC_DEF" }, | 406 | STATIC_DEF => &SyntaxInfo { name: stringify!(STATIC_DEF) }, |
609 | CONST_DEF => &SyntaxInfo { name: "CONST_DEF" }, | 407 | CONST_DEF => &SyntaxInfo { name: stringify!(CONST_DEF) }, |
610 | TRAIT_DEF => &SyntaxInfo { name: "TRAIT_DEF" }, | 408 | TRAIT_DEF => &SyntaxInfo { name: stringify!(TRAIT_DEF) }, |
611 | IMPL_BLOCK => &SyntaxInfo { name: "IMPL_BLOCK" }, | 409 | IMPL_BLOCK => &SyntaxInfo { name: stringify!(IMPL_BLOCK) }, |
612 | TYPE_ALIAS_DEF => &SyntaxInfo { name: "TYPE_ALIAS_DEF" }, | 410 | TYPE_ALIAS_DEF => &SyntaxInfo { name: stringify!(TYPE_ALIAS_DEF) }, |
613 | MACRO_CALL => &SyntaxInfo { name: "MACRO_CALL" }, | 411 | MACRO_CALL => &SyntaxInfo { name: stringify!(MACRO_CALL) }, |
614 | TOKEN_TREE => &SyntaxInfo { name: "TOKEN_TREE" }, | 412 | TOKEN_TREE => &SyntaxInfo { name: stringify!(TOKEN_TREE) }, |
615 | PAREN_TYPE => &SyntaxInfo { name: "PAREN_TYPE" }, | 413 | PAREN_TYPE => &SyntaxInfo { name: stringify!(PAREN_TYPE) }, |
616 | TUPLE_TYPE => &SyntaxInfo { name: "TUPLE_TYPE" }, | 414 | TUPLE_TYPE => &SyntaxInfo { name: stringify!(TUPLE_TYPE) }, |
617 | NEVER_TYPE => &SyntaxInfo { name: "NEVER_TYPE" }, | 415 | NEVER_TYPE => &SyntaxInfo { name: stringify!(NEVER_TYPE) }, |
618 | PATH_TYPE => &SyntaxInfo { name: "PATH_TYPE" }, | 416 | PATH_TYPE => &SyntaxInfo { name: stringify!(PATH_TYPE) }, |
619 | POINTER_TYPE => &SyntaxInfo { name: "POINTER_TYPE" }, | 417 | POINTER_TYPE => &SyntaxInfo { name: stringify!(POINTER_TYPE) }, |
620 | ARRAY_TYPE => &SyntaxInfo { name: "ARRAY_TYPE" }, | 418 | ARRAY_TYPE => &SyntaxInfo { name: stringify!(ARRAY_TYPE) }, |
621 | SLICE_TYPE => &SyntaxInfo { name: "SLICE_TYPE" }, | 419 | SLICE_TYPE => &SyntaxInfo { name: stringify!(SLICE_TYPE) }, |
622 | REFERENCE_TYPE => &SyntaxInfo { name: "REFERENCE_TYPE" }, | 420 | REFERENCE_TYPE => &SyntaxInfo { name: stringify!(REFERENCE_TYPE) }, |
623 | PLACEHOLDER_TYPE => &SyntaxInfo { name: "PLACEHOLDER_TYPE" }, | 421 | PLACEHOLDER_TYPE => &SyntaxInfo { name: stringify!(PLACEHOLDER_TYPE) }, |
624 | FN_POINTER_TYPE => &SyntaxInfo { name: "FN_POINTER_TYPE" }, | 422 | FN_POINTER_TYPE => &SyntaxInfo { name: stringify!(FN_POINTER_TYPE) }, |
625 | FOR_TYPE => &SyntaxInfo { name: "FOR_TYPE" }, | 423 | FOR_TYPE => &SyntaxInfo { name: stringify!(FOR_TYPE) }, |
626 | IMPL_TRAIT_TYPE => &SyntaxInfo { name: "IMPL_TRAIT_TYPE" }, | 424 | IMPL_TRAIT_TYPE => &SyntaxInfo { name: stringify!(IMPL_TRAIT_TYPE) }, |
627 | DYN_TRAIT_TYPE => &SyntaxInfo { name: "DYN_TRAIT_TYPE" }, | 425 | DYN_TRAIT_TYPE => &SyntaxInfo { name: stringify!(DYN_TRAIT_TYPE) }, |
628 | REF_PAT => &SyntaxInfo { name: "REF_PAT" }, | 426 | REF_PAT => &SyntaxInfo { name: stringify!(REF_PAT) }, |
629 | BIND_PAT => &SyntaxInfo { name: "BIND_PAT" }, | 427 | BIND_PAT => &SyntaxInfo { name: stringify!(BIND_PAT) }, |
630 | PLACEHOLDER_PAT => &SyntaxInfo { name: "PLACEHOLDER_PAT" }, | 428 | PLACEHOLDER_PAT => &SyntaxInfo { name: stringify!(PLACEHOLDER_PAT) }, |
631 | PATH_PAT => &SyntaxInfo { name: "PATH_PAT" }, | 429 | PATH_PAT => &SyntaxInfo { name: stringify!(PATH_PAT) }, |
632 | STRUCT_PAT => &SyntaxInfo { name: "STRUCT_PAT" }, | 430 | STRUCT_PAT => &SyntaxInfo { name: stringify!(STRUCT_PAT) }, |
633 | FIELD_PAT_LIST => &SyntaxInfo { name: "FIELD_PAT_LIST" }, | 431 | FIELD_PAT_LIST => &SyntaxInfo { name: stringify!(FIELD_PAT_LIST) }, |
634 | FIELD_PAT => &SyntaxInfo { name: "FIELD_PAT" }, | 432 | FIELD_PAT => &SyntaxInfo { name: stringify!(FIELD_PAT) }, |
635 | TUPLE_STRUCT_PAT => &SyntaxInfo { name: "TUPLE_STRUCT_PAT" }, | 433 | TUPLE_STRUCT_PAT => &SyntaxInfo { name: stringify!(TUPLE_STRUCT_PAT) }, |
636 | TUPLE_PAT => &SyntaxInfo { name: "TUPLE_PAT" }, | 434 | TUPLE_PAT => &SyntaxInfo { name: stringify!(TUPLE_PAT) }, |
637 | SLICE_PAT => &SyntaxInfo { name: "SLICE_PAT" }, | 435 | SLICE_PAT => &SyntaxInfo { name: stringify!(SLICE_PAT) }, |
638 | RANGE_PAT => &SyntaxInfo { name: "RANGE_PAT" }, | 436 | RANGE_PAT => &SyntaxInfo { name: stringify!(RANGE_PAT) }, |
639 | LITERAL_PAT => &SyntaxInfo { name: "LITERAL_PAT" }, | 437 | LITERAL_PAT => &SyntaxInfo { name: stringify!(LITERAL_PAT) }, |
640 | TUPLE_EXPR => &SyntaxInfo { name: "TUPLE_EXPR" }, | 438 | TUPLE_EXPR => &SyntaxInfo { name: stringify!(TUPLE_EXPR) }, |
641 | ARRAY_EXPR => &SyntaxInfo { name: "ARRAY_EXPR" }, | 439 | ARRAY_EXPR => &SyntaxInfo { name: stringify!(ARRAY_EXPR) }, |
642 | PAREN_EXPR => &SyntaxInfo { name: "PAREN_EXPR" }, | 440 | PAREN_EXPR => &SyntaxInfo { name: stringify!(PAREN_EXPR) }, |
643 | PATH_EXPR => &SyntaxInfo { name: "PATH_EXPR" }, | 441 | PATH_EXPR => &SyntaxInfo { name: stringify!(PATH_EXPR) }, |
644 | LAMBDA_EXPR => &SyntaxInfo { name: "LAMBDA_EXPR" }, | 442 | LAMBDA_EXPR => &SyntaxInfo { name: stringify!(LAMBDA_EXPR) }, |
645 | IF_EXPR => &SyntaxInfo { name: "IF_EXPR" }, | 443 | IF_EXPR => &SyntaxInfo { name: stringify!(IF_EXPR) }, |
646 | WHILE_EXPR => &SyntaxInfo { name: "WHILE_EXPR" }, | 444 | WHILE_EXPR => &SyntaxInfo { name: stringify!(WHILE_EXPR) }, |
647 | CONDITION => &SyntaxInfo { name: "CONDITION" }, | 445 | CONDITION => &SyntaxInfo { name: stringify!(CONDITION) }, |
648 | LOOP_EXPR => &SyntaxInfo { name: "LOOP_EXPR" }, | 446 | LOOP_EXPR => &SyntaxInfo { name: stringify!(LOOP_EXPR) }, |
649 | FOR_EXPR => &SyntaxInfo { name: "FOR_EXPR" }, | 447 | FOR_EXPR => &SyntaxInfo { name: stringify!(FOR_EXPR) }, |
650 | CONTINUE_EXPR => &SyntaxInfo { name: "CONTINUE_EXPR" }, | 448 | CONTINUE_EXPR => &SyntaxInfo { name: stringify!(CONTINUE_EXPR) }, |
651 | BREAK_EXPR => &SyntaxInfo { name: "BREAK_EXPR" }, | 449 | BREAK_EXPR => &SyntaxInfo { name: stringify!(BREAK_EXPR) }, |
652 | LABEL => &SyntaxInfo { name: "LABEL" }, | 450 | LABEL => &SyntaxInfo { name: stringify!(LABEL) }, |
653 | BLOCK_EXPR => &SyntaxInfo { name: "BLOCK_EXPR" }, | 451 | BLOCK_EXPR => &SyntaxInfo { name: stringify!(BLOCK_EXPR) }, |
654 | RETURN_EXPR => &SyntaxInfo { name: "RETURN_EXPR" }, | 452 | RETURN_EXPR => &SyntaxInfo { name: stringify!(RETURN_EXPR) }, |
655 | MATCH_EXPR => &SyntaxInfo { name: "MATCH_EXPR" }, | 453 | MATCH_EXPR => &SyntaxInfo { name: stringify!(MATCH_EXPR) }, |
656 | MATCH_ARM_LIST => &SyntaxInfo { name: "MATCH_ARM_LIST" }, | 454 | MATCH_ARM_LIST => &SyntaxInfo { name: stringify!(MATCH_ARM_LIST) }, |
657 | MATCH_ARM => &SyntaxInfo { name: "MATCH_ARM" }, | 455 | MATCH_ARM => &SyntaxInfo { name: stringify!(MATCH_ARM) }, |
658 | MATCH_GUARD => &SyntaxInfo { name: "MATCH_GUARD" }, | 456 | MATCH_GUARD => &SyntaxInfo { name: stringify!(MATCH_GUARD) }, |
659 | STRUCT_LIT => &SyntaxInfo { name: "STRUCT_LIT" }, | 457 | STRUCT_LIT => &SyntaxInfo { name: stringify!(STRUCT_LIT) }, |
660 | NAMED_FIELD_LIST => &SyntaxInfo { name: "NAMED_FIELD_LIST" }, | 458 | NAMED_FIELD_LIST => &SyntaxInfo { name: stringify!(NAMED_FIELD_LIST) }, |
661 | NAMED_FIELD => &SyntaxInfo { name: "NAMED_FIELD" }, | 459 | NAMED_FIELD => &SyntaxInfo { name: stringify!(NAMED_FIELD) }, |
662 | TRY_BLOCK_EXPR => &SyntaxInfo { name: "TRY_BLOCK_EXPR" }, | 460 | TRY_BLOCK_EXPR => &SyntaxInfo { name: stringify!(TRY_BLOCK_EXPR) }, |
663 | BOX_EXPR => &SyntaxInfo { name: "BOX_EXPR" }, | 461 | BOX_EXPR => &SyntaxInfo { name: stringify!(BOX_EXPR) }, |
664 | CALL_EXPR => &SyntaxInfo { name: "CALL_EXPR" }, | 462 | CALL_EXPR => &SyntaxInfo { name: stringify!(CALL_EXPR) }, |
665 | INDEX_EXPR => &SyntaxInfo { name: "INDEX_EXPR" }, | 463 | INDEX_EXPR => &SyntaxInfo { name: stringify!(INDEX_EXPR) }, |
666 | METHOD_CALL_EXPR => &SyntaxInfo { name: "METHOD_CALL_EXPR" }, | 464 | METHOD_CALL_EXPR => &SyntaxInfo { name: stringify!(METHOD_CALL_EXPR) }, |
667 | FIELD_EXPR => &SyntaxInfo { name: "FIELD_EXPR" }, | 465 | FIELD_EXPR => &SyntaxInfo { name: stringify!(FIELD_EXPR) }, |
668 | AWAIT_EXPR => &SyntaxInfo { name: "AWAIT_EXPR" }, | 466 | AWAIT_EXPR => &SyntaxInfo { name: stringify!(AWAIT_EXPR) }, |
669 | TRY_EXPR => &SyntaxInfo { name: "TRY_EXPR" }, | 467 | TRY_EXPR => &SyntaxInfo { name: stringify!(TRY_EXPR) }, |
670 | CAST_EXPR => &SyntaxInfo { name: "CAST_EXPR" }, | 468 | CAST_EXPR => &SyntaxInfo { name: stringify!(CAST_EXPR) }, |
671 | REF_EXPR => &SyntaxInfo { name: "REF_EXPR" }, | 469 | REF_EXPR => &SyntaxInfo { name: stringify!(REF_EXPR) }, |
672 | PREFIX_EXPR => &SyntaxInfo { name: "PREFIX_EXPR" }, | 470 | PREFIX_EXPR => &SyntaxInfo { name: stringify!(PREFIX_EXPR) }, |
673 | RANGE_EXPR => &SyntaxInfo { name: "RANGE_EXPR" }, | 471 | RANGE_EXPR => &SyntaxInfo { name: stringify!(RANGE_EXPR) }, |
674 | BIN_EXPR => &SyntaxInfo { name: "BIN_EXPR" }, | 472 | BIN_EXPR => &SyntaxInfo { name: stringify!(BIN_EXPR) }, |
675 | BLOCK => &SyntaxInfo { name: "BLOCK" }, | 473 | BLOCK => &SyntaxInfo { name: stringify!(BLOCK) }, |
676 | EXTERN_BLOCK => &SyntaxInfo { name: "EXTERN_BLOCK" }, | 474 | EXTERN_BLOCK => &SyntaxInfo { name: stringify!(EXTERN_BLOCK) }, |
677 | EXTERN_ITEM_LIST => &SyntaxInfo { name: "EXTERN_ITEM_LIST" }, | 475 | EXTERN_ITEM_LIST => &SyntaxInfo { name: stringify!(EXTERN_ITEM_LIST) }, |
678 | ENUM_VARIANT => &SyntaxInfo { name: "ENUM_VARIANT" }, | 476 | ENUM_VARIANT => &SyntaxInfo { name: stringify!(ENUM_VARIANT) }, |
679 | NAMED_FIELD_DEF_LIST => &SyntaxInfo { name: "NAMED_FIELD_DEF_LIST" }, | 477 | NAMED_FIELD_DEF_LIST => &SyntaxInfo { name: stringify!(NAMED_FIELD_DEF_LIST) }, |
680 | NAMED_FIELD_DEF => &SyntaxInfo { name: "NAMED_FIELD_DEF" }, | 478 | NAMED_FIELD_DEF => &SyntaxInfo { name: stringify!(NAMED_FIELD_DEF) }, |
681 | POS_FIELD_DEF_LIST => &SyntaxInfo { name: "POS_FIELD_DEF_LIST" }, | 479 | POS_FIELD_DEF_LIST => &SyntaxInfo { name: stringify!(POS_FIELD_DEF_LIST) }, |
682 | POS_FIELD_DEF => &SyntaxInfo { name: "POS_FIELD_DEF" }, | 480 | POS_FIELD_DEF => &SyntaxInfo { name: stringify!(POS_FIELD_DEF) }, |
683 | ENUM_VARIANT_LIST => &SyntaxInfo { name: "ENUM_VARIANT_LIST" }, | 481 | ENUM_VARIANT_LIST => &SyntaxInfo { name: stringify!(ENUM_VARIANT_LIST) }, |
684 | ITEM_LIST => &SyntaxInfo { name: "ITEM_LIST" }, | 482 | ITEM_LIST => &SyntaxInfo { name: stringify!(ITEM_LIST) }, |
685 | ATTR => &SyntaxInfo { name: "ATTR" }, | 483 | ATTR => &SyntaxInfo { name: stringify!(ATTR) }, |
686 | META_ITEM => &SyntaxInfo { name: "META_ITEM" }, | 484 | META_ITEM => &SyntaxInfo { name: stringify!(META_ITEM) }, |
687 | USE_TREE => &SyntaxInfo { name: "USE_TREE" }, | 485 | USE_TREE => &SyntaxInfo { name: stringify!(USE_TREE) }, |
688 | USE_TREE_LIST => &SyntaxInfo { name: "USE_TREE_LIST" }, | 486 | USE_TREE_LIST => &SyntaxInfo { name: stringify!(USE_TREE_LIST) }, |
689 | PATH => &SyntaxInfo { name: "PATH" }, | 487 | PATH => &SyntaxInfo { name: stringify!(PATH) }, |
690 | PATH_SEGMENT => &SyntaxInfo { name: "PATH_SEGMENT" }, | 488 | PATH_SEGMENT => &SyntaxInfo { name: stringify!(PATH_SEGMENT) }, |
691 | LITERAL => &SyntaxInfo { name: "LITERAL" }, | 489 | LITERAL => &SyntaxInfo { name: stringify!(LITERAL) }, |
692 | ALIAS => &SyntaxInfo { name: "ALIAS" }, | 490 | ALIAS => &SyntaxInfo { name: stringify!(ALIAS) }, |
693 | VISIBILITY => &SyntaxInfo { name: "VISIBILITY" }, | 491 | VISIBILITY => &SyntaxInfo { name: stringify!(VISIBILITY) }, |
694 | WHERE_CLAUSE => &SyntaxInfo { name: "WHERE_CLAUSE" }, | 492 | WHERE_CLAUSE => &SyntaxInfo { name: stringify!(WHERE_CLAUSE) }, |
695 | WHERE_PRED => &SyntaxInfo { name: "WHERE_PRED" }, | 493 | WHERE_PRED => &SyntaxInfo { name: stringify!(WHERE_PRED) }, |
696 | ABI => &SyntaxInfo { name: "ABI" }, | 494 | ABI => &SyntaxInfo { name: stringify!(ABI) }, |
697 | NAME => &SyntaxInfo { name: "NAME" }, | 495 | NAME => &SyntaxInfo { name: stringify!(NAME) }, |
698 | NAME_REF => &SyntaxInfo { name: "NAME_REF" }, | 496 | NAME_REF => &SyntaxInfo { name: stringify!(NAME_REF) }, |
699 | LET_STMT => &SyntaxInfo { name: "LET_STMT" }, | 497 | LET_STMT => &SyntaxInfo { name: stringify!(LET_STMT) }, |
700 | EXPR_STMT => &SyntaxInfo { name: "EXPR_STMT" }, | 498 | EXPR_STMT => &SyntaxInfo { name: stringify!(EXPR_STMT) }, |
701 | TYPE_PARAM_LIST => &SyntaxInfo { name: "TYPE_PARAM_LIST" }, | 499 | TYPE_PARAM_LIST => &SyntaxInfo { name: stringify!(TYPE_PARAM_LIST) }, |
702 | LIFETIME_PARAM => &SyntaxInfo { name: "LIFETIME_PARAM" }, | 500 | LIFETIME_PARAM => &SyntaxInfo { name: stringify!(LIFETIME_PARAM) }, |
703 | TYPE_PARAM => &SyntaxInfo { name: "TYPE_PARAM" }, | 501 | TYPE_PARAM => &SyntaxInfo { name: stringify!(TYPE_PARAM) }, |
704 | TYPE_ARG_LIST => &SyntaxInfo { name: "TYPE_ARG_LIST" }, | 502 | TYPE_ARG_LIST => &SyntaxInfo { name: stringify!(TYPE_ARG_LIST) }, |
705 | LIFETIME_ARG => &SyntaxInfo { name: "LIFETIME_ARG" }, | 503 | LIFETIME_ARG => &SyntaxInfo { name: stringify!(LIFETIME_ARG) }, |
706 | TYPE_ARG => &SyntaxInfo { name: "TYPE_ARG" }, | 504 | TYPE_ARG => &SyntaxInfo { name: stringify!(TYPE_ARG) }, |
707 | ASSOC_TYPE_ARG => &SyntaxInfo { name: "ASSOC_TYPE_ARG" }, | 505 | ASSOC_TYPE_ARG => &SyntaxInfo { name: stringify!(ASSOC_TYPE_ARG) }, |
708 | PARAM_LIST => &SyntaxInfo { name: "PARAM_LIST" }, | 506 | PARAM_LIST => &SyntaxInfo { name: stringify!(PARAM_LIST) }, |
709 | PARAM => &SyntaxInfo { name: "PARAM" }, | 507 | PARAM => &SyntaxInfo { name: stringify!(PARAM) }, |
710 | SELF_PARAM => &SyntaxInfo { name: "SELF_PARAM" }, | 508 | SELF_PARAM => &SyntaxInfo { name: stringify!(SELF_PARAM) }, |
711 | ARG_LIST => &SyntaxInfo { name: "ARG_LIST" }, | 509 | ARG_LIST => &SyntaxInfo { name: stringify!(ARG_LIST) }, |
712 | TYPE_BOUND => &SyntaxInfo { name: "TYPE_BOUND" }, | 510 | TYPE_BOUND => &SyntaxInfo { name: stringify!(TYPE_BOUND) }, |
713 | TYPE_BOUND_LIST => &SyntaxInfo { name: "TYPE_BOUND_LIST" }, | 511 | TYPE_BOUND_LIST => &SyntaxInfo { name: stringify!(TYPE_BOUND_LIST) }, |
714 | MACRO_ITEMS => &SyntaxInfo { name: "MACRO_ITEMS" }, | 512 | MACRO_ITEMS => &SyntaxInfo { name: stringify!(MACRO_ITEMS) }, |
715 | MACRO_STMTS => &SyntaxInfo { name: "MACRO_STMTS" }, | 513 | MACRO_STMTS => &SyntaxInfo { name: stringify!(MACRO_STMTS) }, |
716 | TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" }, | 514 | TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" }, |
717 | EOF => &SyntaxInfo { name: "EOF" }, | 515 | EOF => &SyntaxInfo { name: "EOF" }, |
718 | __LAST => &SyntaxInfo { name: "__LAST" }, | 516 | __LAST => &SyntaxInfo { name: "__LAST" }, |
@@ -759,11 +557,14 @@ impl SyntaxKind { | |||
759 | "try" => TRY_KW, | 557 | "try" => TRY_KW, |
760 | "box" => BOX_KW, | 558 | "box" => BOX_KW, |
761 | "await" => AWAIT_KW, | 559 | "await" => AWAIT_KW, |
560 | "auto" => AUTO_KW, | ||
561 | "default" => DEFAULT_KW, | ||
562 | "existential" => EXISTENTIAL_KW, | ||
563 | "union" => UNION_KW, | ||
762 | _ => return None, | 564 | _ => return None, |
763 | }; | 565 | }; |
764 | Some(kw) | 566 | Some(kw) |
765 | } | 567 | } |
766 | |||
767 | pub fn from_char(c: char) -> Option<SyntaxKind> { | 568 | pub fn from_char(c: char) -> Option<SyntaxKind> { |
768 | let tok = match c { | 569 | let tok = match c { |
769 | ';' => SEMI, | 570 | ';' => SEMI, |
@@ -794,3 +595,291 @@ impl SyntaxKind { | |||
794 | Some(tok) | 595 | Some(tok) |
795 | } | 596 | } |
796 | } | 597 | } |
598 | #[macro_export] | ||
599 | macro_rules! T { | ||
600 | ( ; ) => { | ||
601 | $crate::SyntaxKind::SEMI | ||
602 | }; | ||
603 | ( , ) => { | ||
604 | $crate::SyntaxKind::COMMA | ||
605 | }; | ||
606 | ( '(' ) => { | ||
607 | $crate::SyntaxKind::L_PAREN | ||
608 | }; | ||
609 | ( ')' ) => { | ||
610 | $crate::SyntaxKind::R_PAREN | ||
611 | }; | ||
612 | ( '{' ) => { | ||
613 | $crate::SyntaxKind::L_CURLY | ||
614 | }; | ||
615 | ( '}' ) => { | ||
616 | $crate::SyntaxKind::R_CURLY | ||
617 | }; | ||
618 | ( '[' ) => { | ||
619 | $crate::SyntaxKind::L_BRACK | ||
620 | }; | ||
621 | ( ']' ) => { | ||
622 | $crate::SyntaxKind::R_BRACK | ||
623 | }; | ||
624 | ( < ) => { | ||
625 | $crate::SyntaxKind::L_ANGLE | ||
626 | }; | ||
627 | ( > ) => { | ||
628 | $crate::SyntaxKind::R_ANGLE | ||
629 | }; | ||
630 | ( @ ) => { | ||
631 | $crate::SyntaxKind::AT | ||
632 | }; | ||
633 | ( # ) => { | ||
634 | $crate::SyntaxKind::POUND | ||
635 | }; | ||
636 | ( ~ ) => { | ||
637 | $crate::SyntaxKind::TILDE | ||
638 | }; | ||
639 | ( ? ) => { | ||
640 | $crate::SyntaxKind::QUESTION | ||
641 | }; | ||
642 | ( $ ) => { | ||
643 | $crate::SyntaxKind::DOLLAR | ||
644 | }; | ||
645 | ( & ) => { | ||
646 | $crate::SyntaxKind::AMP | ||
647 | }; | ||
648 | ( | ) => { | ||
649 | $crate::SyntaxKind::PIPE | ||
650 | }; | ||
651 | ( + ) => { | ||
652 | $crate::SyntaxKind::PLUS | ||
653 | }; | ||
654 | ( * ) => { | ||
655 | $crate::SyntaxKind::STAR | ||
656 | }; | ||
657 | ( / ) => { | ||
658 | $crate::SyntaxKind::SLASH | ||
659 | }; | ||
660 | ( ^ ) => { | ||
661 | $crate::SyntaxKind::CARET | ||
662 | }; | ||
663 | ( % ) => { | ||
664 | $crate::SyntaxKind::PERCENT | ||
665 | }; | ||
666 | ( _ ) => { | ||
667 | $crate::SyntaxKind::UNDERSCORE | ||
668 | }; | ||
669 | ( . ) => { | ||
670 | $crate::SyntaxKind::DOT | ||
671 | }; | ||
672 | ( .. ) => { | ||
673 | $crate::SyntaxKind::DOTDOT | ||
674 | }; | ||
675 | ( ... ) => { | ||
676 | $crate::SyntaxKind::DOTDOTDOT | ||
677 | }; | ||
678 | ( ..= ) => { | ||
679 | $crate::SyntaxKind::DOTDOTEQ | ||
680 | }; | ||
681 | ( : ) => { | ||
682 | $crate::SyntaxKind::COLON | ||
683 | }; | ||
684 | ( :: ) => { | ||
685 | $crate::SyntaxKind::COLONCOLON | ||
686 | }; | ||
687 | ( = ) => { | ||
688 | $crate::SyntaxKind::EQ | ||
689 | }; | ||
690 | ( == ) => { | ||
691 | $crate::SyntaxKind::EQEQ | ||
692 | }; | ||
693 | ( => ) => { | ||
694 | $crate::SyntaxKind::FAT_ARROW | ||
695 | }; | ||
696 | ( ! ) => { | ||
697 | $crate::SyntaxKind::EXCL | ||
698 | }; | ||
699 | ( != ) => { | ||
700 | $crate::SyntaxKind::NEQ | ||
701 | }; | ||
702 | ( - ) => { | ||
703 | $crate::SyntaxKind::MINUS | ||
704 | }; | ||
705 | ( -> ) => { | ||
706 | $crate::SyntaxKind::THIN_ARROW | ||
707 | }; | ||
708 | ( <= ) => { | ||
709 | $crate::SyntaxKind::LTEQ | ||
710 | }; | ||
711 | ( >= ) => { | ||
712 | $crate::SyntaxKind::GTEQ | ||
713 | }; | ||
714 | ( += ) => { | ||
715 | $crate::SyntaxKind::PLUSEQ | ||
716 | }; | ||
717 | ( -= ) => { | ||
718 | $crate::SyntaxKind::MINUSEQ | ||
719 | }; | ||
720 | ( |= ) => { | ||
721 | $crate::SyntaxKind::PIPEEQ | ||
722 | }; | ||
723 | ( &= ) => { | ||
724 | $crate::SyntaxKind::AMPEQ | ||
725 | }; | ||
726 | ( ^= ) => { | ||
727 | $crate::SyntaxKind::CARETEQ | ||
728 | }; | ||
729 | ( /= ) => { | ||
730 | $crate::SyntaxKind::SLASHEQ | ||
731 | }; | ||
732 | ( *= ) => { | ||
733 | $crate::SyntaxKind::STAREQ | ||
734 | }; | ||
735 | ( %= ) => { | ||
736 | $crate::SyntaxKind::PERCENTEQ | ||
737 | }; | ||
738 | ( && ) => { | ||
739 | $crate::SyntaxKind::AMPAMP | ||
740 | }; | ||
741 | ( || ) => { | ||
742 | $crate::SyntaxKind::PIPEPIPE | ||
743 | }; | ||
744 | ( << ) => { | ||
745 | $crate::SyntaxKind::SHL | ||
746 | }; | ||
747 | ( >> ) => { | ||
748 | $crate::SyntaxKind::SHR | ||
749 | }; | ||
750 | ( <<= ) => { | ||
751 | $crate::SyntaxKind::SHLEQ | ||
752 | }; | ||
753 | ( >>= ) => { | ||
754 | $crate::SyntaxKind::SHREQ | ||
755 | }; | ||
756 | ( async ) => { | ||
757 | $crate::SyntaxKind::ASYNC_KW | ||
758 | }; | ||
759 | ( use ) => { | ||
760 | $crate::SyntaxKind::USE_KW | ||
761 | }; | ||
762 | ( fn ) => { | ||
763 | $crate::SyntaxKind::FN_KW | ||
764 | }; | ||
765 | ( struct ) => { | ||
766 | $crate::SyntaxKind::STRUCT_KW | ||
767 | }; | ||
768 | ( enum ) => { | ||
769 | $crate::SyntaxKind::ENUM_KW | ||
770 | }; | ||
771 | ( trait ) => { | ||
772 | $crate::SyntaxKind::TRAIT_KW | ||
773 | }; | ||
774 | ( impl ) => { | ||
775 | $crate::SyntaxKind::IMPL_KW | ||
776 | }; | ||
777 | ( dyn ) => { | ||
778 | $crate::SyntaxKind::DYN_KW | ||
779 | }; | ||
780 | ( true ) => { | ||
781 | $crate::SyntaxKind::TRUE_KW | ||
782 | }; | ||
783 | ( false ) => { | ||
784 | $crate::SyntaxKind::FALSE_KW | ||
785 | }; | ||
786 | ( as ) => { | ||
787 | $crate::SyntaxKind::AS_KW | ||
788 | }; | ||
789 | ( extern ) => { | ||
790 | $crate::SyntaxKind::EXTERN_KW | ||
791 | }; | ||
792 | ( crate ) => { | ||
793 | $crate::SyntaxKind::CRATE_KW | ||
794 | }; | ||
795 | ( mod ) => { | ||
796 | $crate::SyntaxKind::MOD_KW | ||
797 | }; | ||
798 | ( pub ) => { | ||
799 | $crate::SyntaxKind::PUB_KW | ||
800 | }; | ||
801 | ( self ) => { | ||
802 | $crate::SyntaxKind::SELF_KW | ||
803 | }; | ||
804 | ( super ) => { | ||
805 | $crate::SyntaxKind::SUPER_KW | ||
806 | }; | ||
807 | ( in ) => { | ||
808 | $crate::SyntaxKind::IN_KW | ||
809 | }; | ||
810 | ( where ) => { | ||
811 | $crate::SyntaxKind::WHERE_KW | ||
812 | }; | ||
813 | ( for ) => { | ||
814 | $crate::SyntaxKind::FOR_KW | ||
815 | }; | ||
816 | ( loop ) => { | ||
817 | $crate::SyntaxKind::LOOP_KW | ||
818 | }; | ||
819 | ( while ) => { | ||
820 | $crate::SyntaxKind::WHILE_KW | ||
821 | }; | ||
822 | ( continue ) => { | ||
823 | $crate::SyntaxKind::CONTINUE_KW | ||
824 | }; | ||
825 | ( break ) => { | ||
826 | $crate::SyntaxKind::BREAK_KW | ||
827 | }; | ||
828 | ( if ) => { | ||
829 | $crate::SyntaxKind::IF_KW | ||
830 | }; | ||
831 | ( else ) => { | ||
832 | $crate::SyntaxKind::ELSE_KW | ||
833 | }; | ||
834 | ( match ) => { | ||
835 | $crate::SyntaxKind::MATCH_KW | ||
836 | }; | ||
837 | ( const ) => { | ||
838 | $crate::SyntaxKind::CONST_KW | ||
839 | }; | ||
840 | ( static ) => { | ||
841 | $crate::SyntaxKind::STATIC_KW | ||
842 | }; | ||
843 | ( mut ) => { | ||
844 | $crate::SyntaxKind::MUT_KW | ||
845 | }; | ||
846 | ( unsafe ) => { | ||
847 | $crate::SyntaxKind::UNSAFE_KW | ||
848 | }; | ||
849 | ( type ) => { | ||
850 | $crate::SyntaxKind::TYPE_KW | ||
851 | }; | ||
852 | ( ref ) => { | ||
853 | $crate::SyntaxKind::REF_KW | ||
854 | }; | ||
855 | ( let ) => { | ||
856 | $crate::SyntaxKind::LET_KW | ||
857 | }; | ||
858 | ( move ) => { | ||
859 | $crate::SyntaxKind::MOVE_KW | ||
860 | }; | ||
861 | ( return ) => { | ||
862 | $crate::SyntaxKind::RETURN_KW | ||
863 | }; | ||
864 | ( try ) => { | ||
865 | $crate::SyntaxKind::TRY_KW | ||
866 | }; | ||
867 | ( box ) => { | ||
868 | $crate::SyntaxKind::BOX_KW | ||
869 | }; | ||
870 | ( await ) => { | ||
871 | $crate::SyntaxKind::AWAIT_KW | ||
872 | }; | ||
873 | ( auto ) => { | ||
874 | $crate::SyntaxKind::AUTO_KW | ||
875 | }; | ||
876 | ( default ) => { | ||
877 | $crate::SyntaxKind::DEFAULT_KW | ||
878 | }; | ||
879 | ( existential ) => { | ||
880 | $crate::SyntaxKind::EXISTENTIAL_KW | ||
881 | }; | ||
882 | ( union ) => { | ||
883 | $crate::SyntaxKind::UNION_KW | ||
884 | }; | ||
885 | } | ||
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs.tera b/crates/ra_parser/src/syntax_kind/generated.rs.tera deleted file mode 100644 index f5abbec4b..000000000 --- a/crates/ra_parser/src/syntax_kind/generated.rs.tera +++ /dev/null | |||
@@ -1,128 +0,0 @@ | |||
1 | {# THIS File is not automatically generated: | ||
2 | the below applies to the result of this template | ||
3 | #}// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run | ||
4 | // Do not edit manually | ||
5 | |||
6 | #![allow(bad_style, missing_docs, unreachable_pub)] | ||
7 | #![cfg_attr(rustfmt, rustfmt_skip)] | ||
8 | use super::SyntaxInfo; | ||
9 | |||
10 | /// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`. | ||
11 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] | ||
12 | #[repr(u16)] | ||
13 | pub enum SyntaxKind { | ||
14 | // Technical SyntaxKinds: they appear temporally during parsing, | ||
15 | // but never end up in the final tree | ||
16 | #[doc(hidden)] | ||
17 | TOMBSTONE, | ||
18 | #[doc(hidden)] | ||
19 | EOF, | ||
20 | |||
21 | {%- for t in concat(a=single_byte_tokens, b=multi_byte_tokens) %} | ||
22 | {{t.1}}, | ||
23 | {%- endfor -%} | ||
24 | {% for kw in concat(a=keywords, b=contextual_keywords) %} | ||
25 | {{kw | upper}}_KW, | ||
26 | {%- endfor -%} | ||
27 | {% for t in concat(a=literals, b=tokens, c=nodes) %} | ||
28 | {{t}}, | ||
29 | {%- endfor %} | ||
30 | // Technical kind so that we can cast from u16 safely | ||
31 | #[doc(hidden)] | ||
32 | __LAST, | ||
33 | } | ||
34 | use self::SyntaxKind::*; | ||
35 | |||
36 | #[macro_export] | ||
37 | macro_rules! T { | ||
38 | {%- for t in concat(a=single_byte_tokens, b=multi_byte_tokens) %} | ||
39 | {%- if t.0 == '{' or t.0 == '}' or t.0 == '[' or t.0 == ']' or t.0 == '(' or t.0 == ')' %} | ||
40 | ('{{t.0}}') => { $crate::SyntaxKind::{{t.1}} }; | ||
41 | {%- else %} | ||
42 | ({{t.0}}) => { $crate::SyntaxKind::{{t.1}} }; | ||
43 | {%- endif %} | ||
44 | {%- endfor -%} | ||
45 | {% for kw in concat(a=keywords, b=contextual_keywords) %} | ||
46 | ({{kw}}) => { $crate::SyntaxKind::{{kw | upper}}_KW }; | ||
47 | {%- endfor %} | ||
48 | } | ||
49 | |||
50 | impl From<u16> for SyntaxKind { | ||
51 | fn from(d: u16) -> SyntaxKind { | ||
52 | assert!(d <= (__LAST as u16)); | ||
53 | unsafe { std::mem::transmute::<u16, SyntaxKind>(d) } | ||
54 | } | ||
55 | } | ||
56 | |||
57 | impl From<SyntaxKind> for u16 { | ||
58 | fn from(k: SyntaxKind) -> u16 { | ||
59 | k as u16 | ||
60 | } | ||
61 | } | ||
62 | |||
63 | impl SyntaxKind { | ||
64 | pub fn is_keyword(self) -> bool { | ||
65 | match self { | ||
66 | {%- for kw in concat(a=keywords, b=contextual_keywords) %} | ||
67 | | {{kw | upper}}_KW | ||
68 | {%- endfor %} | ||
69 | => true, | ||
70 | _ => false | ||
71 | } | ||
72 | } | ||
73 | |||
74 | pub fn is_punct(self) -> bool { | ||
75 | match self { | ||
76 | {%- for t in concat(a=single_byte_tokens, b=multi_byte_tokens) %} | ||
77 | | {{t.1}} | ||
78 | {%- endfor %} | ||
79 | => true, | ||
80 | _ => false | ||
81 | } | ||
82 | } | ||
83 | pub fn is_literal(self) -> bool { | ||
84 | match self { | ||
85 | {%- for t in literals %} | ||
86 | | {{t}} | ||
87 | {%- endfor %} | ||
88 | => true, | ||
89 | _ => false | ||
90 | } | ||
91 | } | ||
92 | |||
93 | pub(crate) fn info(self) -> &'static SyntaxInfo { | ||
94 | match self { | ||
95 | {%- for t in concat(a=single_byte_tokens, b=multi_byte_tokens) %} | ||
96 | {{t.1}} => &SyntaxInfo { name: "{{t.1}}" }, | ||
97 | {%- endfor -%} | ||
98 | {% for kw in concat(a=keywords, b=contextual_keywords) %} | ||
99 | {{kw | upper}}_KW => &SyntaxInfo { name: "{{kw | upper}}_KW" }, | ||
100 | {%- endfor -%} | ||
101 | {% for t in concat(a=literals, b=tokens, c=nodes) %} | ||
102 | {{t}} => &SyntaxInfo { name: "{{t}}" }, | ||
103 | {%- endfor %} | ||
104 | TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" }, | ||
105 | EOF => &SyntaxInfo { name: "EOF" }, | ||
106 | __LAST => &SyntaxInfo { name: "__LAST" }, | ||
107 | } | ||
108 | } | ||
109 | pub fn from_keyword(ident: &str) -> Option<SyntaxKind> { | ||
110 | let kw = match ident { | ||
111 | {%- for kw in keywords %} | ||
112 | "{{kw}}" => {{kw | upper}}_KW, | ||
113 | {%- endfor %} | ||
114 | _ => return None, | ||
115 | }; | ||
116 | Some(kw) | ||
117 | } | ||
118 | |||
119 | pub fn from_char(c: char) -> Option<SyntaxKind> { | ||
120 | let tok = match c { | ||
121 | {%- for t in single_byte_tokens %} | ||
122 | '{{t.0}}' => {{t.1}}, | ||
123 | {%- endfor %} | ||
124 | _ => return None, | ||
125 | }; | ||
126 | Some(tok) | ||
127 | } | ||
128 | } | ||