2017-12-28 16:21:54 -06:00
|
|
|
Grammar(
|
2018-07-30 09:46:50 -05:00
|
|
|
single_byte_tokens: [
|
|
|
|
[";", "SEMI"],
|
|
|
|
[",", "COMMA"],
|
|
|
|
["(", "L_PAREN"],
|
|
|
|
[")", "R_PAREN"],
|
|
|
|
["{", "L_CURLY"],
|
|
|
|
["}", "R_CURLY"],
|
|
|
|
["[", "L_BRACK"],
|
|
|
|
["]", "R_BRACK"],
|
|
|
|
["<", "L_ANGLE"],
|
|
|
|
[">", "R_ANGLE"],
|
|
|
|
["@", "AT"],
|
|
|
|
["#", "POUND"],
|
|
|
|
["~", "TILDE"],
|
|
|
|
["?", "QUESTION"],
|
|
|
|
["$", "DOLLAR"],
|
|
|
|
["&", "AMPERSAND"],
|
|
|
|
["|", "PIPE"],
|
|
|
|
["+", "PLUS"],
|
|
|
|
["*", "STAR"],
|
|
|
|
["/", "SLASH"],
|
|
|
|
["^", "CARET"],
|
|
|
|
["%", "PERCENT"],
|
|
|
|
],
|
|
|
|
multi_byte_tokens: [
|
|
|
|
[".", "DOT"],
|
|
|
|
["..", "DOTDOT"],
|
|
|
|
["...", "DOTDOTDOT"],
|
|
|
|
["..=", "DOTDOTEQ"],
|
|
|
|
[":", "COLON"],
|
|
|
|
["::", "COLONCOLON"],
|
|
|
|
["=", "EQ"],
|
|
|
|
["==", "EQEQ"],
|
|
|
|
["=>", "FAT_ARROW"],
|
|
|
|
["!", "EXCL"],
|
|
|
|
["!=", "NEQ"],
|
|
|
|
["-", "MINUS"],
|
|
|
|
["->", "THIN_ARROW"],
|
|
|
|
],
|
2018-01-01 09:58:46 -06:00
|
|
|
keywords: [
|
|
|
|
"use",
|
|
|
|
"fn",
|
|
|
|
"struct",
|
|
|
|
"enum",
|
|
|
|
"trait",
|
|
|
|
"impl",
|
2018-01-08 12:21:59 -06:00
|
|
|
"true",
|
|
|
|
"false",
|
2018-01-08 15:06:42 -06:00
|
|
|
"as",
|
|
|
|
"extern",
|
|
|
|
"crate",
|
2018-01-09 13:35:55 -06:00
|
|
|
"mod",
|
2018-01-12 13:05:46 -06:00
|
|
|
"pub",
|
|
|
|
"self",
|
|
|
|
"super",
|
2018-01-13 02:55:03 -06:00
|
|
|
"in",
|
2018-01-13 13:00:26 -06:00
|
|
|
"where",
|
2018-01-30 13:53:19 -06:00
|
|
|
"for",
|
|
|
|
"loop",
|
|
|
|
"while",
|
|
|
|
"if",
|
2018-07-31 16:14:26 -05:00
|
|
|
"else",
|
2018-02-02 14:30:17 -06:00
|
|
|
"match",
|
|
|
|
"const",
|
|
|
|
"static",
|
2018-02-02 14:45:15 -06:00
|
|
|
"mut",
|
2018-02-03 03:05:25 -06:00
|
|
|
"unsafe",
|
2018-02-10 03:35:40 -06:00
|
|
|
"type",
|
2018-02-17 16:06:48 -06:00
|
|
|
"ref",
|
|
|
|
"let",
|
2018-07-31 16:30:17 -05:00
|
|
|
"move",
|
2018-08-01 03:27:31 -05:00
|
|
|
"return",
|
2018-01-01 09:58:46 -06:00
|
|
|
],
|
2018-02-04 07:46:26 -06:00
|
|
|
contextual_keywords: [
|
|
|
|
"auto",
|
|
|
|
"default",
|
|
|
|
"union",
|
|
|
|
],
|
2017-12-31 14:27:36 -06:00
|
|
|
tokens: [
|
2017-12-29 15:48:47 -06:00
|
|
|
"ERROR",
|
2017-12-28 16:21:54 -06:00
|
|
|
"IDENT",
|
2017-12-29 15:48:47 -06:00
|
|
|
"UNDERSCORE",
|
2017-12-28 16:21:54 -06:00
|
|
|
"WHITESPACE",
|
2017-12-30 06:22:40 -06:00
|
|
|
"INT_NUMBER",
|
|
|
|
"FLOAT_NUMBER",
|
2017-12-31 01:41:42 -06:00
|
|
|
"LIFETIME",
|
2017-12-31 05:02:55 -06:00
|
|
|
"CHAR",
|
|
|
|
"BYTE",
|
|
|
|
"STRING",
|
|
|
|
"RAW_STRING",
|
|
|
|
"BYTE_STRING",
|
|
|
|
"RAW_BYTE_STRING",
|
2017-12-31 07:42:22 -06:00
|
|
|
"COMMENT",
|
|
|
|
"DOC_COMMENT",
|
|
|
|
"SHEBANG",
|
2017-12-31 14:27:36 -06:00
|
|
|
],
|
|
|
|
nodes: [
|
2018-01-01 09:58:46 -06:00
|
|
|
"FILE",
|
2018-02-02 13:08:14 -06:00
|
|
|
|
2018-01-06 08:16:00 -06:00
|
|
|
"STRUCT_ITEM",
|
2018-01-28 13:59:18 -06:00
|
|
|
"ENUM_ITEM",
|
2018-01-07 07:01:30 -06:00
|
|
|
"FN_ITEM",
|
2018-01-08 15:06:42 -06:00
|
|
|
"EXTERN_CRATE_ITEM",
|
2018-01-09 13:35:55 -06:00
|
|
|
"MOD_ITEM",
|
2018-01-09 14:32:18 -06:00
|
|
|
"USE_ITEM",
|
2018-02-02 14:45:15 -06:00
|
|
|
"STATIC_ITEM",
|
2018-02-03 03:05:25 -06:00
|
|
|
"CONST_ITEM",
|
2018-02-04 04:39:24 -06:00
|
|
|
"TRAIT_ITEM",
|
|
|
|
"IMPL_ITEM",
|
2018-02-10 03:35:40 -06:00
|
|
|
"TYPE_ITEM",
|
2018-02-02 13:08:14 -06:00
|
|
|
|
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-02-10 15:46:17 -06:00
|
|
|
|
2018-02-17 16:06:48 -06:00
|
|
|
"REF_PAT",
|
|
|
|
"BIND_PAT",
|
|
|
|
"PLACEHOLDER_PAT",
|
2018-08-04 07:47:45 -05:00
|
|
|
"PATH_PAT",
|
|
|
|
"STRUCT_PAT",
|
|
|
|
"TUPLE_PAT",
|
2018-02-17 16:06:48 -06:00
|
|
|
|
2018-08-04 08:34:54 -05:00
|
|
|
// atoms
|
2018-02-17 16:06:48 -06:00
|
|
|
"TUPLE_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-01 03:27:31 -05:00
|
|
|
"BLOCK_EXPR",
|
|
|
|
"RETURN_EXPR",
|
2018-08-04 05:39:03 -05:00
|
|
|
"MATCH_EXPR",
|
|
|
|
"MATCH_ARM",
|
|
|
|
"MATCH_GUARD",
|
2018-08-04 08:34:54 -05:00
|
|
|
"STRUCT_LIT",
|
|
|
|
"STRUCT_LIT_FIELD",
|
|
|
|
|
|
|
|
// postfix
|
|
|
|
"CALL_EXPR",
|
|
|
|
"METHOD_CALL_EXPR",
|
|
|
|
"FIELD_EXPR",
|
|
|
|
"TRY_EXPR",
|
|
|
|
|
|
|
|
// unary
|
|
|
|
"REF_EXPR",
|
|
|
|
"DEREF_EXPR",
|
|
|
|
"NOT_EXPR",
|
|
|
|
|
|
|
|
"BIN_EXPR",
|
|
|
|
|
2018-02-17 16:06:48 -06:00
|
|
|
|
2018-08-01 02:51:42 -05:00
|
|
|
"EXTERN_BLOCK_EXPR",
|
2018-02-02 13:08:14 -06:00
|
|
|
"ENUM_VARIANT",
|
|
|
|
"NAMED_FIELD",
|
|
|
|
"POS_FIELD",
|
|
|
|
"ATTR",
|
|
|
|
"META_ITEM", // not an item actually
|
2018-01-13 04:42:19 -06:00
|
|
|
"USE_TREE",
|
2018-01-09 14:32:18 -06:00
|
|
|
"PATH",
|
|
|
|
"PATH_SEGMENT",
|
2018-01-08 12:40:00 -06:00
|
|
|
"LITERAL",
|
2018-01-08 15:06:42 -06:00
|
|
|
"ALIAS",
|
2018-01-12 13:05:46 -06:00
|
|
|
"VISIBILITY",
|
2018-02-10 03:53:07 -06:00
|
|
|
"WHERE_CLAUSE",
|
2018-02-02 13:08:14 -06:00
|
|
|
"ABI",
|
2018-02-10 05:00:23 -06:00
|
|
|
"NAME",
|
|
|
|
"NAME_REF",
|
2018-07-31 04:59:52 -05:00
|
|
|
|
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",
|
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",
|
2017-12-28 16:21:54 -06:00
|
|
|
]
|
2018-01-28 09:53:53 -06:00
|
|
|
)
|