rust-analyzer/crates/libsyntax2/src/grammar.ron

327 lines
6.9 KiB
Text
Raw Normal View History

2017-12-28 22:21:54 +00:00
Grammar(
2018-07-30 14:46:50 +00: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"],
2018-08-05 15:18:02 +00:00
["&", "AMP"],
2018-07-30 14:46:50 +00:00
["|", "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-08-05 13:09:25 +00:00
["<=", "LTEQ"],
[">=", "GTEQ"],
["+=", "PLUSEQ"],
["-=", "MINUSEQ"],
2018-08-23 21:48:10 +00:00
["|=", "PIPEEQ"],
["&=", "AMPEQ"],
["^=", "CARETEQ"],
["/=", "SLASHEQ"],
["*=", "STAREQ"],
2018-08-05 15:18:02 +00:00
["&&", "AMPAMP"],
2018-08-05 15:16:52 +00:00
["||", "PIPEPIPE"],
2018-08-07 11:24:03 +00:00
["<<", "SHL"],
[">>", "SHR"],
["<<=", "SHLEQ"],
[">>=", "SHREQ"],
2018-07-30 14:46:50 +00:00
],
2018-01-01 15:58:46 +00:00
keywords: [
"use",
"fn",
"struct",
"enum",
"trait",
"impl",
2018-08-13 14:42:43 +00:00
"dyn",
2018-01-08 18:21:59 +00:00
"true",
"false",
2018-01-08 21:06:42 +00:00
"as",
"extern",
"crate",
2018-01-09 19:35:55 +00:00
"mod",
2018-01-12 19:05:46 +00:00
"pub",
"self",
"super",
2018-01-13 08:55:03 +00:00
"in",
2018-01-13 19:00:26 +00:00
"where",
2018-01-30 19:53:19 +00:00
"for",
"loop",
"while",
2018-08-24 08:21:13 +00:00
"continue",
"break",
2018-01-30 19:53:19 +00:00
"if",
2018-07-31 21:14:26 +00:00
"else",
2018-02-02 20:30:17 +00:00
"match",
"const",
"static",
2018-02-02 20:45:15 +00:00
"mut",
2018-02-03 09:05:25 +00:00
"unsafe",
2018-02-10 09:35:40 +00:00
"type",
"ref",
"let",
2018-07-31 21:30:17 +00:00
"move",
2018-08-01 08:27:31 +00:00
"return",
2018-01-01 15:58:46 +00:00
],
2018-02-04 13:46:26 +00:00
contextual_keywords: [
"auto",
"default",
"union",
],
2017-12-31 20:27:36 +00:00
tokens: [
2017-12-29 21:48:47 +00:00
"ERROR",
2017-12-28 22:21:54 +00:00
"IDENT",
2017-12-29 21:48:47 +00:00
"UNDERSCORE",
2017-12-28 22:21:54 +00:00
"WHITESPACE",
2017-12-30 12:22:40 +00:00
"INT_NUMBER",
"FLOAT_NUMBER",
2017-12-31 07:41:42 +00:00
"LIFETIME",
2017-12-31 11:02:55 +00:00
"CHAR",
"BYTE",
"STRING",
"RAW_STRING",
"BYTE_STRING",
"RAW_BYTE_STRING",
2017-12-31 13:42:22 +00:00
"COMMENT",
"DOC_COMMENT",
"SHEBANG",
2017-12-31 20:27:36 +00:00
],
nodes: [
2018-01-01 15:58:46 +00:00
"FILE",
2018-02-02 19:08:14 +00:00
2018-08-13 15:27:26 +00:00
"STRUCT_DEF",
"ENUM_DEF",
"FN_DEF",
2018-01-08 21:06:42 +00:00
"EXTERN_CRATE_ITEM",
2018-08-11 07:56:40 +00:00
"MODULE",
2018-01-09 20:32:18 +00:00
"USE_ITEM",
2018-08-13 15:27:26 +00:00
"STATIC_DEF",
"CONST_DEF",
"TRAIT_DEF",
2018-02-04 10:39:24 +00:00
"IMPL_ITEM",
2018-08-13 15:27:26 +00:00
"TYPE_DEF",
2018-08-05 11:08:46 +00:00
"MACRO_CALL",
"TOKEN_TREE",
2018-02-02 19:08:14 +00:00
2018-02-10 21:46:17 +00:00
"PAREN_TYPE",
"TUPLE_TYPE",
"NEVER_TYPE",
"PATH_TYPE",
2018-02-11 08:19:54 +00:00
"POINTER_TYPE",
2018-02-11 08:37:08 +00:00
"ARRAY_TYPE",
"SLICE_TYPE",
2018-02-11 08:54:09 +00:00
"REFERENCE_TYPE",
2018-02-11 08:57:05 +00:00
"PLACEHOLDER_TYPE",
2018-02-11 09:51:09 +00:00
"FN_POINTER_TYPE",
2018-02-11 20:32:49 +00:00
"FOR_TYPE",
2018-07-31 19:41:29 +00:00
"IMPL_TRAIT_TYPE",
2018-08-13 14:42:43 +00:00
"DYN_TRAIT_TYPE",
2018-02-10 21:46:17 +00:00
"REF_PAT",
"BIND_PAT",
"PLACEHOLDER_PAT",
2018-08-04 12:47:45 +00:00
"PATH_PAT",
"STRUCT_PAT",
2018-08-07 11:41:03 +00:00
"TUPLE_STRUCT_PAT",
2018-08-04 12:47:45 +00:00
"TUPLE_PAT",
2018-08-07 14:00:45 +00:00
"SLICE_PAT",
2018-08-08 12:05:33 +00:00
"RANGE_PAT",
2018-08-04 13:34:54 +00:00
// atoms
"TUPLE_EXPR",
2018-08-05 15:24:56 +00:00
"ARRAY_EXPR",
2018-08-05 14:19:03 +00:00
"PAREN_EXPR",
2018-07-30 14:02:51 +00:00
"PATH_EXPR",
2018-07-31 20:13:08 +00:00
"LAMBDA_EXPR",
2018-07-31 21:14:26 +00:00
"IF_EXPR",
2018-08-04 22:03:22 +00:00
"WHILE_EXPR",
2018-08-05 15:16:52 +00:00
"LOOP_EXPR",
2018-08-24 08:21:13 +00:00
"CONTINUE_EXPR",
"BREAK_EXPR",
2018-08-05 15:24:56 +00:00
"FOR_EXPR",
2018-08-01 08:27:31 +00:00
"BLOCK_EXPR",
"RETURN_EXPR",
2018-08-04 10:39:03 +00:00
"MATCH_EXPR",
"MATCH_ARM",
"MATCH_GUARD",
2018-08-04 13:34:54 +00:00
"STRUCT_LIT",
"STRUCT_LIT_FIELD",
// postfix
"CALL_EXPR",
2018-08-05 14:24:44 +00:00
"INDEX_EXPR",
2018-08-04 13:34:54 +00:00
"METHOD_CALL_EXPR",
"FIELD_EXPR",
"TRY_EXPR",
2018-08-07 00:55:16 +00:00
"CAST_EXPR",
2018-08-04 13:34:54 +00:00
// unary
"REF_EXPR",
2018-08-07 11:52:03 +00:00
"PREFIX_EXPR",
2018-08-04 13:34:54 +00:00
2018-08-05 15:07:06 +00:00
"RANGE_EXPR", // just weird
2018-08-04 13:34:54 +00:00
"BIN_EXPR",
2018-08-01 07:51:42 +00:00
"EXTERN_BLOCK_EXPR",
2018-02-02 19:08:14 +00:00
"ENUM_VARIANT",
"NAMED_FIELD",
"POS_FIELD",
"ATTR",
"META_ITEM", // not an item actually
2018-01-13 10:42:19 +00:00
"USE_TREE",
2018-01-09 20:32:18 +00:00
"PATH",
"PATH_SEGMENT",
2018-01-08 18:40:00 +00:00
"LITERAL",
2018-01-08 21:06:42 +00:00
"ALIAS",
2018-01-12 19:05:46 +00:00
"VISIBILITY",
2018-02-10 09:53:07 +00:00
"WHERE_CLAUSE",
2018-08-08 16:26:38 +00:00
"WHERE_PRED",
2018-02-02 19:08:14 +00:00
"ABI",
2018-02-10 11:00:23 +00:00
"NAME",
"NAME_REF",
2018-07-31 09:59:52 +00:00
"LET_STMT",
2018-07-31 09:59:52 +00:00
"EXPR_STMT",
2018-07-30 14:02:51 +00:00
"TYPE_PARAM_LIST",
2018-07-31 16:37:40 +00:00
"LIFETIME_PARAM",
"TYPE_PARAM",
2018-07-30 14:02:51 +00:00
"TYPE_ARG_LIST",
2018-07-31 16:37:40 +00:00
"LIFETIME_ARG",
"TYPE_ARG",
"ASSOC_TYPE_ARG",
2018-07-31 09:32:53 +00:00
"PARAM_LIST",
2018-07-31 20:13:55 +00:00
"PARAM",
2018-07-31 15:03:50 +00:00
"SELF_PARAM",
2018-07-31 09:32:53 +00:00
"ARG_LIST",
2018-08-09 14:43:39 +00:00
],
2018-08-11 07:11:58 +00:00
ast: {
"File": (
2018-08-11 06:38:27 +00:00
collections: [
2018-08-21 15:30:10 +00:00
["functions", "FnDef"],
["modules", "Module"],
2018-08-11 06:38:27 +00:00
]
2018-08-09 14:43:39 +00:00
),
2018-08-22 13:46:42 +00:00
"FnDef": ( traits: [
"NameOwner",
"TypeParamsOwner",
"AttrsOwner",
] ),
2018-08-14 11:45:56 +00:00
"StructDef": (
2018-08-22 13:46:42 +00:00
traits: [
"NameOwner",
"TypeParamsOwner",
"AttrsOwner",
],
2018-08-14 11:45:56 +00:00
collections: [
["fields", "NamedField"]
]
),
2018-08-16 09:51:40 +00:00
"NamedField": ( traits: ["NameOwner", "AttrsOwner"] ),
2018-08-22 13:46:42 +00:00
"EnumDef": ( traits: [
"NameOwner",
"TypeParamsOwner",
"AttrsOwner",
] ),
2018-08-16 09:51:40 +00:00
"TraitDef": ( traits: ["NameOwner", "AttrsOwner"] ),
2018-08-21 15:30:10 +00:00
"Module": (
traits: ["NameOwner", "AttrsOwner"],
collections: [
["modules", "Module"]
]
),
2018-08-22 13:46:42 +00:00
"ConstDef": ( traits: [
"NameOwner",
"TypeParamsOwner",
"AttrsOwner",
] ),
"StaticDef": ( traits: [
"NameOwner",
"TypeParamsOwner",
"AttrsOwner",
] ),
"TypeDef": ( traits: [
"NameOwner",
"TypeParamsOwner",
"AttrsOwner",
] ),
2018-08-14 08:20:09 +00:00
"ImplItem": (),
2018-08-14 11:45:56 +00:00
2018-08-14 09:38:20 +00:00
"ParenType": (),
"TupleType": (),
"NeverType": (),
"PathType": (),
"PointerType": (),
"ArrayType": (),
"SliceType": (),
"ReferenceType": (),
"PlaceholderType": (),
"FnPointerType": (),
"ForType": (),
"ImplTraitType": (),
"DynTraitType": (),
"TypeRef": ( enum: [
"ParenType",
"TupleType",
"NeverType",
"PathType",
"PointerType",
"ArrayType",
"SliceType",
"ReferenceType",
"PlaceholderType",
"FnPointerType",
"ForType",
"ImplTraitType",
"DynTraitType",
2018-08-14 10:33:44 +00:00
]),
2018-08-16 10:11:20 +00:00
"NominalDef": (
enum: ["StructDef", "EnumDef"],
2018-08-22 15:05:43 +00:00
traits: [
"NameOwner",
"TypeParamsOwner",
"AttrsOwner"
],
2018-08-16 10:11:20 +00:00
),
2018-08-22 13:46:42 +00:00
"Name": (),
"NameRef": (),
"Attr": ( options: [ ["value", "TokenTree"] ] ),
"TokenTree": (),
2018-08-22 16:02:37 +00:00
"TypeParamList": ( collections: [ ["type_params", "TypeParam" ] ]),
"TypeParam": ( traits: ["NameOwner"]),
2018-08-22 13:46:42 +00:00
"WhereClause": (),
2018-08-11 07:11:58 +00:00
},
2018-01-28 15:53:53 +00:00
)