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)
102 contextual_keywords: [
167 "RECORD_FIELD_PAT_LIST",
214 "RANGE_EXPR", // just weird
221 "RECORD_FIELD_DEF_LIST",
223 "TUPLE_FIELD_DEF_LIST",
228 "META_ITEM", // not an item actually
266 traits: [ "ModuleItemOwner", "FnDefOwner" ],
268 ("modules", "Module"),
279 options: [ "ParamList", ["body", "BlockExpr"], "RetType" ],
281 "RetType": (options: ["TypeRef"]),
291 "RecordFieldDefList": (collections: [("fields", "RecordFieldDef")]),
298 "TypeAscriptionOwner"
301 "TupleFieldDefList": (collections: [("fields", "TupleFieldDef")]),
302 "TupleFieldDef": ( traits: ["VisibilityOwner", "AttrsOwner"], options: ["TypeRef"]),
303 "EnumDef": ( traits: [
309 ], options: [["variant_list", "EnumVariantList"]] ),
310 "EnumVariantList": ( collections: [("variants", "EnumVariant")] ),
311 "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner", "AttrsOwner"], options: ["Expr"] ),
313 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeParamsOwner", "TypeBoundsOwner"],
314 options: ["ItemList"]
317 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ],
318 options: [ "ItemList" ]
321 collections: [("impl_items", "ImplItem")],
322 traits: [ "FnDefOwner", "ModuleItemOwner" ],
331 "TypeAscriptionOwner",
333 options: [ ["body","Expr"]],
342 "TypeAscriptionOwner",
344 options: [ ["body","Expr"]],
357 "ImplBlock": (options: ["ItemList"], traits: ["TypeParamsOwner", "AttrsOwner"]),
359 "ParenType": (options: ["TypeRef"]),
360 "TupleType": ( collections: [("fields", "TypeRef")] ),
362 "PathType": (options: ["Path"]),
363 "PointerType": (options: ["TypeRef"]),
364 "ArrayType": ( options: ["TypeRef", "Expr"] ),
365 "SliceType": ( options: ["TypeRef"] ),
366 "ReferenceType": (options: ["TypeRef"]),
367 "PlaceholderType": (),
368 "FnPointerType": (options: ["ParamList", "RetType"]),
369 "ForType": (options: ["TypeRef"]),
371 traits: ["TypeBoundsOwner"],
374 traits: ["TypeBoundsOwner"],
394 enum: ["StructDef", "EnumDef"],
402 enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeAliasDef", "ImplBlock",
403 "UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ]
406 enum: ["FnDef", "TypeAliasDef", "ConstDef"]
410 collections: [("exprs", "Expr")]
413 collections: [("exprs", "Expr")]
415 "ParenExpr": (options: ["Expr"]),
416 "PathExpr": (options: ["Path"]),
424 options: [ "Condition" ]
427 traits: ["LoopBodyOwner"],
430 options: [["body", "BlockExpr"]],
433 traits: ["LoopBodyOwner"],
436 ["iterable", "Expr"],
440 traits: ["LoopBodyOwner"],
441 options: [ "Condition" ]
444 "BreakExpr": (options: ["Expr"]),
449 "ReturnExpr": (options: ["Expr"]),
451 options: [ "Expr", "MatchArmList" ],
454 collections: [ ("arms", "MatchArm") ],
455 traits: [ "AttrsOwner" ]
459 [ "guard", "MatchGuard" ],
462 collections: [ ("pats", "Pat") ],
463 traits: [ "AttrsOwner" ]
465 "MatchGuard": (options: ["Expr"]),
466 "RecordLit": (options: ["Path", "RecordFieldList"]),
468 collections: [ ("fields", "RecordField") ],
469 options: [["spread", "Expr"]]
471 "RecordField": (options: ["NameRef", "Expr"]),
473 traits: ["ArgListOwner"],
477 traits: ["ArgListOwner"],
478 options: [ "Expr", "NameRef", "TypeArgList" ],
481 "FieldExpr": (options: ["Expr", "NameRef"]),
482 "AwaitExpr": (options: ["Expr"]),
483 "TryExpr": (options: ["Expr"]),
484 "CastExpr": (options: ["Expr", "TypeRef"]),
485 "RefExpr": (options: ["Expr"]),
486 "PrefixExpr": (options: ["Expr"]),
487 "BoxExpr": (options: ["Expr"]),
529 "RefPat": ( options: [ "Pat" ]),
530 "BoxPat": ( options: [ "Pat" ]),
533 traits: ["NameOwner"]
535 "PlaceholderPat": (),
537 "PathPat": ( options: [ "Path" ] ),
538 "RecordPat": ( options: ["RecordFieldPatList", "Path"] ),
539 "RecordFieldPatList": (
541 ("record_field_pats", "RecordFieldPat"),
542 ("bind_pats", "BindPat"),
546 traits: ["NameOwner"],
551 collections: [("args", "Pat")],
553 "TuplePat": ( collections: [("args", "Pat")] ),
556 "LiteralPat": (options: ["Literal"]),
579 traits: [ "NameOwner", "AttrsOwner","DocCommentsOwner" ],
580 options: [ "TokenTree", "Path" ],
582 "Attr": ( options: [ ["value", "TokenTree"] ] ),
586 ("type_params", "TypeParam" ),
587 ("lifetime_params", "LifetimeParam" ),
590 "TypeParam": ( traits: ["NameOwner", "AttrsOwner", "TypeBoundsOwner", "DefaultTypeParamOwner"] ),
592 traits: ["AttrsOwner"],
601 ("bounds", "TypeBound"),
614 ("predicates", "WherePred"),
618 options: [ ["expr", "Expr"] ]
623 ["initializer", "Expr"],
626 "TypeAscriptionOwner",
630 options: [ "Pat", "Expr" ]
633 enum: ["ExprStmt", "LetStmt"],
638 ("statements", "Stmt"),
645 options: [ "SelfParam" ],
652 "TypeAscriptionOwner",
659 "TypeAscriptionOwner",
664 traits: ["AttrsOwner"],
665 options: [ "UseTree" ],
668 options: [ "Path", "UseTreeList", "Alias" ]
671 traits: ["NameOwner"],
674 collections: [("use_trees", "UseTree")]
677 traits: ["AttrsOwner"],
678 options: ["NameRef", "Alias"],
687 ["segment", "PathSegment"],
688 ["qualifier", "Path"],
692 options: [ "NameRef", "TypeArgList", "ParamList", "RetType" ]
694 "TypeArgList": (collections: [
695 ("type_args", "TypeArg"),
696 ("lifetime_args", "LifetimeArg"),
697 ("assoc_type_args", "AssocTypeArg"),
699 "TypeArg": (options: ["TypeRef"]),
700 "AssocTypeArg": (options: ["NameRef", "TypeRef"]),
704 traits: [ "ModuleItemOwner", "FnDefOwner" ],
710 ("statements", "Stmt"),