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: [
212 "RANGE_EXPR", // just weird
219 "NAMED_FIELD_DEF_LIST",
221 "POS_FIELD_DEF_LIST",
226 "META_ITEM", // not an item actually
264 traits: [ "ModuleItemOwner", "FnDefOwner" ],
266 ("modules", "Module"),
277 options: [ "ParamList", ["body", "Block"], "RetType" ],
279 "RetType": (options: ["TypeRef"]),
289 "NamedFieldDefList": (collections: [("fields", "NamedFieldDef")]),
296 "TypeAscriptionOwner"
299 "PosFieldDefList": (collections: [("fields", "PosFieldDef")]),
300 "PosFieldDef": ( traits: ["VisibilityOwner", "AttrsOwner"], options: ["TypeRef"]),
301 "EnumDef": ( traits: [
307 ], options: [["variant_list", "EnumVariantList"]] ),
308 "EnumVariantList": ( collections: [("variants", "EnumVariant")] ),
309 "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner", "AttrsOwner"], options: ["Expr"] ),
311 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeParamsOwner", "TypeBoundsOwner"],
312 options: ["ItemList"]
315 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ],
316 options: [ "ItemList" ]
319 collections: [("impl_items", "ImplItem")],
320 traits: [ "FnDefOwner", "ModuleItemOwner" ],
329 "TypeAscriptionOwner",
331 options: [ ["body","Expr"]],
340 "TypeAscriptionOwner",
342 options: [ ["body","Expr"]],
355 "ImplBlock": (options: ["ItemList"], traits: ["TypeParamsOwner", "AttrsOwner"]),
357 "ParenType": (options: ["TypeRef"]),
358 "TupleType": ( collections: [("fields", "TypeRef")] ),
360 "PathType": (options: ["Path"]),
361 "PointerType": (options: ["TypeRef"]),
362 "ArrayType": ( options: ["TypeRef", "Expr"] ),
363 "SliceType": ( options: ["TypeRef"] ),
364 "ReferenceType": (options: ["TypeRef"]),
365 "PlaceholderType": (),
366 "FnPointerType": (options: ["ParamList", "RetType"]),
367 "ForType": (options: ["TypeRef"]),
369 traits: ["TypeBoundsOwner"],
372 traits: ["TypeBoundsOwner"],
392 enum: ["StructDef", "EnumDef"],
400 enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeAliasDef", "ImplBlock",
401 "UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ]
404 enum: ["FnDef", "TypeAliasDef", "ConstDef"]
408 collections: [("exprs", "Expr")]
411 collections: [("exprs", "Expr")]
413 "ParenExpr": (options: ["Expr"]),
414 "PathExpr": (options: ["Path"]),
422 options: [ "Condition" ]
425 traits: ["LoopBodyOwner"],
428 traits: ["TryBlockBodyOwner"],
431 traits: ["LoopBodyOwner"],
434 ["iterable", "Expr"],
438 traits: ["LoopBodyOwner"],
439 options: [ "Condition" ]
442 "BreakExpr": (options: ["Expr"]),
447 "ReturnExpr": (options: ["Expr"]),
449 options: [ "Expr", "MatchArmList" ],
452 collections: [ ("arms", "MatchArm") ],
453 traits: [ "AttrsOwner" ]
457 [ "guard", "MatchGuard" ],
460 collections: [ ("pats", "Pat") ],
461 traits: [ "AttrsOwner" ]
463 "MatchGuard": (options: ["Expr"]),
464 "StructLit": (options: ["Path", "NamedFieldList"]),
466 collections: [ ("fields", "NamedField") ],
467 options: [["spread", "Expr"]]
469 "NamedField": (options: ["NameRef", "Expr"]),
471 traits: ["ArgListOwner"],
475 traits: ["ArgListOwner"],
476 options: [ "Expr", "NameRef", "TypeArgList" ],
479 "FieldExpr": (options: ["Expr", "NameRef"]),
480 "AwaitExpr": (options: ["Expr"]),
481 "TryExpr": (options: ["Expr"]),
482 "CastExpr": (options: ["Expr", "TypeRef"]),
483 "RefExpr": (options: ["Expr"]),
484 "PrefixExpr": (options: ["Expr"]),
525 "RefPat": ( options: [ "Pat" ]),
528 traits: ["NameOwner"]
530 "PlaceholderPat": (),
531 "PathPat": ( options: [ "Path" ] ),
532 "StructPat": ( options: ["FieldPatList", "Path"] ),
535 ("field_pats", "FieldPat"),
536 ("bind_pats", "BindPat"),
540 traits: ["NameOwner"],
545 collections: [("args", "Pat")],
547 "TuplePat": ( collections: [("args", "Pat")] ),
550 "LiteralPat": (options: ["Literal"]),
571 traits: [ "NameOwner", "AttrsOwner","DocCommentsOwner" ],
572 options: [ "TokenTree", "Path" ],
574 "Attr": ( options: [ ["value", "TokenTree"] ] ),
578 ("type_params", "TypeParam" ),
579 ("lifetime_params", "LifetimeParam" ),
582 "TypeParam": ( traits: ["NameOwner", "AttrsOwner", "TypeBoundsOwner", "DefaultTypeParamOwner"] ),
584 traits: ["AttrsOwner"],
593 ("bounds", "TypeBound"),
606 ("predicates", "WherePred"),
610 options: [ ["expr", "Expr"] ]
615 ["initializer", "Expr"],
618 "TypeAscriptionOwner",
622 options: [ "Pat", "Expr" ]
625 enum: ["ExprStmt", "LetStmt"],
630 ("statements", "Stmt"),
637 options: [ "SelfParam" ],
644 "TypeAscriptionOwner",
651 "TypeAscriptionOwner",
656 traits: ["AttrsOwner"],
657 options: [ "UseTree" ],
660 options: [ "Path", "UseTreeList", "Alias" ]
663 traits: ["NameOwner"],
666 collections: [("use_trees", "UseTree")]
669 options: ["NameRef", "Alias"],
678 ["segment", "PathSegment"],
679 ["qualifier", "Path"],
683 options: [ "NameRef", "TypeArgList" ]
685 "TypeArgList": (collections: [
686 ("type_args", "TypeArg"),
687 ("lifetime_args", "LifetimeArg"),
688 ("assoc_type_args", "AssocTypeArg"),
690 "TypeArg": (options: ["TypeRef"]),
691 "AssocTypeArg": (options: ["NameRef", "TypeRef"]),
695 traits: [ "ModuleItemOwner", "FnDefOwner" ],
701 ("statements", "Stmt"),