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)
100 contextual_keywords: [
207 "RANGE_EXPR", // just weird
214 "NAMED_FIELD_DEF_LIST",
216 "POS_FIELD_DEF_LIST",
221 "META_ITEM", // not an item actually
259 traits: [ "ModuleItemOwner", "FnDefOwner" ],
261 ["modules", "Module"],
272 options: [ "ParamList", ["body", "Block"], "RetType" ],
274 "RetType": (options: ["TypeRef"]),
284 "NamedFieldDefList": (collections: [["fields", "NamedFieldDef"]]),
291 "TypeAscriptionOwner"
294 "PosFieldDefList": (collections: [["fields", "PosFieldDef"]]),
295 "PosFieldDef": ( traits: ["VisibilityOwner", "AttrsOwner"], options: ["TypeRef"]),
296 "EnumDef": ( traits: [
302 ], options: [["variant_list", "EnumVariantList"]] ),
303 "EnumVariantList": ( collections: [["variants", "EnumVariant"]] ),
304 "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner", "AttrsOwner"], options: ["Expr"] ),
306 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeParamsOwner", "TypeBoundsOwner"],
307 options: ["ItemList"]
310 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ],
311 options: [ "ItemList" ]
314 collections: [["impl_items", "ImplItem"]],
315 traits: [ "FnDefOwner", "ModuleItemOwner" ],
324 "TypeAscriptionOwner",
326 options: [ ["body","Expr"]],
335 "TypeAscriptionOwner",
337 options: [ ["body","Expr"]],
350 "ImplBlock": (options: ["ItemList"], traits: ["TypeParamsOwner", "AttrsOwner"]),
352 "ParenType": (options: ["TypeRef"]),
353 "TupleType": ( collections: [["fields", "TypeRef"]] ),
355 "PathType": (options: ["Path"]),
356 "PointerType": (options: ["TypeRef"]),
357 "ArrayType": ( options: ["TypeRef", "Expr"] ),
358 "SliceType": ( options: ["TypeRef"] ),
359 "ReferenceType": (options: ["TypeRef"]),
360 "PlaceholderType": (),
361 "FnPointerType": (options: ["ParamList", "RetType"]),
362 "ForType": (options: ["TypeRef"]),
364 traits: ["TypeBoundsOwner"],
367 traits: ["TypeBoundsOwner"],
387 enum: ["StructDef", "EnumDef"],
395 enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeAliasDef", "ImplBlock",
396 "UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ]
399 enum: ["FnDef", "TypeAliasDef", "ConstDef"]
403 collections: [["exprs", "Expr"]]
406 collections: [["exprs", "Expr"]]
408 "ParenExpr": (options: ["Expr"]),
409 "PathExpr": (options: ["Path"]),
417 options: [ "Condition" ]
420 traits: ["LoopBodyOwner"],
423 traits: ["TryBlockBodyOwner"],
426 traits: ["LoopBodyOwner"],
429 ["iterable", "Expr"],
433 traits: ["LoopBodyOwner"],
434 options: [ "Condition" ]
437 "BreakExpr": (options: ["Expr"]),
442 "ReturnExpr": (options: ["Expr"]),
444 options: [ "Expr", "MatchArmList" ],
447 collections: [ ["arms", "MatchArm"] ],
448 traits: [ "AttrsOwner" ]
452 [ "guard", "MatchGuard" ],
455 collections: [ [ "pats", "Pat" ] ],
456 traits: [ "AttrsOwner" ]
458 "MatchGuard": (options: ["Expr"]),
459 "StructLit": (options: ["Path", "NamedFieldList"]),
461 collections: [ ["fields", "NamedField"] ],
462 options: [["spread", "Expr"]]
464 "NamedField": (options: ["NameRef", "Expr"]),
466 traits: ["ArgListOwner"],
470 traits: ["ArgListOwner"],
471 options: [ "Expr", "NameRef", "TypeArgList" ],
474 "FieldExpr": (options: ["Expr", "NameRef"]),
475 "TryExpr": (options: ["Expr"]),
476 "CastExpr": (options: ["Expr", "TypeRef"]),
477 "RefExpr": (options: ["Expr"]),
478 "PrefixExpr": (options: ["Expr"]),
518 "RefPat": ( options: [ "Pat" ]),
521 traits: ["NameOwner"]
523 "PlaceholderPat": (),
524 "PathPat": ( options: [ "Path" ] ),
525 "StructPat": ( options: ["FieldPatList", "Path"] ),
528 ["field_pats", "FieldPat"],
529 ["bind_pats", "BindPat"],
533 traits: ["NameOwner"],
538 collections: [["args", "Pat"]],
540 "TuplePat": ( collections: [["args", "Pat"]] ),
543 "LiteralPat": (options: ["Literal"]),
564 traits: [ "NameOwner", "AttrsOwner","DocCommentsOwner" ],
565 options: [ "TokenTree", "Path" ],
567 "Attr": ( options: [ ["value", "TokenTree"] ] ),
571 ["type_params", "TypeParam" ],
572 ["lifetime_params", "LifetimeParam" ],
575 "TypeParam": ( traits: ["NameOwner", "AttrsOwner", "TypeBoundsOwner", "DefaultTypeParamOwner"] ),
577 traits: ["AttrsOwner"],
586 ["bounds", "TypeBound"],
599 ["predicates", "WherePred"],
603 options: [ ["expr", "Expr"] ]
608 ["initializer", "Expr"],
611 "TypeAscriptionOwner",
615 options: [ "Pat", "Expr" ]
618 enum: ["ExprStmt", "LetStmt"],
623 ["statements", "Stmt"],
630 options: [ "SelfParam" ],
637 "TypeAscriptionOwner",
643 "TypeAscriptionOwner",
647 traits: ["AttrsOwner"],
648 options: [ "UseTree" ],
651 options: [ "Path", "UseTreeList", "Alias" ]
654 traits: ["NameOwner"],
657 collections: [["use_trees", "UseTree"]]
660 options: ["NameRef", "Alias"],
669 ["segment", "PathSegment"],
670 ["qualifier", "Path"],
674 options: [ "NameRef", "TypeArgList" ]
676 "TypeArgList": (collections: [
677 ["type_args", "TypeArg"],
678 ["lifetime_args", "LifetimeArg"],
679 ["assoc_type_args", "AssocTypeArg"],
681 "TypeArg": (options: ["TypeRef"]),
682 "AssocTypeArg": (options: ["NameRef", "TypeRef"]),
686 traits: [ "ModuleItemOwner", "FnDefOwner" ],
692 ["statements", "Stmt"],