2020-02-07 15:35:34 -06:00
|
|
|
//! Generated file, do not edit by hand, see `xtask/src/codegen`
|
2018-10-04 15:43:58 -05:00
|
|
|
|
2018-01-27 20:36:28 -06:00
|
|
|
#![allow(bad_style, missing_docs, unreachable_pub)]
|
2019-08-19 03:02:18 -05:00
|
|
|
#[doc = r" The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`."]
|
2019-08-19 05:11:51 -05:00
|
|
|
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
2019-04-08 17:06:30 -05:00
|
|
|
#[repr(u16)]
|
2018-01-27 20:36:28 -06:00
|
|
|
pub enum SyntaxKind {
|
2018-08-08 15:09:40 -05:00
|
|
|
#[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,
|
2019-01-31 01:30:15 -06:00
|
|
|
UNDERSCORE,
|
2018-07-30 09:46:50 -05:00
|
|
|
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,
|
2019-01-07 12:03:25 -06:00
|
|
|
PERCENTEQ,
|
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,
|
2020-01-03 13:37:02 -06:00
|
|
|
AS_KW,
|
2019-03-09 17:40:22 -06:00
|
|
|
ASYNC_KW,
|
2020-01-03 13:37:02 -06:00
|
|
|
AWAIT_KW,
|
|
|
|
BOX_KW,
|
|
|
|
BREAK_KW,
|
|
|
|
CONST_KW,
|
|
|
|
CONTINUE_KW,
|
|
|
|
CRATE_KW,
|
2018-08-13 09:42:43 -05:00
|
|
|
DYN_KW,
|
2020-01-03 13:37:02 -06:00
|
|
|
ELSE_KW,
|
|
|
|
ENUM_KW,
|
2018-02-04 07:46:26 -06:00
|
|
|
EXTERN_KW,
|
2020-01-03 13:37:02 -06:00
|
|
|
FALSE_KW,
|
|
|
|
FN_KW,
|
2018-02-04 07:46:26 -06:00
|
|
|
FOR_KW,
|
|
|
|
IF_KW,
|
2020-01-03 13:37:02 -06:00
|
|
|
IMPL_KW,
|
|
|
|
IN_KW,
|
|
|
|
LET_KW,
|
|
|
|
LOOP_KW,
|
|
|
|
MACRO_KW,
|
2018-02-04 07:46:26 -06:00
|
|
|
MATCH_KW,
|
2020-01-03 13:37:02 -06:00
|
|
|
MOD_KW,
|
|
|
|
MOVE_KW,
|
2018-02-04 07:46:26 -06:00
|
|
|
MUT_KW,
|
2020-01-03 13:37:02 -06:00
|
|
|
PUB_KW,
|
2018-02-17 16:06:48 -06:00
|
|
|
REF_KW,
|
2018-08-01 03:27:31 -05:00
|
|
|
RETURN_KW,
|
2020-01-03 13:37:02 -06:00
|
|
|
SELF_KW,
|
|
|
|
STATIC_KW,
|
|
|
|
STRUCT_KW,
|
|
|
|
SUPER_KW,
|
|
|
|
TRAIT_KW,
|
|
|
|
TRUE_KW,
|
2019-06-06 06:36:16 -05:00
|
|
|
TRY_KW,
|
2020-01-03 13:37:02 -06:00
|
|
|
TYPE_KW,
|
|
|
|
UNSAFE_KW,
|
|
|
|
USE_KW,
|
|
|
|
WHERE_KW,
|
|
|
|
WHILE_KW,
|
2018-02-04 07:46:26 -06:00
|
|
|
AUTO_KW,
|
|
|
|
DEFAULT_KW,
|
2019-06-11 08:24:14 -05:00
|
|
|
EXISTENTIAL_KW,
|
2018-02-04 07:46:26 -06:00
|
|
|
UNION_KW,
|
2018-07-30 10:02:13 -05:00
|
|
|
INT_NUMBER,
|
|
|
|
FLOAT_NUMBER,
|
|
|
|
CHAR,
|
|
|
|
BYTE,
|
|
|
|
STRING,
|
|
|
|
RAW_STRING,
|
|
|
|
BYTE_STRING,
|
|
|
|
RAW_BYTE_STRING,
|
2019-01-31 01:30:15 -06:00
|
|
|
ERROR,
|
|
|
|
IDENT,
|
|
|
|
WHITESPACE,
|
|
|
|
LIFETIME,
|
2018-07-30 10:02:13 -05:00
|
|
|
COMMENT,
|
|
|
|
SHEBANG,
|
2019-04-10 22:02:41 -05:00
|
|
|
L_DOLLAR,
|
|
|
|
R_DOLLAR,
|
2018-11-07 09:38:43 -06:00
|
|
|
SOURCE_FILE,
|
2018-08-13 10:27:26 -05:00
|
|
|
STRUCT_DEF,
|
2019-11-25 07:55:09 -06:00
|
|
|
UNION_DEF,
|
2018-08-13 10:27:26 -05:00
|
|
|
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,
|
2020-02-29 14:24:40 -06:00
|
|
|
IMPL_DEF,
|
2019-02-25 04:38:52 -06:00
|
|
|
TYPE_ALIAS_DEF,
|
2018-08-05 06:08:46 -05:00
|
|
|
MACRO_CALL,
|
|
|
|
TOKEN_TREE,
|
2019-12-21 04:29:14 -06:00
|
|
|
MACRO_DEF,
|
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,
|
2020-02-09 12:57:01 -06:00
|
|
|
OR_PAT,
|
|
|
|
PAREN_PAT,
|
2018-02-17 16:06:48 -06:00
|
|
|
REF_PAT,
|
2019-08-23 15:04:58 -05:00
|
|
|
BOX_PAT,
|
2018-02-17 16:06:48 -06:00
|
|
|
BIND_PAT,
|
|
|
|
PLACEHOLDER_PAT,
|
2019-09-14 19:05:12 -05:00
|
|
|
DOT_DOT_PAT,
|
2018-08-04 07:47:45 -05:00
|
|
|
PATH_PAT,
|
2019-08-23 07:55:21 -05:00
|
|
|
RECORD_PAT,
|
|
|
|
RECORD_FIELD_PAT_LIST,
|
|
|
|
RECORD_FIELD_PAT,
|
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,
|
2019-02-09 12:07:35 -06:00
|
|
|
LITERAL_PAT,
|
2020-04-03 08:38:42 -05:00
|
|
|
MACRO_PAT,
|
2018-02-17 16:06:48 -06:00
|
|
|
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,
|
2019-08-23 07:55:21 -05:00
|
|
|
RECORD_LIT,
|
|
|
|
RECORD_FIELD_LIST,
|
|
|
|
RECORD_FIELD,
|
2019-06-06 06:36:16 -05:00
|
|
|
TRY_BLOCK_EXPR,
|
2019-06-18 10:50:57 -05:00
|
|
|
BOX_EXPR,
|
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,
|
2019-07-20 03:41:31 -05:00
|
|
|
AWAIT_EXPR,
|
2018-08-04 08:34:54 -05:00
|
|
|
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,
|
2019-08-23 07:55:21 -05:00
|
|
|
RECORD_FIELD_DEF_LIST,
|
|
|
|
RECORD_FIELD_DEF,
|
|
|
|
TUPLE_FIELD_DEF_LIST,
|
|
|
|
TUPLE_FIELD_DEF,
|
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,
|
2018-02-17 16:06:48 -06:00
|
|
|
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,
|
2019-12-21 18:38:23 -06:00
|
|
|
CONST_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,
|
2020-01-06 16:59:03 -06:00
|
|
|
CONST_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,
|
2019-03-30 10:11:21 -05:00
|
|
|
TYPE_BOUND,
|
|
|
|
TYPE_BOUND_LIST,
|
2019-04-18 13:47:29 -05:00
|
|
|
MACRO_ITEMS,
|
|
|
|
MACRO_STMTS,
|
2019-04-08 17:06:30 -05:00
|
|
|
#[doc(hidden)]
|
|
|
|
__LAST,
|
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 {
|
2020-01-03 13:37:02 -06:00
|
|
|
AS_KW | ASYNC_KW | AWAIT_KW | BOX_KW | BREAK_KW | CONST_KW | CONTINUE_KW | CRATE_KW
|
|
|
|
| DYN_KW | ELSE_KW | ENUM_KW | EXTERN_KW | FALSE_KW | FN_KW | FOR_KW | IF_KW
|
|
|
|
| IMPL_KW | IN_KW | LET_KW | LOOP_KW | MACRO_KW | MATCH_KW | MOD_KW | MOVE_KW
|
|
|
|
| MUT_KW | PUB_KW | REF_KW | RETURN_KW | SELF_KW | STATIC_KW | STRUCT_KW | SUPER_KW
|
|
|
|
| TRAIT_KW | TRUE_KW | TRY_KW | TYPE_KW | UNSAFE_KW | USE_KW | WHERE_KW | WHILE_KW
|
|
|
|
| AUTO_KW | DEFAULT_KW | EXISTENTIAL_KW | UNION_KW => true,
|
2019-08-19 03:02:18 -05:00
|
|
|
_ => false,
|
2018-08-01 02:40:07 -05:00
|
|
|
}
|
|
|
|
}
|
2019-01-31 01:30:15 -06:00
|
|
|
pub fn is_punct(self) -> bool {
|
|
|
|
match self {
|
2019-08-19 03:02:18 -05:00
|
|
|
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,
|
2019-01-31 01:30:15 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
pub fn is_literal(self) -> bool {
|
|
|
|
match self {
|
2019-08-19 03:02:18 -05:00
|
|
|
INT_NUMBER | FLOAT_NUMBER | CHAR | BYTE | STRING | RAW_STRING | BYTE_STRING
|
|
|
|
| RAW_BYTE_STRING => true,
|
|
|
|
_ => false,
|
2019-01-31 01:30:15 -06:00
|
|
|
}
|
|
|
|
}
|
2019-02-21 04:27:45 -06:00
|
|
|
pub fn from_keyword(ident: &str) -> Option<SyntaxKind> {
|
2018-07-30 06:06:22 -05:00
|
|
|
let kw = match ident {
|
2020-01-03 13:37:02 -06:00
|
|
|
"as" => AS_KW,
|
2019-03-09 17:40:22 -06:00
|
|
|
"async" => ASYNC_KW,
|
2020-01-03 13:37:02 -06:00
|
|
|
"await" => AWAIT_KW,
|
|
|
|
"box" => BOX_KW,
|
|
|
|
"break" => BREAK_KW,
|
|
|
|
"const" => CONST_KW,
|
|
|
|
"continue" => CONTINUE_KW,
|
|
|
|
"crate" => CRATE_KW,
|
2018-08-13 09:42:43 -05:00
|
|
|
"dyn" => DYN_KW,
|
2020-01-03 13:37:02 -06:00
|
|
|
"else" => ELSE_KW,
|
|
|
|
"enum" => ENUM_KW,
|
2018-07-30 06:06:22 -05:00
|
|
|
"extern" => EXTERN_KW,
|
2020-01-03 13:37:02 -06:00
|
|
|
"false" => FALSE_KW,
|
|
|
|
"fn" => FN_KW,
|
2018-07-30 06:06:22 -05:00
|
|
|
"for" => FOR_KW,
|
|
|
|
"if" => IF_KW,
|
2020-01-03 13:37:02 -06:00
|
|
|
"impl" => IMPL_KW,
|
|
|
|
"in" => IN_KW,
|
|
|
|
"let" => LET_KW,
|
|
|
|
"loop" => LOOP_KW,
|
|
|
|
"macro" => MACRO_KW,
|
2018-07-30 06:06:22 -05:00
|
|
|
"match" => MATCH_KW,
|
2020-01-03 13:37:02 -06:00
|
|
|
"mod" => MOD_KW,
|
|
|
|
"move" => MOVE_KW,
|
2018-07-30 06:06:22 -05:00
|
|
|
"mut" => MUT_KW,
|
2020-01-03 13:37:02 -06:00
|
|
|
"pub" => PUB_KW,
|
2018-07-30 06:06:22 -05:00
|
|
|
"ref" => REF_KW,
|
2018-08-01 03:27:31 -05:00
|
|
|
"return" => RETURN_KW,
|
2020-01-03 13:37:02 -06:00
|
|
|
"self" => SELF_KW,
|
|
|
|
"static" => STATIC_KW,
|
|
|
|
"struct" => STRUCT_KW,
|
|
|
|
"super" => SUPER_KW,
|
|
|
|
"trait" => TRAIT_KW,
|
|
|
|
"true" => TRUE_KW,
|
2019-06-06 06:36:16 -05:00
|
|
|
"try" => TRY_KW,
|
2020-01-03 13:37:02 -06:00
|
|
|
"type" => TYPE_KW,
|
|
|
|
"unsafe" => UNSAFE_KW,
|
|
|
|
"use" => USE_KW,
|
|
|
|
"where" => WHERE_KW,
|
|
|
|
"while" => WHILE_KW,
|
2018-07-30 06:06:22 -05:00
|
|
|
_ => return None,
|
|
|
|
};
|
|
|
|
Some(kw)
|
2018-01-27 20:36:28 -06:00
|
|
|
}
|
2019-02-21 04:27:45 -06:00
|
|
|
pub fn from_char(c: char) -> Option<SyntaxKind> {
|
2018-07-30 09:46:50 -05:00
|
|
|
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,
|
2019-01-31 01:30:15 -06:00
|
|
|
'_' => UNDERSCORE,
|
2019-09-22 15:46:27 -05:00
|
|
|
'.' => DOT,
|
|
|
|
':' => COLON,
|
|
|
|
'=' => EQ,
|
|
|
|
'!' => EXCL,
|
|
|
|
'-' => MINUS,
|
2018-07-30 09:46:50 -05:00
|
|
|
_ => return None,
|
|
|
|
};
|
|
|
|
Some(tok)
|
|
|
|
}
|
2018-01-01 09:58:46 -06:00
|
|
|
}
|
2019-08-19 03:02:18 -05:00
|
|
|
#[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
|
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( as ) => {
|
|
|
|
$crate::SyntaxKind::AS_KW
|
|
|
|
};
|
2019-08-19 03:02:18 -05:00
|
|
|
( async ) => {
|
|
|
|
$crate::SyntaxKind::ASYNC_KW
|
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( await ) => {
|
|
|
|
$crate::SyntaxKind::AWAIT_KW
|
2019-08-19 03:02:18 -05:00
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( box ) => {
|
|
|
|
$crate::SyntaxKind::BOX_KW
|
2019-08-19 03:02:18 -05:00
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( break ) => {
|
|
|
|
$crate::SyntaxKind::BREAK_KW
|
2019-08-19 03:02:18 -05:00
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( const ) => {
|
|
|
|
$crate::SyntaxKind::CONST_KW
|
2019-08-19 03:02:18 -05:00
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( continue ) => {
|
|
|
|
$crate::SyntaxKind::CONTINUE_KW
|
2019-08-19 03:02:18 -05:00
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( crate ) => {
|
|
|
|
$crate::SyntaxKind::CRATE_KW
|
2019-08-19 03:02:18 -05:00
|
|
|
};
|
|
|
|
( dyn ) => {
|
|
|
|
$crate::SyntaxKind::DYN_KW
|
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( else ) => {
|
|
|
|
$crate::SyntaxKind::ELSE_KW
|
2019-08-19 03:02:18 -05:00
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( enum ) => {
|
|
|
|
$crate::SyntaxKind::ENUM_KW
|
2019-08-19 03:02:18 -05:00
|
|
|
};
|
|
|
|
( extern ) => {
|
|
|
|
$crate::SyntaxKind::EXTERN_KW
|
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( false ) => {
|
|
|
|
$crate::SyntaxKind::FALSE_KW
|
2019-08-19 03:02:18 -05:00
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( fn ) => {
|
|
|
|
$crate::SyntaxKind::FN_KW
|
2019-08-19 03:02:18 -05:00
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( for ) => {
|
|
|
|
$crate::SyntaxKind::FOR_KW
|
2019-08-19 03:02:18 -05:00
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( if ) => {
|
|
|
|
$crate::SyntaxKind::IF_KW
|
2019-08-19 03:02:18 -05:00
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( impl ) => {
|
|
|
|
$crate::SyntaxKind::IMPL_KW
|
2019-08-19 03:02:18 -05:00
|
|
|
};
|
|
|
|
( in ) => {
|
|
|
|
$crate::SyntaxKind::IN_KW
|
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( let ) => {
|
|
|
|
$crate::SyntaxKind::LET_KW
|
2019-08-19 03:02:18 -05:00
|
|
|
};
|
|
|
|
( loop ) => {
|
|
|
|
$crate::SyntaxKind::LOOP_KW
|
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( macro ) => {
|
|
|
|
$crate::SyntaxKind::MACRO_KW
|
2019-08-19 03:02:18 -05:00
|
|
|
};
|
|
|
|
( match ) => {
|
|
|
|
$crate::SyntaxKind::MATCH_KW
|
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( mod ) => {
|
|
|
|
$crate::SyntaxKind::MOD_KW
|
2019-08-19 03:02:18 -05:00
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( move ) => {
|
|
|
|
$crate::SyntaxKind::MOVE_KW
|
2019-08-19 03:02:18 -05:00
|
|
|
};
|
|
|
|
( mut ) => {
|
|
|
|
$crate::SyntaxKind::MUT_KW
|
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( pub ) => {
|
|
|
|
$crate::SyntaxKind::PUB_KW
|
2019-08-19 03:02:18 -05:00
|
|
|
};
|
|
|
|
( ref ) => {
|
|
|
|
$crate::SyntaxKind::REF_KW
|
|
|
|
};
|
|
|
|
( return ) => {
|
|
|
|
$crate::SyntaxKind::RETURN_KW
|
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( self ) => {
|
|
|
|
$crate::SyntaxKind::SELF_KW
|
|
|
|
};
|
|
|
|
( static ) => {
|
|
|
|
$crate::SyntaxKind::STATIC_KW
|
|
|
|
};
|
|
|
|
( struct ) => {
|
|
|
|
$crate::SyntaxKind::STRUCT_KW
|
|
|
|
};
|
|
|
|
( super ) => {
|
|
|
|
$crate::SyntaxKind::SUPER_KW
|
|
|
|
};
|
|
|
|
( trait ) => {
|
|
|
|
$crate::SyntaxKind::TRAIT_KW
|
|
|
|
};
|
|
|
|
( true ) => {
|
|
|
|
$crate::SyntaxKind::TRUE_KW
|
|
|
|
};
|
2019-08-19 03:02:18 -05:00
|
|
|
( try ) => {
|
|
|
|
$crate::SyntaxKind::TRY_KW
|
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( type ) => {
|
|
|
|
$crate::SyntaxKind::TYPE_KW
|
2019-08-19 03:02:18 -05:00
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( unsafe ) => {
|
|
|
|
$crate::SyntaxKind::UNSAFE_KW
|
2019-08-19 03:02:18 -05:00
|
|
|
};
|
2020-01-03 13:37:02 -06:00
|
|
|
( use ) => {
|
|
|
|
$crate::SyntaxKind::USE_KW
|
|
|
|
};
|
|
|
|
( where ) => {
|
|
|
|
$crate::SyntaxKind::WHERE_KW
|
|
|
|
};
|
|
|
|
( while ) => {
|
|
|
|
$crate::SyntaxKind::WHILE_KW
|
2019-12-21 04:29:14 -06:00
|
|
|
};
|
2019-08-19 03:02:18 -05:00
|
|
|
( auto ) => {
|
|
|
|
$crate::SyntaxKind::AUTO_KW
|
|
|
|
};
|
|
|
|
( default ) => {
|
|
|
|
$crate::SyntaxKind::DEFAULT_KW
|
|
|
|
};
|
|
|
|
( existential ) => {
|
|
|
|
$crate::SyntaxKind::EXISTENTIAL_KW
|
|
|
|
};
|
|
|
|
( union ) => {
|
|
|
|
$crate::SyntaxKind::UNION_KW
|
|
|
|
};
|
|
|
|
}
|