rust/crates/ra_syntax/src/syntax_kinds/generated.rs

564 lines
19 KiB
Rust
Raw Normal View History

2018-10-16 13:09:22 -05:00
// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run
2018-10-04 15:43:58 -05:00
// Do not edit manually
2018-01-27 20:36:28 -06:00
#![allow(bad_style, missing_docs, unreachable_pub)]
#![cfg_attr(rustfmt, rustfmt_skip)]
2018-07-29 07:16:07 -05:00
use super::SyntaxInfo;
2017-12-28 15:56:36 -06:00
2018-01-27 20:36:28 -06:00
/// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`.
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum SyntaxKind {
2018-08-08 15:09:40 -05:00
// Technical SyntaxKinds: they appear temporally during parsing,
// but never end up in the final tree
#[doc(hidden)]
TOMBSTONE,
#[doc(hidden)]
EOF,
2018-01-27 20:36:28 -06:00
SEMI,
COMMA,
L_PAREN,
R_PAREN,
L_CURLY,
R_CURLY,
L_BRACK,
R_BRACK,
L_ANGLE,
R_ANGLE,
AT,
POUND,
TILDE,
QUESTION,
2018-07-30 09:46:50 -05:00
DOLLAR,
2018-08-05 10:18:02 -05:00
AMP,
2018-07-30 09:46:50 -05:00
PIPE,
PLUS,
STAR,
SLASH,
CARET,
PERCENT,
DOT,
DOTDOT,
DOTDOTDOT,
DOTDOTEQ,
2018-01-27 20:36:28 -06:00
COLON,
COLONCOLON,
EQ,
EQEQ,
FAT_ARROW,
EXCL,
2018-07-30 09:46:50 -05:00
NEQ,
MINUS,
THIN_ARROW,
2018-08-05 08:09:25 -05:00
LTEQ,
GTEQ,
PLUSEQ,
MINUSEQ,
2018-08-23 16:48:10 -05:00
PIPEEQ,
AMPEQ,
CARETEQ,
SLASHEQ,
STAREQ,
2018-08-05 10:18:02 -05:00
AMPAMP,
2018-08-05 10:16:52 -05:00
PIPEPIPE,
2018-08-07 06:24:03 -05:00
SHL,
SHR,
SHLEQ,
SHREQ,
2018-02-04 07:46:26 -06:00
USE_KW,
FN_KW,
STRUCT_KW,
ENUM_KW,
TRAIT_KW,
IMPL_KW,
2018-08-13 09:42:43 -05:00
DYN_KW,
2018-02-04 07:46:26 -06:00
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,
2018-08-24 03:21:13 -05:00
CONTINUE_KW,
BREAK_KW,
2018-02-04 07:46:26 -06:00
IF_KW,
2018-07-31 16:14:26 -05:00
ELSE_KW,
2018-02-04 07:46:26 -06:00
MATCH_KW,
CONST_KW,
STATIC_KW,
MUT_KW,
UNSAFE_KW,
2018-02-10 03:35:40 -06:00
TYPE_KW,
REF_KW,
LET_KW,
2018-07-31 16:30:17 -05:00
MOVE_KW,
2018-08-01 03:27:31 -05:00
RETURN_KW,
2018-02-04 07:46:26 -06:00
AUTO_KW,
DEFAULT_KW,
UNION_KW,
2018-07-30 10:02:13 -05:00
ERROR,
IDENT,
UNDERSCORE,
WHITESPACE,
INT_NUMBER,
FLOAT_NUMBER,
LIFETIME,
CHAR,
BYTE,
STRING,
RAW_STRING,
BYTE_STRING,
RAW_BYTE_STRING,
COMMENT,
SHEBANG,
2018-08-25 03:44:17 -05:00
ROOT,
2018-08-13 10:27:26 -05:00
STRUCT_DEF,
ENUM_DEF,
FN_DEF,
2018-08-28 13:11:17 -05:00
RET_TYPE,
2018-02-02 13:08:14 -06:00
EXTERN_CRATE_ITEM,
2018-08-11 02:56:40 -05:00
MODULE,
2018-02-02 13:08:14 -06:00
USE_ITEM,
2018-08-13 10:27:26 -05:00
STATIC_DEF,
CONST_DEF,
TRAIT_DEF,
2018-02-04 04:39:24 -06:00
IMPL_ITEM,
2018-08-13 10:27:26 -05:00
TYPE_DEF,
2018-08-05 06:08:46 -05:00
MACRO_CALL,
TOKEN_TREE,
2018-02-10 15:46:17 -06:00
PAREN_TYPE,
TUPLE_TYPE,
NEVER_TYPE,
PATH_TYPE,
2018-02-11 02:19:54 -06:00
POINTER_TYPE,
2018-02-11 02:37:08 -06:00
ARRAY_TYPE,
SLICE_TYPE,
2018-02-11 02:54:09 -06:00
REFERENCE_TYPE,
2018-02-11 02:57:05 -06:00
PLACEHOLDER_TYPE,
2018-02-11 03:51:09 -06:00
FN_POINTER_TYPE,
2018-02-11 14:32:49 -06:00
FOR_TYPE,
2018-07-31 14:41:29 -05:00
IMPL_TRAIT_TYPE,
2018-08-13 09:42:43 -05:00
DYN_TRAIT_TYPE,
REF_PAT,
BIND_PAT,
PLACEHOLDER_PAT,
2018-08-04 07:47:45 -05:00
PATH_PAT,
STRUCT_PAT,
2018-08-24 11:27:30 -05:00
FIELD_PAT_LIST,
2018-08-07 06:41:03 -05:00
TUPLE_STRUCT_PAT,
2018-08-04 07:47:45 -05:00
TUPLE_PAT,
2018-08-07 09:00:45 -05:00
SLICE_PAT,
2018-08-08 07:05:33 -05:00
RANGE_PAT,
TUPLE_EXPR,
2018-08-05 10:24:56 -05:00
ARRAY_EXPR,
2018-08-05 09:19:03 -05:00
PAREN_EXPR,
2018-07-30 09:02:51 -05:00
PATH_EXPR,
2018-07-31 15:13:08 -05:00
LAMBDA_EXPR,
2018-07-31 16:14:26 -05:00
IF_EXPR,
2018-08-27 04:22:09 -05:00
WHILE_EXPR,
CONDITION,
2018-08-05 10:16:52 -05:00
LOOP_EXPR,
2018-08-24 03:45:14 -05:00
FOR_EXPR,
2018-08-24 03:21:13 -05:00
CONTINUE_EXPR,
BREAK_EXPR,
2018-08-24 03:45:14 -05:00
LABEL,
2018-08-01 03:27:31 -05:00
BLOCK_EXPR,
RETURN_EXPR,
2018-08-04 05:39:03 -05:00
MATCH_EXPR,
2018-08-24 11:27:30 -05:00
MATCH_ARM_LIST,
2018-08-04 05:39:03 -05:00
MATCH_ARM,
MATCH_GUARD,
2018-08-04 08:34:54 -05:00
STRUCT_LIT,
2018-08-24 11:27:30 -05:00
NAMED_FIELD_LIST,
NAMED_FIELD,
2018-08-04 08:34:54 -05:00
CALL_EXPR,
2018-08-05 09:24:44 -05:00
INDEX_EXPR,
2018-08-04 08:34:54 -05:00
METHOD_CALL_EXPR,
FIELD_EXPR,
TRY_EXPR,
2018-08-06 19:55:16 -05:00
CAST_EXPR,
2018-08-04 08:34:54 -05:00
REF_EXPR,
2018-08-07 06:52:03 -05:00
PREFIX_EXPR,
2018-08-05 10:07:06 -05:00
RANGE_EXPR,
2018-08-04 08:34:54 -05:00
BIN_EXPR,
2018-08-24 11:27:30 -05:00
BLOCK,
EXTERN_BLOCK,
EXTERN_ITEM_LIST,
2018-01-28 13:59:18 -06:00
ENUM_VARIANT,
2018-08-24 11:27:30 -05:00
NAMED_FIELD_DEF_LIST,
NAMED_FIELD_DEF,
POS_FIELD_LIST,
2018-01-27 20:36:28 -06:00
POS_FIELD,
2018-08-24 11:27:30 -05:00
ENUM_VARIANT_LIST,
ITEM_LIST,
2018-01-27 20:36:28 -06:00
ATTR,
META_ITEM,
USE_TREE,
2018-08-24 11:27:30 -05:00
USE_TREE_LIST,
2018-01-27 20:36:28 -06:00
PATH,
PATH_SEGMENT,
LITERAL,
ALIAS,
VISIBILITY,
2018-02-10 03:53:07 -06:00
WHERE_CLAUSE,
2018-08-08 11:26:38 -05:00
WHERE_PRED,
2018-02-02 13:08:14 -06:00
ABI,
2018-02-10 05:00:23 -06:00
NAME,
NAME_REF,
LET_STMT,
2018-07-31 04:59:52 -05:00
EXPR_STMT,
2018-07-30 09:02:51 -05:00
TYPE_PARAM_LIST,
2018-07-31 11:37:40 -05:00
LIFETIME_PARAM,
TYPE_PARAM,
2018-07-30 09:02:51 -05:00
TYPE_ARG_LIST,
2018-07-31 11:37:40 -05:00
LIFETIME_ARG,
TYPE_ARG,
ASSOC_TYPE_ARG,
2018-07-31 04:32:53 -05:00
PARAM_LIST,
2018-07-31 15:13:55 -05:00
PARAM,
2018-07-31 10:03:50 -05:00
SELF_PARAM,
2018-07-31 04:32:53 -05:00
ARG_LIST,
2018-01-27 20:36:28 -06:00
}
2018-07-30 06:06:22 -05:00
use self::SyntaxKind::*;
2018-01-27 20:36:28 -06:00
impl SyntaxKind {
2018-08-01 02:40:07 -05:00
pub fn is_keyword(self) -> bool {
match self {
| USE_KW
| FN_KW
| STRUCT_KW
| ENUM_KW
| TRAIT_KW
| IMPL_KW
2018-08-13 09:42:43 -05:00
| DYN_KW
2018-08-01 02:40:07 -05:00
| 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
2018-08-24 03:21:13 -05:00
| CONTINUE_KW
| BREAK_KW
2018-08-01 02:40:07 -05:00
| IF_KW
| ELSE_KW
| MATCH_KW
| CONST_KW
| STATIC_KW
| MUT_KW
| UNSAFE_KW
| TYPE_KW
| REF_KW
| LET_KW
| MOVE_KW
2018-08-01 03:27:31 -05:00
| RETURN_KW
2018-08-01 02:40:07 -05:00
| AUTO_KW
| DEFAULT_KW
| UNION_KW
=> true,
_ => false
}
}
2018-01-27 20:36:28 -06:00
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" },
2018-07-30 09:46:50 -05:00
DOLLAR => &SyntaxInfo { name: "DOLLAR" },
2018-08-05 10:18:02 -05:00
AMP => &SyntaxInfo { name: "AMP" },
2018-07-30 09:46:50 -05:00
PIPE => &SyntaxInfo { name: "PIPE" },
PLUS => &SyntaxInfo { name: "PLUS" },
STAR => &SyntaxInfo { name: "STAR" },
SLASH => &SyntaxInfo { name: "SLASH" },
CARET => &SyntaxInfo { name: "CARET" },
PERCENT => &SyntaxInfo { name: "PERCENT" },
DOT => &SyntaxInfo { name: "DOT" },
DOTDOT => &SyntaxInfo { name: "DOTDOT" },
DOTDOTDOT => &SyntaxInfo { name: "DOTDOTDOT" },
DOTDOTEQ => &SyntaxInfo { name: "DOTDOTEQ" },
2018-01-27 20:36:28 -06:00
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" },
2018-07-30 09:46:50 -05:00
NEQ => &SyntaxInfo { name: "NEQ" },
MINUS => &SyntaxInfo { name: "MINUS" },
THIN_ARROW => &SyntaxInfo { name: "THIN_ARROW" },
2018-08-05 08:09:25 -05:00
LTEQ => &SyntaxInfo { name: "LTEQ" },
GTEQ => &SyntaxInfo { name: "GTEQ" },
PLUSEQ => &SyntaxInfo { name: "PLUSEQ" },
MINUSEQ => &SyntaxInfo { name: "MINUSEQ" },
2018-08-23 16:48:10 -05:00
PIPEEQ => &SyntaxInfo { name: "PIPEEQ" },
AMPEQ => &SyntaxInfo { name: "AMPEQ" },
CARETEQ => &SyntaxInfo { name: "CARETEQ" },
SLASHEQ => &SyntaxInfo { name: "SLASHEQ" },
STAREQ => &SyntaxInfo { name: "STAREQ" },
2018-08-05 10:18:02 -05:00
AMPAMP => &SyntaxInfo { name: "AMPAMP" },
2018-08-05 10:16:52 -05:00
PIPEPIPE => &SyntaxInfo { name: "PIPEPIPE" },
2018-08-07 06:24:03 -05:00
SHL => &SyntaxInfo { name: "SHL" },
SHR => &SyntaxInfo { name: "SHR" },
SHLEQ => &SyntaxInfo { name: "SHLEQ" },
SHREQ => &SyntaxInfo { name: "SHREQ" },
2018-02-04 07:46:26 -06:00
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" },
2018-08-13 09:42:43 -05:00
DYN_KW => &SyntaxInfo { name: "DYN_KW" },
2018-02-04 07:46:26 -06:00
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" },
2018-08-24 03:21:13 -05:00
CONTINUE_KW => &SyntaxInfo { name: "CONTINUE_KW" },
BREAK_KW => &SyntaxInfo { name: "BREAK_KW" },
2018-02-04 07:46:26 -06:00
IF_KW => &SyntaxInfo { name: "IF_KW" },
2018-07-31 16:14:26 -05:00
ELSE_KW => &SyntaxInfo { name: "ELSE_KW" },
2018-02-04 07:46:26 -06:00
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" },
2018-02-10 03:35:40 -06:00
TYPE_KW => &SyntaxInfo { name: "TYPE_KW" },
REF_KW => &SyntaxInfo { name: "REF_KW" },
LET_KW => &SyntaxInfo { name: "LET_KW" },
2018-07-31 16:30:17 -05:00
MOVE_KW => &SyntaxInfo { name: "MOVE_KW" },
2018-08-01 03:27:31 -05:00
RETURN_KW => &SyntaxInfo { name: "RETURN_KW" },
2018-02-04 07:46:26 -06:00
AUTO_KW => &SyntaxInfo { name: "AUTO_KW" },
DEFAULT_KW => &SyntaxInfo { name: "DEFAULT_KW" },
UNION_KW => &SyntaxInfo { name: "UNION_KW" },
2018-07-30 10:02:13 -05:00
ERROR => &SyntaxInfo { name: "ERROR" },
IDENT => &SyntaxInfo { name: "IDENT" },
UNDERSCORE => &SyntaxInfo { name: "UNDERSCORE" },
WHITESPACE => &SyntaxInfo { name: "WHITESPACE" },
INT_NUMBER => &SyntaxInfo { name: "INT_NUMBER" },
FLOAT_NUMBER => &SyntaxInfo { name: "FLOAT_NUMBER" },
LIFETIME => &SyntaxInfo { name: "LIFETIME" },
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" },
COMMENT => &SyntaxInfo { name: "COMMENT" },
SHEBANG => &SyntaxInfo { name: "SHEBANG" },
2018-08-25 03:44:17 -05:00
ROOT => &SyntaxInfo { name: "ROOT" },
2018-08-13 10:27:26 -05:00
STRUCT_DEF => &SyntaxInfo { name: "STRUCT_DEF" },
ENUM_DEF => &SyntaxInfo { name: "ENUM_DEF" },
FN_DEF => &SyntaxInfo { name: "FN_DEF" },
2018-08-28 13:11:17 -05:00
RET_TYPE => &SyntaxInfo { name: "RET_TYPE" },
2018-02-02 13:08:14 -06:00
EXTERN_CRATE_ITEM => &SyntaxInfo { name: "EXTERN_CRATE_ITEM" },
2018-08-11 02:56:40 -05:00
MODULE => &SyntaxInfo { name: "MODULE" },
2018-02-02 13:08:14 -06:00
USE_ITEM => &SyntaxInfo { name: "USE_ITEM" },
2018-08-13 10:27:26 -05:00
STATIC_DEF => &SyntaxInfo { name: "STATIC_DEF" },
CONST_DEF => &SyntaxInfo { name: "CONST_DEF" },
TRAIT_DEF => &SyntaxInfo { name: "TRAIT_DEF" },
2018-02-04 04:39:24 -06:00
IMPL_ITEM => &SyntaxInfo { name: "IMPL_ITEM" },
2018-08-13 10:27:26 -05:00
TYPE_DEF => &SyntaxInfo { name: "TYPE_DEF" },
2018-08-05 06:08:46 -05:00
MACRO_CALL => &SyntaxInfo { name: "MACRO_CALL" },
TOKEN_TREE => &SyntaxInfo { name: "TOKEN_TREE" },
2018-02-10 15:46:17 -06:00
PAREN_TYPE => &SyntaxInfo { name: "PAREN_TYPE" },
TUPLE_TYPE => &SyntaxInfo { name: "TUPLE_TYPE" },
NEVER_TYPE => &SyntaxInfo { name: "NEVER_TYPE" },
PATH_TYPE => &SyntaxInfo { name: "PATH_TYPE" },
2018-02-11 02:19:54 -06:00
POINTER_TYPE => &SyntaxInfo { name: "POINTER_TYPE" },
2018-02-11 02:37:08 -06:00
ARRAY_TYPE => &SyntaxInfo { name: "ARRAY_TYPE" },
SLICE_TYPE => &SyntaxInfo { name: "SLICE_TYPE" },
2018-02-11 02:54:09 -06:00
REFERENCE_TYPE => &SyntaxInfo { name: "REFERENCE_TYPE" },
2018-02-11 02:57:05 -06:00
PLACEHOLDER_TYPE => &SyntaxInfo { name: "PLACEHOLDER_TYPE" },
2018-02-11 03:51:09 -06:00
FN_POINTER_TYPE => &SyntaxInfo { name: "FN_POINTER_TYPE" },
2018-02-11 14:32:49 -06:00
FOR_TYPE => &SyntaxInfo { name: "FOR_TYPE" },
2018-07-31 14:41:29 -05:00
IMPL_TRAIT_TYPE => &SyntaxInfo { name: "IMPL_TRAIT_TYPE" },
2018-08-13 09:42:43 -05:00
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" },
2018-08-04 07:47:45 -05:00
PATH_PAT => &SyntaxInfo { name: "PATH_PAT" },
STRUCT_PAT => &SyntaxInfo { name: "STRUCT_PAT" },
2018-08-24 11:27:30 -05:00
FIELD_PAT_LIST => &SyntaxInfo { name: "FIELD_PAT_LIST" },
2018-08-07 06:41:03 -05:00
TUPLE_STRUCT_PAT => &SyntaxInfo { name: "TUPLE_STRUCT_PAT" },
2018-08-04 07:47:45 -05:00
TUPLE_PAT => &SyntaxInfo { name: "TUPLE_PAT" },
2018-08-07 09:00:45 -05:00
SLICE_PAT => &SyntaxInfo { name: "SLICE_PAT" },
2018-08-08 07:05:33 -05:00
RANGE_PAT => &SyntaxInfo { name: "RANGE_PAT" },
TUPLE_EXPR => &SyntaxInfo { name: "TUPLE_EXPR" },
2018-08-05 10:24:56 -05:00
ARRAY_EXPR => &SyntaxInfo { name: "ARRAY_EXPR" },
2018-08-05 09:19:03 -05:00
PAREN_EXPR => &SyntaxInfo { name: "PAREN_EXPR" },
2018-07-30 09:02:51 -05:00
PATH_EXPR => &SyntaxInfo { name: "PATH_EXPR" },
2018-07-31 15:13:08 -05:00
LAMBDA_EXPR => &SyntaxInfo { name: "LAMBDA_EXPR" },
2018-07-31 16:14:26 -05:00
IF_EXPR => &SyntaxInfo { name: "IF_EXPR" },
2018-08-27 04:22:09 -05:00
WHILE_EXPR => &SyntaxInfo { name: "WHILE_EXPR" },
CONDITION => &SyntaxInfo { name: "CONDITION" },
2018-08-05 10:16:52 -05:00
LOOP_EXPR => &SyntaxInfo { name: "LOOP_EXPR" },
2018-08-24 03:45:14 -05:00
FOR_EXPR => &SyntaxInfo { name: "FOR_EXPR" },
2018-08-24 03:21:13 -05:00
CONTINUE_EXPR => &SyntaxInfo { name: "CONTINUE_EXPR" },
BREAK_EXPR => &SyntaxInfo { name: "BREAK_EXPR" },
2018-08-24 03:45:14 -05:00
LABEL => &SyntaxInfo { name: "LABEL" },
2018-08-01 03:27:31 -05:00
BLOCK_EXPR => &SyntaxInfo { name: "BLOCK_EXPR" },
RETURN_EXPR => &SyntaxInfo { name: "RETURN_EXPR" },
2018-08-04 05:39:03 -05:00
MATCH_EXPR => &SyntaxInfo { name: "MATCH_EXPR" },
2018-08-24 11:27:30 -05:00
MATCH_ARM_LIST => &SyntaxInfo { name: "MATCH_ARM_LIST" },
2018-08-04 05:39:03 -05:00
MATCH_ARM => &SyntaxInfo { name: "MATCH_ARM" },
MATCH_GUARD => &SyntaxInfo { name: "MATCH_GUARD" },
2018-08-04 08:34:54 -05:00
STRUCT_LIT => &SyntaxInfo { name: "STRUCT_LIT" },
2018-08-24 11:27:30 -05:00
NAMED_FIELD_LIST => &SyntaxInfo { name: "NAMED_FIELD_LIST" },
NAMED_FIELD => &SyntaxInfo { name: "NAMED_FIELD" },
2018-08-04 08:34:54 -05:00
CALL_EXPR => &SyntaxInfo { name: "CALL_EXPR" },
2018-08-05 09:24:44 -05:00
INDEX_EXPR => &SyntaxInfo { name: "INDEX_EXPR" },
2018-08-04 08:34:54 -05:00
METHOD_CALL_EXPR => &SyntaxInfo { name: "METHOD_CALL_EXPR" },
FIELD_EXPR => &SyntaxInfo { name: "FIELD_EXPR" },
TRY_EXPR => &SyntaxInfo { name: "TRY_EXPR" },
2018-08-06 19:55:16 -05:00
CAST_EXPR => &SyntaxInfo { name: "CAST_EXPR" },
2018-08-04 08:34:54 -05:00
REF_EXPR => &SyntaxInfo { name: "REF_EXPR" },
2018-08-07 06:52:03 -05:00
PREFIX_EXPR => &SyntaxInfo { name: "PREFIX_EXPR" },
2018-08-05 10:07:06 -05:00
RANGE_EXPR => &SyntaxInfo { name: "RANGE_EXPR" },
2018-08-04 08:34:54 -05:00
BIN_EXPR => &SyntaxInfo { name: "BIN_EXPR" },
2018-08-24 11:27:30 -05:00
BLOCK => &SyntaxInfo { name: "BLOCK" },
EXTERN_BLOCK => &SyntaxInfo { name: "EXTERN_BLOCK" },
EXTERN_ITEM_LIST => &SyntaxInfo { name: "EXTERN_ITEM_LIST" },
2018-01-28 13:59:18 -06:00
ENUM_VARIANT => &SyntaxInfo { name: "ENUM_VARIANT" },
2018-08-24 11:27:30 -05:00
NAMED_FIELD_DEF_LIST => &SyntaxInfo { name: "NAMED_FIELD_DEF_LIST" },
NAMED_FIELD_DEF => &SyntaxInfo { name: "NAMED_FIELD_DEF" },
POS_FIELD_LIST => &SyntaxInfo { name: "POS_FIELD_LIST" },
2018-01-27 20:36:28 -06:00
POS_FIELD => &SyntaxInfo { name: "POS_FIELD" },
2018-08-24 11:27:30 -05:00
ENUM_VARIANT_LIST => &SyntaxInfo { name: "ENUM_VARIANT_LIST" },
ITEM_LIST => &SyntaxInfo { name: "ITEM_LIST" },
2018-01-27 20:36:28 -06:00
ATTR => &SyntaxInfo { name: "ATTR" },
META_ITEM => &SyntaxInfo { name: "META_ITEM" },
USE_TREE => &SyntaxInfo { name: "USE_TREE" },
2018-08-24 11:27:30 -05:00
USE_TREE_LIST => &SyntaxInfo { name: "USE_TREE_LIST" },
2018-01-27 20:36:28 -06:00
PATH => &SyntaxInfo { name: "PATH" },
PATH_SEGMENT => &SyntaxInfo { name: "PATH_SEGMENT" },
LITERAL => &SyntaxInfo { name: "LITERAL" },
ALIAS => &SyntaxInfo { name: "ALIAS" },
VISIBILITY => &SyntaxInfo { name: "VISIBILITY" },
2018-02-10 03:53:07 -06:00
WHERE_CLAUSE => &SyntaxInfo { name: "WHERE_CLAUSE" },
2018-08-08 11:26:38 -05:00
WHERE_PRED => &SyntaxInfo { name: "WHERE_PRED" },
2018-02-02 13:08:14 -06:00
ABI => &SyntaxInfo { name: "ABI" },
2018-02-10 05:00:23 -06:00
NAME => &SyntaxInfo { name: "NAME" },
NAME_REF => &SyntaxInfo { name: "NAME_REF" },
LET_STMT => &SyntaxInfo { name: "LET_STMT" },
2018-07-31 04:59:52 -05:00
EXPR_STMT => &SyntaxInfo { name: "EXPR_STMT" },
2018-07-30 09:02:51 -05:00
TYPE_PARAM_LIST => &SyntaxInfo { name: "TYPE_PARAM_LIST" },
2018-07-31 11:37:40 -05:00
LIFETIME_PARAM => &SyntaxInfo { name: "LIFETIME_PARAM" },
TYPE_PARAM => &SyntaxInfo { name: "TYPE_PARAM" },
2018-07-30 09:02:51 -05:00
TYPE_ARG_LIST => &SyntaxInfo { name: "TYPE_ARG_LIST" },
2018-07-31 11:37:40 -05:00
LIFETIME_ARG => &SyntaxInfo { name: "LIFETIME_ARG" },
TYPE_ARG => &SyntaxInfo { name: "TYPE_ARG" },
ASSOC_TYPE_ARG => &SyntaxInfo { name: "ASSOC_TYPE_ARG" },
2018-07-31 04:32:53 -05:00
PARAM_LIST => &SyntaxInfo { name: "PARAM_LIST" },
2018-07-31 15:13:55 -05:00
PARAM => &SyntaxInfo { name: "PARAM" },
2018-07-31 10:03:50 -05:00
SELF_PARAM => &SyntaxInfo { name: "SELF_PARAM" },
2018-07-31 04:32:53 -05:00
ARG_LIST => &SyntaxInfo { name: "ARG_LIST" },
2018-01-27 20:36:28 -06:00
TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" },
EOF => &SyntaxInfo { name: "EOF" },
}
}
2018-07-29 07:16:07 -05:00
pub(crate) fn from_keyword(ident: &str) -> Option<SyntaxKind> {
2018-07-30 06:06:22 -05:00
let kw = match ident {
"use" => USE_KW,
"fn" => FN_KW,
"struct" => STRUCT_KW,
"enum" => ENUM_KW,
"trait" => TRAIT_KW,
"impl" => IMPL_KW,
2018-08-13 09:42:43 -05:00
"dyn" => DYN_KW,
2018-07-30 06:06:22 -05:00
"true" => TRUE_KW,
"false" => FALSE_KW,
"as" => AS_KW,
"extern" => EXTERN_KW,
"crate" => CRATE_KW,
"mod" => MOD_KW,
"pub" => PUB_KW,
"self" => SELF_KW,
"super" => SUPER_KW,
"in" => IN_KW,
"where" => WHERE_KW,
"for" => FOR_KW,
"loop" => LOOP_KW,
"while" => WHILE_KW,
2018-08-24 03:21:13 -05:00
"continue" => CONTINUE_KW,
"break" => BREAK_KW,
2018-07-30 06:06:22 -05:00
"if" => IF_KW,
2018-07-31 16:14:26 -05:00
"else" => ELSE_KW,
2018-07-30 06:06:22 -05:00
"match" => MATCH_KW,
"const" => CONST_KW,
"static" => STATIC_KW,
"mut" => MUT_KW,
"unsafe" => UNSAFE_KW,
"type" => TYPE_KW,
"ref" => REF_KW,
"let" => LET_KW,
2018-07-31 16:30:17 -05:00
"move" => MOVE_KW,
2018-08-01 03:27:31 -05:00
"return" => RETURN_KW,
2018-07-30 06:06:22 -05:00
_ => return None,
};
Some(kw)
2018-01-27 20:36:28 -06:00
}
2018-07-30 09:46:50 -05:00
pub(crate) fn from_char(c: char) -> Option<SyntaxKind> {
let tok = match c {
';' => SEMI,
',' => COMMA,
'(' => L_PAREN,
')' => R_PAREN,
'{' => L_CURLY,
'}' => R_CURLY,
'[' => L_BRACK,
']' => R_BRACK,
'<' => L_ANGLE,
'>' => R_ANGLE,
'@' => AT,
'#' => POUND,
'~' => TILDE,
'?' => QUESTION,
'$' => DOLLAR,
2018-08-05 10:18:02 -05:00
'&' => AMP,
2018-07-30 09:46:50 -05:00
'|' => PIPE,
'+' => PLUS,
'*' => STAR,
'/' => SLASH,
'^' => CARET,
'%' => PERCENT,
_ => return None,
};
Some(tok)
}
2018-01-01 09:58:46 -06:00
}
2018-07-29 07:16:07 -05:00