1 // Stores definitions which must be used in multiple places
2 // See `cargo gen-syntax` (defined in crates/tools/src/main.rs)
29 // Tokens for which the longest match must be chosen (e.g. `..` is a DOTDOT, but `.` is a DOT)
99 contextual_keywords: [
205 "RANGE_EXPR", // just weird
212 "NAMED_FIELD_DEF_LIST",
214 "POS_FIELD_DEF_LIST",
219 "META_ITEM", // not an item actually
257 traits: [ "ModuleItemOwner", "FnDefOwner" ],
259 ["modules", "Module"],
270 options: [ "ParamList", ["body", "Block"], "RetType" ],
272 "RetType": (options: ["TypeRef"]),
282 "NamedFieldDefList": (collections: [["fields", "NamedFieldDef"]]),
289 "TypeAscriptionOwner"
292 "PosFieldDefList": (collections: [["fields", "PosFieldDef"]]),
293 "PosFieldDef": ( traits: ["VisibilityOwner", "AttrsOwner"], options: ["TypeRef"]),
294 "EnumDef": ( traits: [
300 ], options: [["variant_list", "EnumVariantList"]] ),
301 "EnumVariantList": ( collections: [["variants", "EnumVariant"]] ),
302 "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner", "AttrsOwner"], options: ["Expr"] ),
304 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeParamsOwner", "TypeBoundsOwner"],
305 options: ["ItemList"]
308 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ],
309 options: [ "ItemList" ]
312 collections: [["impl_items", "ImplItem"]],
313 traits: [ "FnDefOwner", "ModuleItemOwner" ],
322 "TypeAscriptionOwner",
324 options: [ ["body","Expr"]],
333 "TypeAscriptionOwner",
335 options: [ ["body","Expr"]],
348 "ImplBlock": (options: ["ItemList"], traits: ["TypeParamsOwner", "AttrsOwner"]),
350 "ParenType": (options: ["TypeRef"]),
351 "TupleType": ( collections: [["fields", "TypeRef"]] ),
353 "PathType": (options: ["Path"]),
354 "PointerType": (options: ["TypeRef"]),
355 "ArrayType": ( options: ["TypeRef", "Expr"] ),
356 "SliceType": ( options: ["TypeRef"] ),
357 "ReferenceType": (options: ["TypeRef"]),
358 "PlaceholderType": (),
359 "FnPointerType": (options: ["ParamList", "RetType"]),
360 "ForType": (options: ["TypeRef"]),
362 traits: ["TypeBoundsOwner"],
365 traits: ["TypeBoundsOwner"],
385 enum: ["StructDef", "EnumDef"],
393 enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeAliasDef", "ImplBlock",
394 "UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ]
397 enum: ["FnDef", "TypeAliasDef", "ConstDef"]
401 collections: [["exprs", "Expr"]]
404 collections: [["exprs", "Expr"]]
406 "ParenExpr": (options: ["Expr"]),
407 "PathExpr": (options: ["Path"]),
415 options: [ "Condition" ]
418 traits: ["LoopBodyOwner"],
421 traits: ["LoopBodyOwner"],
424 ["iterable", "Expr"],
428 traits: ["LoopBodyOwner"],
429 options: [ "Condition" ]
432 "BreakExpr": (options: ["Expr"]),
437 "ReturnExpr": (options: ["Expr"]),
439 options: [ "Expr", "MatchArmList" ],
442 collections: [ ["arms", "MatchArm"] ],
443 traits: [ "AttrsOwner" ]
447 [ "guard", "MatchGuard" ],
450 collections: [ [ "pats", "Pat" ] ],
451 traits: [ "AttrsOwner" ]
453 "MatchGuard": (options: ["Expr"]),
454 "StructLit": (options: ["Path", "NamedFieldList"]),
456 collections: [ ["fields", "NamedField"] ],
457 options: [["spread", "Expr"]]
459 "NamedField": (options: ["NameRef", "Expr"]),
461 traits: ["ArgListOwner"],
465 traits: ["ArgListOwner"],
466 options: [ "Expr", "NameRef", "TypeArgList" ],
469 "FieldExpr": (options: ["Expr", "NameRef"]),
470 "TryExpr": (options: ["Expr"]),
471 "CastExpr": (options: ["Expr", "TypeRef"]),
472 "RefExpr": (options: ["Expr"]),
473 "PrefixExpr": (options: ["Expr"]),
512 "RefPat": ( options: [ "Pat" ]),
515 traits: ["NameOwner"]
517 "PlaceholderPat": (),
518 "PathPat": ( options: [ "Path" ] ),
519 "StructPat": ( options: ["FieldPatList", "Path"] ),
522 ["field_pats", "FieldPat"],
523 ["bind_pats", "BindPat"],
527 traits: ["NameOwner"],
532 collections: [["args", "Pat"]],
534 "TuplePat": ( collections: [["args", "Pat"]] ),
537 "LiteralPat": (options: ["Literal"]),
558 traits: [ "NameOwner", "AttrsOwner","DocCommentsOwner" ],
559 options: [ "TokenTree", "Path" ],
561 "Attr": ( options: [ ["value", "TokenTree"] ] ),
565 ["type_params", "TypeParam" ],
566 ["lifetime_params", "LifetimeParam" ],
569 "TypeParam": ( traits: ["NameOwner", "AttrsOwner", "TypeBoundsOwner", "DefaultTypeParamOwner"] ),
571 traits: ["AttrsOwner"],
580 ["bounds", "TypeBound"],
593 ["predicates", "WherePred"],
597 options: [ ["expr", "Expr"] ]
602 ["initializer", "Expr"],
605 "TypeAscriptionOwner",
609 options: [ "Pat", "Expr" ]
612 enum: ["ExprStmt", "LetStmt"],
617 ["statements", "Stmt"],
624 options: [ "SelfParam" ],
631 "TypeAscriptionOwner",
637 "TypeAscriptionOwner",
641 traits: ["AttrsOwner"],
642 options: [ "UseTree" ],
645 options: [ "Path", "UseTreeList", "Alias" ]
648 traits: ["NameOwner"],
651 collections: [["use_trees", "UseTree"]]
654 options: ["NameRef", "Alias"],
663 ["segment", "PathSegment"],
664 ["qualifier", "Path"],
668 options: [ "NameRef", "TypeArgList" ]
670 "TypeArgList": (collections: [
671 ["type_args", "TypeArg"],
672 ["lifetime_args", "LifetimeArg"],
673 ["assoc_type_args", "AssocTypeArg"],
675 "TypeArg": (options: ["TypeRef"]),
676 "AssocTypeArg": (options: ["NameRef", "TypeRef"]),
680 traits: [ "ModuleItemOwner", "FnDefOwner" ],
686 ["statements", "Stmt"],