From 832b40a075285063b857bf05a69a8cf979d9078a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 19 Aug 2019 11:02:18 +0300 Subject: use new quote-generated syntax kinds --- crates/ra_parser/src/syntax_kind/generated.rs | 987 +++++++++++---------- crates/ra_parser/src/syntax_kind/generated.rs.tera | 128 --- 2 files changed, 538 insertions(+), 577 deletions(-) delete mode 100644 crates/ra_parser/src/syntax_kind/generated.rs.tera (limited to 'crates/ra_parser/src') 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 @@ -// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run -// Do not edit manually +// Generated file, do not edit by hand, see `crate/ra_tools/src/codegen` #![allow(bad_style, missing_docs, unreachable_pub)] -#![cfg_attr(rustfmt, rustfmt_skip)] use super::SyntaxInfo; - -/// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`. +#[doc = r" The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`."] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[repr(u16)] pub enum SyntaxKind { - // Technical SyntaxKinds: they appear temporally during parsing, - // but never end up in the final tree #[doc(hidden)] TOMBSTONE, #[doc(hidden)] @@ -242,477 +237,280 @@ pub enum SyntaxKind { TYPE_BOUND_LIST, MACRO_ITEMS, MACRO_STMTS, - // Technical kind so that we can cast from u16 safely #[doc(hidden)] __LAST, } use self::SyntaxKind::*; - -#[macro_export] -macro_rules! T { - (;) => { $crate::SyntaxKind::SEMI }; - (,) => { $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::DOTDOT }; - (...) => { $crate::SyntaxKind::DOTDOTDOT }; - (..=) => { $crate::SyntaxKind::DOTDOTEQ }; - (:) => { $crate::SyntaxKind::COLON }; - (::) => { $crate::SyntaxKind::COLONCOLON }; - (=) => { $crate::SyntaxKind::EQ }; - (==) => { $crate::SyntaxKind::EQEQ }; - (=>) => { $crate::SyntaxKind::FAT_ARROW }; - (!) => { $crate::SyntaxKind::EXCL }; - (!=) => { $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::AMPAMP }; - (||) => { $crate::SyntaxKind::PIPEPIPE }; - (<<) => { $crate::SyntaxKind::SHL }; - (>>) => { $crate::SyntaxKind::SHR }; - (<<=) => { $crate::SyntaxKind::SHLEQ }; - (>>=) => { $crate::SyntaxKind::SHREQ }; - (async) => { $crate::SyntaxKind::ASYNC_KW }; - (use) => { $crate::SyntaxKind::USE_KW }; - (fn) => { $crate::SyntaxKind::FN_KW }; - (struct) => { $crate::SyntaxKind::STRUCT_KW }; - (enum) => { $crate::SyntaxKind::ENUM_KW }; - (trait) => { $crate::SyntaxKind::TRAIT_KW }; - (impl) => { $crate::SyntaxKind::IMPL_KW }; - (dyn) => { $crate::SyntaxKind::DYN_KW }; - (true) => { $crate::SyntaxKind::TRUE_KW }; - (false) => { $crate::SyntaxKind::FALSE_KW }; - (as) => { $crate::SyntaxKind::AS_KW }; - (extern) => { $crate::SyntaxKind::EXTERN_KW }; - (crate) => { $crate::SyntaxKind::CRATE_KW }; - (mod) => { $crate::SyntaxKind::MOD_KW }; - (pub) => { $crate::SyntaxKind::PUB_KW }; - (self) => { $crate::SyntaxKind::SELF_KW }; - (super) => { $crate::SyntaxKind::SUPER_KW }; - (in) => { $crate::SyntaxKind::IN_KW }; - (where) => { $crate::SyntaxKind::WHERE_KW }; - (for) => { $crate::SyntaxKind::FOR_KW }; - (loop) => { $crate::SyntaxKind::LOOP_KW }; - (while) => { $crate::SyntaxKind::WHILE_KW }; - (continue) => { $crate::SyntaxKind::CONTINUE_KW }; - (break) => { $crate::SyntaxKind::BREAK_KW }; - (if) => { $crate::SyntaxKind::IF_KW }; - (else) => { $crate::SyntaxKind::ELSE_KW }; - (match) => { $crate::SyntaxKind::MATCH_KW }; - (const) => { $crate::SyntaxKind::CONST_KW }; - (static) => { $crate::SyntaxKind::STATIC_KW }; - (mut) => { $crate::SyntaxKind::MUT_KW }; - (unsafe) => { $crate::SyntaxKind::UNSAFE_KW }; - (type) => { $crate::SyntaxKind::TYPE_KW }; - (ref) => { $crate::SyntaxKind::REF_KW }; - (let) => { $crate::SyntaxKind::LET_KW }; - (move) => { $crate::SyntaxKind::MOVE_KW }; - (return) => { $crate::SyntaxKind::RETURN_KW }; - (try) => { $crate::SyntaxKind::TRY_KW }; - (box) => { $crate::SyntaxKind::BOX_KW }; - (await) => { $crate::SyntaxKind::AWAIT_KW }; - (auto) => { $crate::SyntaxKind::AUTO_KW }; - (default) => { $crate::SyntaxKind::DEFAULT_KW }; - (existential) => { $crate::SyntaxKind::EXISTENTIAL_KW }; - (union) => { $crate::SyntaxKind::UNION_KW }; -} - impl From for SyntaxKind { fn from(d: u16) -> SyntaxKind { assert!(d <= (__LAST as u16)); unsafe { std::mem::transmute::(d) } } } - impl From for u16 { fn from(k: SyntaxKind) -> u16 { k as u16 } } - impl SyntaxKind { pub fn is_keyword(self) -> bool { match self { - | ASYNC_KW - | USE_KW - | FN_KW - | STRUCT_KW - | ENUM_KW - | TRAIT_KW - | IMPL_KW - | DYN_KW - | TRUE_KW - | FALSE_KW - | AS_KW - | EXTERN_KW - | CRATE_KW - | MOD_KW - | PUB_KW - | SELF_KW - | SUPER_KW - | IN_KW - | WHERE_KW - | FOR_KW - | LOOP_KW - | WHILE_KW - | CONTINUE_KW - | BREAK_KW - | IF_KW - | ELSE_KW - | MATCH_KW - | CONST_KW - | STATIC_KW - | MUT_KW - | UNSAFE_KW - | TYPE_KW - | REF_KW - | LET_KW - | MOVE_KW - | RETURN_KW - | TRY_KW - | BOX_KW - | AWAIT_KW - | AUTO_KW - | DEFAULT_KW - | EXISTENTIAL_KW - | UNION_KW - => true, - _ => false + ASYNC_KW | USE_KW | FN_KW | STRUCT_KW | ENUM_KW | TRAIT_KW | IMPL_KW | DYN_KW + | TRUE_KW | FALSE_KW | AS_KW | EXTERN_KW | CRATE_KW | MOD_KW | PUB_KW | SELF_KW + | SUPER_KW | IN_KW | WHERE_KW | FOR_KW | LOOP_KW | WHILE_KW | CONTINUE_KW + | BREAK_KW | IF_KW | ELSE_KW | MATCH_KW | CONST_KW | STATIC_KW | MUT_KW | UNSAFE_KW + | TYPE_KW | REF_KW | LET_KW | MOVE_KW | RETURN_KW | TRY_KW | BOX_KW | AWAIT_KW + | AUTO_KW | DEFAULT_KW | EXISTENTIAL_KW | UNION_KW => true, + _ => false, } } - pub fn is_punct(self) -> bool { match self { - | SEMI - | COMMA - | L_PAREN - | R_PAREN - | L_CURLY - | R_CURLY - | L_BRACK - | R_BRACK - | L_ANGLE - | R_ANGLE - | AT - | POUND - | TILDE - | QUESTION - | DOLLAR - | AMP - | PIPE - | PLUS - | STAR - | SLASH - | CARET - | PERCENT - | UNDERSCORE - | DOT - | DOTDOT - | DOTDOTDOT - | DOTDOTEQ - | COLON - | COLONCOLON - | EQ - | EQEQ - | FAT_ARROW - | EXCL - | NEQ - | MINUS - | THIN_ARROW - | LTEQ - | GTEQ - | PLUSEQ - | MINUSEQ - | PIPEEQ - | AMPEQ - | CARETEQ - | SLASHEQ - | STAREQ - | PERCENTEQ - | AMPAMP - | PIPEPIPE - | SHL - | SHR - | SHLEQ - | SHREQ - => true, - _ => false + SEMI | COMMA | L_PAREN | R_PAREN | L_CURLY | R_CURLY | L_BRACK | R_BRACK | L_ANGLE + | R_ANGLE | AT | POUND | TILDE | QUESTION | DOLLAR | AMP | PIPE | PLUS | STAR + | SLASH | CARET | PERCENT | UNDERSCORE | DOT | DOTDOT | DOTDOTDOT | DOTDOTEQ + | COLON | COLONCOLON | EQ | EQEQ | FAT_ARROW | EXCL | NEQ | MINUS | THIN_ARROW + | LTEQ | GTEQ | PLUSEQ | MINUSEQ | PIPEEQ | AMPEQ | CARETEQ | SLASHEQ | STAREQ + | PERCENTEQ | AMPAMP | PIPEPIPE | SHL | SHR | SHLEQ | SHREQ => true, + _ => false, } } pub fn is_literal(self) -> bool { match self { - | INT_NUMBER - | FLOAT_NUMBER - | CHAR - | BYTE - | STRING - | RAW_STRING - | BYTE_STRING - | RAW_BYTE_STRING - => true, - _ => false + INT_NUMBER | FLOAT_NUMBER | CHAR | BYTE | STRING | RAW_STRING | BYTE_STRING + | RAW_BYTE_STRING => true, + _ => false, } } - pub(crate) fn info(self) -> &'static SyntaxInfo { match self { - SEMI => &SyntaxInfo { name: "SEMI" }, - COMMA => &SyntaxInfo { name: "COMMA" }, - L_PAREN => &SyntaxInfo { name: "L_PAREN" }, - R_PAREN => &SyntaxInfo { name: "R_PAREN" }, - L_CURLY => &SyntaxInfo { name: "L_CURLY" }, - R_CURLY => &SyntaxInfo { name: "R_CURLY" }, - L_BRACK => &SyntaxInfo { name: "L_BRACK" }, - R_BRACK => &SyntaxInfo { name: "R_BRACK" }, - L_ANGLE => &SyntaxInfo { name: "L_ANGLE" }, - R_ANGLE => &SyntaxInfo { name: "R_ANGLE" }, - AT => &SyntaxInfo { name: "AT" }, - POUND => &SyntaxInfo { name: "POUND" }, - TILDE => &SyntaxInfo { name: "TILDE" }, - QUESTION => &SyntaxInfo { name: "QUESTION" }, - DOLLAR => &SyntaxInfo { name: "DOLLAR" }, - AMP => &SyntaxInfo { name: "AMP" }, - PIPE => &SyntaxInfo { name: "PIPE" }, - PLUS => &SyntaxInfo { name: "PLUS" }, - STAR => &SyntaxInfo { name: "STAR" }, - SLASH => &SyntaxInfo { name: "SLASH" }, - CARET => &SyntaxInfo { name: "CARET" }, - PERCENT => &SyntaxInfo { name: "PERCENT" }, - UNDERSCORE => &SyntaxInfo { name: "UNDERSCORE" }, - DOT => &SyntaxInfo { name: "DOT" }, - DOTDOT => &SyntaxInfo { name: "DOTDOT" }, - DOTDOTDOT => &SyntaxInfo { name: "DOTDOTDOT" }, - DOTDOTEQ => &SyntaxInfo { name: "DOTDOTEQ" }, - COLON => &SyntaxInfo { name: "COLON" }, - COLONCOLON => &SyntaxInfo { name: "COLONCOLON" }, - EQ => &SyntaxInfo { name: "EQ" }, - EQEQ => &SyntaxInfo { name: "EQEQ" }, - FAT_ARROW => &SyntaxInfo { name: "FAT_ARROW" }, - EXCL => &SyntaxInfo { name: "EXCL" }, - NEQ => &SyntaxInfo { name: "NEQ" }, - MINUS => &SyntaxInfo { name: "MINUS" }, - THIN_ARROW => &SyntaxInfo { name: "THIN_ARROW" }, - LTEQ => &SyntaxInfo { name: "LTEQ" }, - GTEQ => &SyntaxInfo { name: "GTEQ" }, - PLUSEQ => &SyntaxInfo { name: "PLUSEQ" }, - MINUSEQ => &SyntaxInfo { name: "MINUSEQ" }, - PIPEEQ => &SyntaxInfo { name: "PIPEEQ" }, - AMPEQ => &SyntaxInfo { name: "AMPEQ" }, - CARETEQ => &SyntaxInfo { name: "CARETEQ" }, - SLASHEQ => &SyntaxInfo { name: "SLASHEQ" }, - STAREQ => &SyntaxInfo { name: "STAREQ" }, - PERCENTEQ => &SyntaxInfo { name: "PERCENTEQ" }, - AMPAMP => &SyntaxInfo { name: "AMPAMP" }, - PIPEPIPE => &SyntaxInfo { name: "PIPEPIPE" }, - SHL => &SyntaxInfo { name: "SHL" }, - SHR => &SyntaxInfo { name: "SHR" }, - SHLEQ => &SyntaxInfo { name: "SHLEQ" }, - SHREQ => &SyntaxInfo { name: "SHREQ" }, - ASYNC_KW => &SyntaxInfo { name: "ASYNC_KW" }, - USE_KW => &SyntaxInfo { name: "USE_KW" }, - FN_KW => &SyntaxInfo { name: "FN_KW" }, - STRUCT_KW => &SyntaxInfo { name: "STRUCT_KW" }, - ENUM_KW => &SyntaxInfo { name: "ENUM_KW" }, - TRAIT_KW => &SyntaxInfo { name: "TRAIT_KW" }, - IMPL_KW => &SyntaxInfo { name: "IMPL_KW" }, - DYN_KW => &SyntaxInfo { name: "DYN_KW" }, - TRUE_KW => &SyntaxInfo { name: "TRUE_KW" }, - FALSE_KW => &SyntaxInfo { name: "FALSE_KW" }, - AS_KW => &SyntaxInfo { name: "AS_KW" }, - EXTERN_KW => &SyntaxInfo { name: "EXTERN_KW" }, - CRATE_KW => &SyntaxInfo { name: "CRATE_KW" }, - MOD_KW => &SyntaxInfo { name: "MOD_KW" }, - PUB_KW => &SyntaxInfo { name: "PUB_KW" }, - SELF_KW => &SyntaxInfo { name: "SELF_KW" }, - SUPER_KW => &SyntaxInfo { name: "SUPER_KW" }, - IN_KW => &SyntaxInfo { name: "IN_KW" }, - WHERE_KW => &SyntaxInfo { name: "WHERE_KW" }, - FOR_KW => &SyntaxInfo { name: "FOR_KW" }, - LOOP_KW => &SyntaxInfo { name: "LOOP_KW" }, - WHILE_KW => &SyntaxInfo { name: "WHILE_KW" }, - CONTINUE_KW => &SyntaxInfo { name: "CONTINUE_KW" }, - BREAK_KW => &SyntaxInfo { name: "BREAK_KW" }, - IF_KW => &SyntaxInfo { name: "IF_KW" }, - ELSE_KW => &SyntaxInfo { name: "ELSE_KW" }, - MATCH_KW => &SyntaxInfo { name: "MATCH_KW" }, - CONST_KW => &SyntaxInfo { name: "CONST_KW" }, - STATIC_KW => &SyntaxInfo { name: "STATIC_KW" }, - MUT_KW => &SyntaxInfo { name: "MUT_KW" }, - UNSAFE_KW => &SyntaxInfo { name: "UNSAFE_KW" }, - TYPE_KW => &SyntaxInfo { name: "TYPE_KW" }, - REF_KW => &SyntaxInfo { name: "REF_KW" }, - LET_KW => &SyntaxInfo { name: "LET_KW" }, - MOVE_KW => &SyntaxInfo { name: "MOVE_KW" }, - RETURN_KW => &SyntaxInfo { name: "RETURN_KW" }, - TRY_KW => &SyntaxInfo { name: "TRY_KW" }, - BOX_KW => &SyntaxInfo { name: "BOX_KW" }, - AWAIT_KW => &SyntaxInfo { name: "AWAIT_KW" }, - AUTO_KW => &SyntaxInfo { name: "AUTO_KW" }, - DEFAULT_KW => &SyntaxInfo { name: "DEFAULT_KW" }, - EXISTENTIAL_KW => &SyntaxInfo { name: "EXISTENTIAL_KW" }, - UNION_KW => &SyntaxInfo { name: "UNION_KW" }, - INT_NUMBER => &SyntaxInfo { name: "INT_NUMBER" }, - FLOAT_NUMBER => &SyntaxInfo { name: "FLOAT_NUMBER" }, - CHAR => &SyntaxInfo { name: "CHAR" }, - BYTE => &SyntaxInfo { name: "BYTE" }, - STRING => &SyntaxInfo { name: "STRING" }, - RAW_STRING => &SyntaxInfo { name: "RAW_STRING" }, - BYTE_STRING => &SyntaxInfo { name: "BYTE_STRING" }, - RAW_BYTE_STRING => &SyntaxInfo { name: "RAW_BYTE_STRING" }, - ERROR => &SyntaxInfo { name: "ERROR" }, - IDENT => &SyntaxInfo { name: "IDENT" }, - WHITESPACE => &SyntaxInfo { name: "WHITESPACE" }, - LIFETIME => &SyntaxInfo { name: "LIFETIME" }, - COMMENT => &SyntaxInfo { name: "COMMENT" }, - SHEBANG => &SyntaxInfo { name: "SHEBANG" }, - L_DOLLAR => &SyntaxInfo { name: "L_DOLLAR" }, - R_DOLLAR => &SyntaxInfo { name: "R_DOLLAR" }, - SOURCE_FILE => &SyntaxInfo { name: "SOURCE_FILE" }, - STRUCT_DEF => &SyntaxInfo { name: "STRUCT_DEF" }, - ENUM_DEF => &SyntaxInfo { name: "ENUM_DEF" }, - FN_DEF => &SyntaxInfo { name: "FN_DEF" }, - RET_TYPE => &SyntaxInfo { name: "RET_TYPE" }, - EXTERN_CRATE_ITEM => &SyntaxInfo { name: "EXTERN_CRATE_ITEM" }, - MODULE => &SyntaxInfo { name: "MODULE" }, - USE_ITEM => &SyntaxInfo { name: "USE_ITEM" }, - STATIC_DEF => &SyntaxInfo { name: "STATIC_DEF" }, - CONST_DEF => &SyntaxInfo { name: "CONST_DEF" }, - TRAIT_DEF => &SyntaxInfo { name: "TRAIT_DEF" }, - IMPL_BLOCK => &SyntaxInfo { name: "IMPL_BLOCK" }, - TYPE_ALIAS_DEF => &SyntaxInfo { name: "TYPE_ALIAS_DEF" }, - MACRO_CALL => &SyntaxInfo { name: "MACRO_CALL" }, - TOKEN_TREE => &SyntaxInfo { name: "TOKEN_TREE" }, - PAREN_TYPE => &SyntaxInfo { name: "PAREN_TYPE" }, - TUPLE_TYPE => &SyntaxInfo { name: "TUPLE_TYPE" }, - NEVER_TYPE => &SyntaxInfo { name: "NEVER_TYPE" }, - PATH_TYPE => &SyntaxInfo { name: "PATH_TYPE" }, - POINTER_TYPE => &SyntaxInfo { name: "POINTER_TYPE" }, - ARRAY_TYPE => &SyntaxInfo { name: "ARRAY_TYPE" }, - SLICE_TYPE => &SyntaxInfo { name: "SLICE_TYPE" }, - REFERENCE_TYPE => &SyntaxInfo { name: "REFERENCE_TYPE" }, - PLACEHOLDER_TYPE => &SyntaxInfo { name: "PLACEHOLDER_TYPE" }, - FN_POINTER_TYPE => &SyntaxInfo { name: "FN_POINTER_TYPE" }, - FOR_TYPE => &SyntaxInfo { name: "FOR_TYPE" }, - IMPL_TRAIT_TYPE => &SyntaxInfo { name: "IMPL_TRAIT_TYPE" }, - DYN_TRAIT_TYPE => &SyntaxInfo { name: "DYN_TRAIT_TYPE" }, - REF_PAT => &SyntaxInfo { name: "REF_PAT" }, - BIND_PAT => &SyntaxInfo { name: "BIND_PAT" }, - PLACEHOLDER_PAT => &SyntaxInfo { name: "PLACEHOLDER_PAT" }, - PATH_PAT => &SyntaxInfo { name: "PATH_PAT" }, - STRUCT_PAT => &SyntaxInfo { name: "STRUCT_PAT" }, - FIELD_PAT_LIST => &SyntaxInfo { name: "FIELD_PAT_LIST" }, - FIELD_PAT => &SyntaxInfo { name: "FIELD_PAT" }, - TUPLE_STRUCT_PAT => &SyntaxInfo { name: "TUPLE_STRUCT_PAT" }, - TUPLE_PAT => &SyntaxInfo { name: "TUPLE_PAT" }, - SLICE_PAT => &SyntaxInfo { name: "SLICE_PAT" }, - RANGE_PAT => &SyntaxInfo { name: "RANGE_PAT" }, - LITERAL_PAT => &SyntaxInfo { name: "LITERAL_PAT" }, - TUPLE_EXPR => &SyntaxInfo { name: "TUPLE_EXPR" }, - ARRAY_EXPR => &SyntaxInfo { name: "ARRAY_EXPR" }, - PAREN_EXPR => &SyntaxInfo { name: "PAREN_EXPR" }, - PATH_EXPR => &SyntaxInfo { name: "PATH_EXPR" }, - LAMBDA_EXPR => &SyntaxInfo { name: "LAMBDA_EXPR" }, - IF_EXPR => &SyntaxInfo { name: "IF_EXPR" }, - WHILE_EXPR => &SyntaxInfo { name: "WHILE_EXPR" }, - CONDITION => &SyntaxInfo { name: "CONDITION" }, - LOOP_EXPR => &SyntaxInfo { name: "LOOP_EXPR" }, - FOR_EXPR => &SyntaxInfo { name: "FOR_EXPR" }, - CONTINUE_EXPR => &SyntaxInfo { name: "CONTINUE_EXPR" }, - BREAK_EXPR => &SyntaxInfo { name: "BREAK_EXPR" }, - LABEL => &SyntaxInfo { name: "LABEL" }, - BLOCK_EXPR => &SyntaxInfo { name: "BLOCK_EXPR" }, - RETURN_EXPR => &SyntaxInfo { name: "RETURN_EXPR" }, - MATCH_EXPR => &SyntaxInfo { name: "MATCH_EXPR" }, - MATCH_ARM_LIST => &SyntaxInfo { name: "MATCH_ARM_LIST" }, - MATCH_ARM => &SyntaxInfo { name: "MATCH_ARM" }, - MATCH_GUARD => &SyntaxInfo { name: "MATCH_GUARD" }, - STRUCT_LIT => &SyntaxInfo { name: "STRUCT_LIT" }, - NAMED_FIELD_LIST => &SyntaxInfo { name: "NAMED_FIELD_LIST" }, - NAMED_FIELD => &SyntaxInfo { name: "NAMED_FIELD" }, - TRY_BLOCK_EXPR => &SyntaxInfo { name: "TRY_BLOCK_EXPR" }, - BOX_EXPR => &SyntaxInfo { name: "BOX_EXPR" }, - CALL_EXPR => &SyntaxInfo { name: "CALL_EXPR" }, - INDEX_EXPR => &SyntaxInfo { name: "INDEX_EXPR" }, - METHOD_CALL_EXPR => &SyntaxInfo { name: "METHOD_CALL_EXPR" }, - FIELD_EXPR => &SyntaxInfo { name: "FIELD_EXPR" }, - AWAIT_EXPR => &SyntaxInfo { name: "AWAIT_EXPR" }, - TRY_EXPR => &SyntaxInfo { name: "TRY_EXPR" }, - CAST_EXPR => &SyntaxInfo { name: "CAST_EXPR" }, - REF_EXPR => &SyntaxInfo { name: "REF_EXPR" }, - PREFIX_EXPR => &SyntaxInfo { name: "PREFIX_EXPR" }, - RANGE_EXPR => &SyntaxInfo { name: "RANGE_EXPR" }, - BIN_EXPR => &SyntaxInfo { name: "BIN_EXPR" }, - BLOCK => &SyntaxInfo { name: "BLOCK" }, - EXTERN_BLOCK => &SyntaxInfo { name: "EXTERN_BLOCK" }, - EXTERN_ITEM_LIST => &SyntaxInfo { name: "EXTERN_ITEM_LIST" }, - ENUM_VARIANT => &SyntaxInfo { name: "ENUM_VARIANT" }, - NAMED_FIELD_DEF_LIST => &SyntaxInfo { name: "NAMED_FIELD_DEF_LIST" }, - NAMED_FIELD_DEF => &SyntaxInfo { name: "NAMED_FIELD_DEF" }, - POS_FIELD_DEF_LIST => &SyntaxInfo { name: "POS_FIELD_DEF_LIST" }, - POS_FIELD_DEF => &SyntaxInfo { name: "POS_FIELD_DEF" }, - ENUM_VARIANT_LIST => &SyntaxInfo { name: "ENUM_VARIANT_LIST" }, - ITEM_LIST => &SyntaxInfo { name: "ITEM_LIST" }, - ATTR => &SyntaxInfo { name: "ATTR" }, - META_ITEM => &SyntaxInfo { name: "META_ITEM" }, - USE_TREE => &SyntaxInfo { name: "USE_TREE" }, - USE_TREE_LIST => &SyntaxInfo { name: "USE_TREE_LIST" }, - PATH => &SyntaxInfo { name: "PATH" }, - PATH_SEGMENT => &SyntaxInfo { name: "PATH_SEGMENT" }, - LITERAL => &SyntaxInfo { name: "LITERAL" }, - ALIAS => &SyntaxInfo { name: "ALIAS" }, - VISIBILITY => &SyntaxInfo { name: "VISIBILITY" }, - WHERE_CLAUSE => &SyntaxInfo { name: "WHERE_CLAUSE" }, - WHERE_PRED => &SyntaxInfo { name: "WHERE_PRED" }, - ABI => &SyntaxInfo { name: "ABI" }, - NAME => &SyntaxInfo { name: "NAME" }, - NAME_REF => &SyntaxInfo { name: "NAME_REF" }, - LET_STMT => &SyntaxInfo { name: "LET_STMT" }, - EXPR_STMT => &SyntaxInfo { name: "EXPR_STMT" }, - TYPE_PARAM_LIST => &SyntaxInfo { name: "TYPE_PARAM_LIST" }, - LIFETIME_PARAM => &SyntaxInfo { name: "LIFETIME_PARAM" }, - TYPE_PARAM => &SyntaxInfo { name: "TYPE_PARAM" }, - TYPE_ARG_LIST => &SyntaxInfo { name: "TYPE_ARG_LIST" }, - LIFETIME_ARG => &SyntaxInfo { name: "LIFETIME_ARG" }, - TYPE_ARG => &SyntaxInfo { name: "TYPE_ARG" }, - ASSOC_TYPE_ARG => &SyntaxInfo { name: "ASSOC_TYPE_ARG" }, - PARAM_LIST => &SyntaxInfo { name: "PARAM_LIST" }, - PARAM => &SyntaxInfo { name: "PARAM" }, - SELF_PARAM => &SyntaxInfo { name: "SELF_PARAM" }, - ARG_LIST => &SyntaxInfo { name: "ARG_LIST" }, - TYPE_BOUND => &SyntaxInfo { name: "TYPE_BOUND" }, - TYPE_BOUND_LIST => &SyntaxInfo { name: "TYPE_BOUND_LIST" }, - MACRO_ITEMS => &SyntaxInfo { name: "MACRO_ITEMS" }, - MACRO_STMTS => &SyntaxInfo { name: "MACRO_STMTS" }, + SEMI => &SyntaxInfo { name: stringify!(SEMI) }, + COMMA => &SyntaxInfo { name: stringify!(COMMA) }, + L_PAREN => &SyntaxInfo { name: stringify!(L_PAREN) }, + R_PAREN => &SyntaxInfo { name: stringify!(R_PAREN) }, + L_CURLY => &SyntaxInfo { name: stringify!(L_CURLY) }, + R_CURLY => &SyntaxInfo { name: stringify!(R_CURLY) }, + L_BRACK => &SyntaxInfo { name: stringify!(L_BRACK) }, + R_BRACK => &SyntaxInfo { name: stringify!(R_BRACK) }, + L_ANGLE => &SyntaxInfo { name: stringify!(L_ANGLE) }, + R_ANGLE => &SyntaxInfo { name: stringify!(R_ANGLE) }, + AT => &SyntaxInfo { name: stringify!(AT) }, + POUND => &SyntaxInfo { name: stringify!(POUND) }, + TILDE => &SyntaxInfo { name: stringify!(TILDE) }, + QUESTION => &SyntaxInfo { name: stringify!(QUESTION) }, + DOLLAR => &SyntaxInfo { name: stringify!(DOLLAR) }, + AMP => &SyntaxInfo { name: stringify!(AMP) }, + PIPE => &SyntaxInfo { name: stringify!(PIPE) }, + PLUS => &SyntaxInfo { name: stringify!(PLUS) }, + STAR => &SyntaxInfo { name: stringify!(STAR) }, + SLASH => &SyntaxInfo { name: stringify!(SLASH) }, + CARET => &SyntaxInfo { name: stringify!(CARET) }, + PERCENT => &SyntaxInfo { name: stringify!(PERCENT) }, + UNDERSCORE => &SyntaxInfo { name: stringify!(UNDERSCORE) }, + DOT => &SyntaxInfo { name: stringify!(DOT) }, + DOTDOT => &SyntaxInfo { name: stringify!(DOTDOT) }, + DOTDOTDOT => &SyntaxInfo { name: stringify!(DOTDOTDOT) }, + DOTDOTEQ => &SyntaxInfo { name: stringify!(DOTDOTEQ) }, + COLON => &SyntaxInfo { name: stringify!(COLON) }, + COLONCOLON => &SyntaxInfo { name: stringify!(COLONCOLON) }, + EQ => &SyntaxInfo { name: stringify!(EQ) }, + EQEQ => &SyntaxInfo { name: stringify!(EQEQ) }, + FAT_ARROW => &SyntaxInfo { name: stringify!(FAT_ARROW) }, + EXCL => &SyntaxInfo { name: stringify!(EXCL) }, + NEQ => &SyntaxInfo { name: stringify!(NEQ) }, + MINUS => &SyntaxInfo { name: stringify!(MINUS) }, + THIN_ARROW => &SyntaxInfo { name: stringify!(THIN_ARROW) }, + LTEQ => &SyntaxInfo { name: stringify!(LTEQ) }, + GTEQ => &SyntaxInfo { name: stringify!(GTEQ) }, + PLUSEQ => &SyntaxInfo { name: stringify!(PLUSEQ) }, + MINUSEQ => &SyntaxInfo { name: stringify!(MINUSEQ) }, + PIPEEQ => &SyntaxInfo { name: stringify!(PIPEEQ) }, + AMPEQ => &SyntaxInfo { name: stringify!(AMPEQ) }, + CARETEQ => &SyntaxInfo { name: stringify!(CARETEQ) }, + SLASHEQ => &SyntaxInfo { name: stringify!(SLASHEQ) }, + STAREQ => &SyntaxInfo { name: stringify!(STAREQ) }, + PERCENTEQ => &SyntaxInfo { name: stringify!(PERCENTEQ) }, + AMPAMP => &SyntaxInfo { name: stringify!(AMPAMP) }, + PIPEPIPE => &SyntaxInfo { name: stringify!(PIPEPIPE) }, + SHL => &SyntaxInfo { name: stringify!(SHL) }, + SHR => &SyntaxInfo { name: stringify!(SHR) }, + SHLEQ => &SyntaxInfo { name: stringify!(SHLEQ) }, + SHREQ => &SyntaxInfo { name: stringify!(SHREQ) }, + ASYNC_KW => &SyntaxInfo { name: stringify!(ASYNC_KW) }, + USE_KW => &SyntaxInfo { name: stringify!(USE_KW) }, + FN_KW => &SyntaxInfo { name: stringify!(FN_KW) }, + STRUCT_KW => &SyntaxInfo { name: stringify!(STRUCT_KW) }, + ENUM_KW => &SyntaxInfo { name: stringify!(ENUM_KW) }, + TRAIT_KW => &SyntaxInfo { name: stringify!(TRAIT_KW) }, + IMPL_KW => &SyntaxInfo { name: stringify!(IMPL_KW) }, + DYN_KW => &SyntaxInfo { name: stringify!(DYN_KW) }, + TRUE_KW => &SyntaxInfo { name: stringify!(TRUE_KW) }, + FALSE_KW => &SyntaxInfo { name: stringify!(FALSE_KW) }, + AS_KW => &SyntaxInfo { name: stringify!(AS_KW) }, + EXTERN_KW => &SyntaxInfo { name: stringify!(EXTERN_KW) }, + CRATE_KW => &SyntaxInfo { name: stringify!(CRATE_KW) }, + MOD_KW => &SyntaxInfo { name: stringify!(MOD_KW) }, + PUB_KW => &SyntaxInfo { name: stringify!(PUB_KW) }, + SELF_KW => &SyntaxInfo { name: stringify!(SELF_KW) }, + SUPER_KW => &SyntaxInfo { name: stringify!(SUPER_KW) }, + IN_KW => &SyntaxInfo { name: stringify!(IN_KW) }, + WHERE_KW => &SyntaxInfo { name: stringify!(WHERE_KW) }, + FOR_KW => &SyntaxInfo { name: stringify!(FOR_KW) }, + LOOP_KW => &SyntaxInfo { name: stringify!(LOOP_KW) }, + WHILE_KW => &SyntaxInfo { name: stringify!(WHILE_KW) }, + CONTINUE_KW => &SyntaxInfo { name: stringify!(CONTINUE_KW) }, + BREAK_KW => &SyntaxInfo { name: stringify!(BREAK_KW) }, + IF_KW => &SyntaxInfo { name: stringify!(IF_KW) }, + ELSE_KW => &SyntaxInfo { name: stringify!(ELSE_KW) }, + MATCH_KW => &SyntaxInfo { name: stringify!(MATCH_KW) }, + CONST_KW => &SyntaxInfo { name: stringify!(CONST_KW) }, + STATIC_KW => &SyntaxInfo { name: stringify!(STATIC_KW) }, + MUT_KW => &SyntaxInfo { name: stringify!(MUT_KW) }, + UNSAFE_KW => &SyntaxInfo { name: stringify!(UNSAFE_KW) }, + TYPE_KW => &SyntaxInfo { name: stringify!(TYPE_KW) }, + REF_KW => &SyntaxInfo { name: stringify!(REF_KW) }, + LET_KW => &SyntaxInfo { name: stringify!(LET_KW) }, + MOVE_KW => &SyntaxInfo { name: stringify!(MOVE_KW) }, + RETURN_KW => &SyntaxInfo { name: stringify!(RETURN_KW) }, + TRY_KW => &SyntaxInfo { name: stringify!(TRY_KW) }, + BOX_KW => &SyntaxInfo { name: stringify!(BOX_KW) }, + AWAIT_KW => &SyntaxInfo { name: stringify!(AWAIT_KW) }, + AUTO_KW => &SyntaxInfo { name: stringify!(AUTO_KW) }, + DEFAULT_KW => &SyntaxInfo { name: stringify!(DEFAULT_KW) }, + EXISTENTIAL_KW => &SyntaxInfo { name: stringify!(EXISTENTIAL_KW) }, + UNION_KW => &SyntaxInfo { name: stringify!(UNION_KW) }, + INT_NUMBER => &SyntaxInfo { name: stringify!(INT_NUMBER) }, + FLOAT_NUMBER => &SyntaxInfo { name: stringify!(FLOAT_NUMBER) }, + CHAR => &SyntaxInfo { name: stringify!(CHAR) }, + BYTE => &SyntaxInfo { name: stringify!(BYTE) }, + STRING => &SyntaxInfo { name: stringify!(STRING) }, + RAW_STRING => &SyntaxInfo { name: stringify!(RAW_STRING) }, + BYTE_STRING => &SyntaxInfo { name: stringify!(BYTE_STRING) }, + RAW_BYTE_STRING => &SyntaxInfo { name: stringify!(RAW_BYTE_STRING) }, + ERROR => &SyntaxInfo { name: stringify!(ERROR) }, + IDENT => &SyntaxInfo { name: stringify!(IDENT) }, + WHITESPACE => &SyntaxInfo { name: stringify!(WHITESPACE) }, + LIFETIME => &SyntaxInfo { name: stringify!(LIFETIME) }, + COMMENT => &SyntaxInfo { name: stringify!(COMMENT) }, + SHEBANG => &SyntaxInfo { name: stringify!(SHEBANG) }, + L_DOLLAR => &SyntaxInfo { name: stringify!(L_DOLLAR) }, + R_DOLLAR => &SyntaxInfo { name: stringify!(R_DOLLAR) }, + SOURCE_FILE => &SyntaxInfo { name: stringify!(SOURCE_FILE) }, + STRUCT_DEF => &SyntaxInfo { name: stringify!(STRUCT_DEF) }, + ENUM_DEF => &SyntaxInfo { name: stringify!(ENUM_DEF) }, + FN_DEF => &SyntaxInfo { name: stringify!(FN_DEF) }, + RET_TYPE => &SyntaxInfo { name: stringify!(RET_TYPE) }, + EXTERN_CRATE_ITEM => &SyntaxInfo { name: stringify!(EXTERN_CRATE_ITEM) }, + MODULE => &SyntaxInfo { name: stringify!(MODULE) }, + USE_ITEM => &SyntaxInfo { name: stringify!(USE_ITEM) }, + STATIC_DEF => &SyntaxInfo { name: stringify!(STATIC_DEF) }, + CONST_DEF => &SyntaxInfo { name: stringify!(CONST_DEF) }, + TRAIT_DEF => &SyntaxInfo { name: stringify!(TRAIT_DEF) }, + IMPL_BLOCK => &SyntaxInfo { name: stringify!(IMPL_BLOCK) }, + TYPE_ALIAS_DEF => &SyntaxInfo { name: stringify!(TYPE_ALIAS_DEF) }, + MACRO_CALL => &SyntaxInfo { name: stringify!(MACRO_CALL) }, + TOKEN_TREE => &SyntaxInfo { name: stringify!(TOKEN_TREE) }, + PAREN_TYPE => &SyntaxInfo { name: stringify!(PAREN_TYPE) }, + TUPLE_TYPE => &SyntaxInfo { name: stringify!(TUPLE_TYPE) }, + NEVER_TYPE => &SyntaxInfo { name: stringify!(NEVER_TYPE) }, + PATH_TYPE => &SyntaxInfo { name: stringify!(PATH_TYPE) }, + POINTER_TYPE => &SyntaxInfo { name: stringify!(POINTER_TYPE) }, + ARRAY_TYPE => &SyntaxInfo { name: stringify!(ARRAY_TYPE) }, + SLICE_TYPE => &SyntaxInfo { name: stringify!(SLICE_TYPE) }, + REFERENCE_TYPE => &SyntaxInfo { name: stringify!(REFERENCE_TYPE) }, + PLACEHOLDER_TYPE => &SyntaxInfo { name: stringify!(PLACEHOLDER_TYPE) }, + FN_POINTER_TYPE => &SyntaxInfo { name: stringify!(FN_POINTER_TYPE) }, + FOR_TYPE => &SyntaxInfo { name: stringify!(FOR_TYPE) }, + IMPL_TRAIT_TYPE => &SyntaxInfo { name: stringify!(IMPL_TRAIT_TYPE) }, + DYN_TRAIT_TYPE => &SyntaxInfo { name: stringify!(DYN_TRAIT_TYPE) }, + REF_PAT => &SyntaxInfo { name: stringify!(REF_PAT) }, + BIND_PAT => &SyntaxInfo { name: stringify!(BIND_PAT) }, + PLACEHOLDER_PAT => &SyntaxInfo { name: stringify!(PLACEHOLDER_PAT) }, + PATH_PAT => &SyntaxInfo { name: stringify!(PATH_PAT) }, + STRUCT_PAT => &SyntaxInfo { name: stringify!(STRUCT_PAT) }, + FIELD_PAT_LIST => &SyntaxInfo { name: stringify!(FIELD_PAT_LIST) }, + FIELD_PAT => &SyntaxInfo { name: stringify!(FIELD_PAT) }, + TUPLE_STRUCT_PAT => &SyntaxInfo { name: stringify!(TUPLE_STRUCT_PAT) }, + TUPLE_PAT => &SyntaxInfo { name: stringify!(TUPLE_PAT) }, + SLICE_PAT => &SyntaxInfo { name: stringify!(SLICE_PAT) }, + RANGE_PAT => &SyntaxInfo { name: stringify!(RANGE_PAT) }, + LITERAL_PAT => &SyntaxInfo { name: stringify!(LITERAL_PAT) }, + TUPLE_EXPR => &SyntaxInfo { name: stringify!(TUPLE_EXPR) }, + ARRAY_EXPR => &SyntaxInfo { name: stringify!(ARRAY_EXPR) }, + PAREN_EXPR => &SyntaxInfo { name: stringify!(PAREN_EXPR) }, + PATH_EXPR => &SyntaxInfo { name: stringify!(PATH_EXPR) }, + LAMBDA_EXPR => &SyntaxInfo { name: stringify!(LAMBDA_EXPR) }, + IF_EXPR => &SyntaxInfo { name: stringify!(IF_EXPR) }, + WHILE_EXPR => &SyntaxInfo { name: stringify!(WHILE_EXPR) }, + CONDITION => &SyntaxInfo { name: stringify!(CONDITION) }, + LOOP_EXPR => &SyntaxInfo { name: stringify!(LOOP_EXPR) }, + FOR_EXPR => &SyntaxInfo { name: stringify!(FOR_EXPR) }, + CONTINUE_EXPR => &SyntaxInfo { name: stringify!(CONTINUE_EXPR) }, + BREAK_EXPR => &SyntaxInfo { name: stringify!(BREAK_EXPR) }, + LABEL => &SyntaxInfo { name: stringify!(LABEL) }, + BLOCK_EXPR => &SyntaxInfo { name: stringify!(BLOCK_EXPR) }, + RETURN_EXPR => &SyntaxInfo { name: stringify!(RETURN_EXPR) }, + MATCH_EXPR => &SyntaxInfo { name: stringify!(MATCH_EXPR) }, + MATCH_ARM_LIST => &SyntaxInfo { name: stringify!(MATCH_ARM_LIST) }, + MATCH_ARM => &SyntaxInfo { name: stringify!(MATCH_ARM) }, + MATCH_GUARD => &SyntaxInfo { name: stringify!(MATCH_GUARD) }, + STRUCT_LIT => &SyntaxInfo { name: stringify!(STRUCT_LIT) }, + NAMED_FIELD_LIST => &SyntaxInfo { name: stringify!(NAMED_FIELD_LIST) }, + NAMED_FIELD => &SyntaxInfo { name: stringify!(NAMED_FIELD) }, + TRY_BLOCK_EXPR => &SyntaxInfo { name: stringify!(TRY_BLOCK_EXPR) }, + BOX_EXPR => &SyntaxInfo { name: stringify!(BOX_EXPR) }, + CALL_EXPR => &SyntaxInfo { name: stringify!(CALL_EXPR) }, + INDEX_EXPR => &SyntaxInfo { name: stringify!(INDEX_EXPR) }, + METHOD_CALL_EXPR => &SyntaxInfo { name: stringify!(METHOD_CALL_EXPR) }, + FIELD_EXPR => &SyntaxInfo { name: stringify!(FIELD_EXPR) }, + AWAIT_EXPR => &SyntaxInfo { name: stringify!(AWAIT_EXPR) }, + TRY_EXPR => &SyntaxInfo { name: stringify!(TRY_EXPR) }, + CAST_EXPR => &SyntaxInfo { name: stringify!(CAST_EXPR) }, + REF_EXPR => &SyntaxInfo { name: stringify!(REF_EXPR) }, + PREFIX_EXPR => &SyntaxInfo { name: stringify!(PREFIX_EXPR) }, + RANGE_EXPR => &SyntaxInfo { name: stringify!(RANGE_EXPR) }, + BIN_EXPR => &SyntaxInfo { name: stringify!(BIN_EXPR) }, + BLOCK => &SyntaxInfo { name: stringify!(BLOCK) }, + EXTERN_BLOCK => &SyntaxInfo { name: stringify!(EXTERN_BLOCK) }, + EXTERN_ITEM_LIST => &SyntaxInfo { name: stringify!(EXTERN_ITEM_LIST) }, + ENUM_VARIANT => &SyntaxInfo { name: stringify!(ENUM_VARIANT) }, + NAMED_FIELD_DEF_LIST => &SyntaxInfo { name: stringify!(NAMED_FIELD_DEF_LIST) }, + NAMED_FIELD_DEF => &SyntaxInfo { name: stringify!(NAMED_FIELD_DEF) }, + POS_FIELD_DEF_LIST => &SyntaxInfo { name: stringify!(POS_FIELD_DEF_LIST) }, + POS_FIELD_DEF => &SyntaxInfo { name: stringify!(POS_FIELD_DEF) }, + ENUM_VARIANT_LIST => &SyntaxInfo { name: stringify!(ENUM_VARIANT_LIST) }, + ITEM_LIST => &SyntaxInfo { name: stringify!(ITEM_LIST) }, + ATTR => &SyntaxInfo { name: stringify!(ATTR) }, + META_ITEM => &SyntaxInfo { name: stringify!(META_ITEM) }, + USE_TREE => &SyntaxInfo { name: stringify!(USE_TREE) }, + USE_TREE_LIST => &SyntaxInfo { name: stringify!(USE_TREE_LIST) }, + PATH => &SyntaxInfo { name: stringify!(PATH) }, + PATH_SEGMENT => &SyntaxInfo { name: stringify!(PATH_SEGMENT) }, + LITERAL => &SyntaxInfo { name: stringify!(LITERAL) }, + ALIAS => &SyntaxInfo { name: stringify!(ALIAS) }, + VISIBILITY => &SyntaxInfo { name: stringify!(VISIBILITY) }, + WHERE_CLAUSE => &SyntaxInfo { name: stringify!(WHERE_CLAUSE) }, + WHERE_PRED => &SyntaxInfo { name: stringify!(WHERE_PRED) }, + ABI => &SyntaxInfo { name: stringify!(ABI) }, + NAME => &SyntaxInfo { name: stringify!(NAME) }, + NAME_REF => &SyntaxInfo { name: stringify!(NAME_REF) }, + LET_STMT => &SyntaxInfo { name: stringify!(LET_STMT) }, + EXPR_STMT => &SyntaxInfo { name: stringify!(EXPR_STMT) }, + TYPE_PARAM_LIST => &SyntaxInfo { name: stringify!(TYPE_PARAM_LIST) }, + LIFETIME_PARAM => &SyntaxInfo { name: stringify!(LIFETIME_PARAM) }, + TYPE_PARAM => &SyntaxInfo { name: stringify!(TYPE_PARAM) }, + TYPE_ARG_LIST => &SyntaxInfo { name: stringify!(TYPE_ARG_LIST) }, + LIFETIME_ARG => &SyntaxInfo { name: stringify!(LIFETIME_ARG) }, + TYPE_ARG => &SyntaxInfo { name: stringify!(TYPE_ARG) }, + ASSOC_TYPE_ARG => &SyntaxInfo { name: stringify!(ASSOC_TYPE_ARG) }, + PARAM_LIST => &SyntaxInfo { name: stringify!(PARAM_LIST) }, + PARAM => &SyntaxInfo { name: stringify!(PARAM) }, + SELF_PARAM => &SyntaxInfo { name: stringify!(SELF_PARAM) }, + ARG_LIST => &SyntaxInfo { name: stringify!(ARG_LIST) }, + TYPE_BOUND => &SyntaxInfo { name: stringify!(TYPE_BOUND) }, + TYPE_BOUND_LIST => &SyntaxInfo { name: stringify!(TYPE_BOUND_LIST) }, + MACRO_ITEMS => &SyntaxInfo { name: stringify!(MACRO_ITEMS) }, + MACRO_STMTS => &SyntaxInfo { name: stringify!(MACRO_STMTS) }, TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" }, EOF => &SyntaxInfo { name: "EOF" }, __LAST => &SyntaxInfo { name: "__LAST" }, @@ -759,11 +557,14 @@ impl SyntaxKind { "try" => TRY_KW, "box" => BOX_KW, "await" => AWAIT_KW, + "auto" => AUTO_KW, + "default" => DEFAULT_KW, + "existential" => EXISTENTIAL_KW, + "union" => UNION_KW, _ => return None, }; Some(kw) } - pub fn from_char(c: char) -> Option { let tok = match c { ';' => SEMI, @@ -794,3 +595,291 @@ impl SyntaxKind { Some(tok) } } +#[macro_export] +macro_rules! T { + ( ; ) => { + $crate::SyntaxKind::SEMI + }; + ( , ) => { + $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::DOTDOT + }; + ( ... ) => { + $crate::SyntaxKind::DOTDOTDOT + }; + ( ..= ) => { + $crate::SyntaxKind::DOTDOTEQ + }; + ( : ) => { + $crate::SyntaxKind::COLON + }; + ( :: ) => { + $crate::SyntaxKind::COLONCOLON + }; + ( = ) => { + $crate::SyntaxKind::EQ + }; + ( == ) => { + $crate::SyntaxKind::EQEQ + }; + ( => ) => { + $crate::SyntaxKind::FAT_ARROW + }; + ( ! ) => { + $crate::SyntaxKind::EXCL + }; + ( != ) => { + $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::AMPAMP + }; + ( || ) => { + $crate::SyntaxKind::PIPEPIPE + }; + ( << ) => { + $crate::SyntaxKind::SHL + }; + ( >> ) => { + $crate::SyntaxKind::SHR + }; + ( <<= ) => { + $crate::SyntaxKind::SHLEQ + }; + ( >>= ) => { + $crate::SyntaxKind::SHREQ + }; + ( async ) => { + $crate::SyntaxKind::ASYNC_KW + }; + ( use ) => { + $crate::SyntaxKind::USE_KW + }; + ( fn ) => { + $crate::SyntaxKind::FN_KW + }; + ( struct ) => { + $crate::SyntaxKind::STRUCT_KW + }; + ( enum ) => { + $crate::SyntaxKind::ENUM_KW + }; + ( trait ) => { + $crate::SyntaxKind::TRAIT_KW + }; + ( impl ) => { + $crate::SyntaxKind::IMPL_KW + }; + ( dyn ) => { + $crate::SyntaxKind::DYN_KW + }; + ( true ) => { + $crate::SyntaxKind::TRUE_KW + }; + ( false ) => { + $crate::SyntaxKind::FALSE_KW + }; + ( as ) => { + $crate::SyntaxKind::AS_KW + }; + ( extern ) => { + $crate::SyntaxKind::EXTERN_KW + }; + ( crate ) => { + $crate::SyntaxKind::CRATE_KW + }; + ( mod ) => { + $crate::SyntaxKind::MOD_KW + }; + ( pub ) => { + $crate::SyntaxKind::PUB_KW + }; + ( self ) => { + $crate::SyntaxKind::SELF_KW + }; + ( super ) => { + $crate::SyntaxKind::SUPER_KW + }; + ( in ) => { + $crate::SyntaxKind::IN_KW + }; + ( where ) => { + $crate::SyntaxKind::WHERE_KW + }; + ( for ) => { + $crate::SyntaxKind::FOR_KW + }; + ( loop ) => { + $crate::SyntaxKind::LOOP_KW + }; + ( while ) => { + $crate::SyntaxKind::WHILE_KW + }; + ( continue ) => { + $crate::SyntaxKind::CONTINUE_KW + }; + ( break ) => { + $crate::SyntaxKind::BREAK_KW + }; + ( if ) => { + $crate::SyntaxKind::IF_KW + }; + ( else ) => { + $crate::SyntaxKind::ELSE_KW + }; + ( match ) => { + $crate::SyntaxKind::MATCH_KW + }; + ( const ) => { + $crate::SyntaxKind::CONST_KW + }; + ( static ) => { + $crate::SyntaxKind::STATIC_KW + }; + ( mut ) => { + $crate::SyntaxKind::MUT_KW + }; + ( unsafe ) => { + $crate::SyntaxKind::UNSAFE_KW + }; + ( type ) => { + $crate::SyntaxKind::TYPE_KW + }; + ( ref ) => { + $crate::SyntaxKind::REF_KW + }; + ( let ) => { + $crate::SyntaxKind::LET_KW + }; + ( move ) => { + $crate::SyntaxKind::MOVE_KW + }; + ( return ) => { + $crate::SyntaxKind::RETURN_KW + }; + ( try ) => { + $crate::SyntaxKind::TRY_KW + }; + ( box ) => { + $crate::SyntaxKind::BOX_KW + }; + ( await ) => { + $crate::SyntaxKind::AWAIT_KW + }; + ( auto ) => { + $crate::SyntaxKind::AUTO_KW + }; + ( default ) => { + $crate::SyntaxKind::DEFAULT_KW + }; + ( existential ) => { + $crate::SyntaxKind::EXISTENTIAL_KW + }; + ( union ) => { + $crate::SyntaxKind::UNION_KW + }; +} 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 @@ -{# THIS File is not automatically generated: -the below applies to the result of this template -#}// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run -// Do not edit manually - -#![allow(bad_style, missing_docs, unreachable_pub)] -#![cfg_attr(rustfmt, rustfmt_skip)] -use super::SyntaxInfo; - -/// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`. -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] -#[repr(u16)] -pub enum SyntaxKind { - // Technical SyntaxKinds: they appear temporally during parsing, - // but never end up in the final tree - #[doc(hidden)] - TOMBSTONE, - #[doc(hidden)] - EOF, - -{%- for t in concat(a=single_byte_tokens, b=multi_byte_tokens) %} - {{t.1}}, -{%- endfor -%} -{% for kw in concat(a=keywords, b=contextual_keywords) %} - {{kw | upper}}_KW, -{%- endfor -%} -{% for t in concat(a=literals, b=tokens, c=nodes) %} - {{t}}, -{%- endfor %} - // Technical kind so that we can cast from u16 safely - #[doc(hidden)] - __LAST, -} -use self::SyntaxKind::*; - -#[macro_export] -macro_rules! T { -{%- for t in concat(a=single_byte_tokens, b=multi_byte_tokens) %} - {%- if t.0 == '{' or t.0 == '}' or t.0 == '[' or t.0 == ']' or t.0 == '(' or t.0 == ')' %} - ('{{t.0}}') => { $crate::SyntaxKind::{{t.1}} }; - {%- else %} - ({{t.0}}) => { $crate::SyntaxKind::{{t.1}} }; - {%- endif %} -{%- endfor -%} -{% for kw in concat(a=keywords, b=contextual_keywords) %} - ({{kw}}) => { $crate::SyntaxKind::{{kw | upper}}_KW }; -{%- endfor %} -} - -impl From for SyntaxKind { - fn from(d: u16) -> SyntaxKind { - assert!(d <= (__LAST as u16)); - unsafe { std::mem::transmute::(d) } - } -} - -impl From for u16 { - fn from(k: SyntaxKind) -> u16 { - k as u16 - } -} - -impl SyntaxKind { - pub fn is_keyword(self) -> bool { - match self { -{%- for kw in concat(a=keywords, b=contextual_keywords) %} - | {{kw | upper}}_KW -{%- endfor %} - => true, - _ => false - } - } - - pub fn is_punct(self) -> bool { - match self { -{%- for t in concat(a=single_byte_tokens, b=multi_byte_tokens) %} - | {{t.1}} -{%- endfor %} - => true, - _ => false - } - } - pub fn is_literal(self) -> bool { - match self { -{%- for t in literals %} - | {{t}} -{%- endfor %} - => true, - _ => false - } - } - - pub(crate) fn info(self) -> &'static SyntaxInfo { - match self { -{%- for t in concat(a=single_byte_tokens, b=multi_byte_tokens) %} - {{t.1}} => &SyntaxInfo { name: "{{t.1}}" }, -{%- endfor -%} -{% for kw in concat(a=keywords, b=contextual_keywords) %} - {{kw | upper}}_KW => &SyntaxInfo { name: "{{kw | upper}}_KW" }, -{%- endfor -%} -{% for t in concat(a=literals, b=tokens, c=nodes) %} - {{t}} => &SyntaxInfo { name: "{{t}}" }, -{%- endfor %} - TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" }, - EOF => &SyntaxInfo { name: "EOF" }, - __LAST => &SyntaxInfo { name: "__LAST" }, - } - } - pub fn from_keyword(ident: &str) -> Option { - let kw = match ident { -{%- for kw in keywords %} - "{{kw}}" => {{kw | upper}}_KW, -{%- endfor %} - _ => return None, - }; - Some(kw) - } - - pub fn from_char(c: char) -> Option { - let tok = match c { -{%- for t in single_byte_tokens %} - '{{t.0}}' => {{t.1}}, -{%- endfor %} - _ => return None, - }; - Some(tok) - } -} -- cgit v1.2.3 From 038975b348b03dd3063d14cabd30fa71b010baea Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 19 Aug 2019 12:26:34 +0300 Subject: plug new boilerplate_gen into ra_tools --- crates/ra_parser/src/syntax_kind/generated.rs | 4 ---- 1 file changed, 4 deletions(-) (limited to 'crates/ra_parser/src') diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs index 75f5fb64c..415839cb5 100644 --- a/crates/ra_parser/src/syntax_kind/generated.rs +++ b/crates/ra_parser/src/syntax_kind/generated.rs @@ -557,10 +557,6 @@ impl SyntaxKind { "try" => TRY_KW, "box" => BOX_KW, "await" => AWAIT_KW, - "auto" => AUTO_KW, - "default" => DEFAULT_KW, - "existential" => EXISTENTIAL_KW, - "union" => UNION_KW, _ => return None, }; Some(kw) -- cgit v1.2.3