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
253 traits: [ "ModuleItemOwner", "FnDefOwner" ],
255 ["modules", "Module"],
266 options: [ "ParamList", ["body", "Block"], "RetType" ],
268 "RetType": (options: ["TypeRef"]),
278 "NamedFieldDefList": (collections: [["fields", "NamedFieldDef"]]),
285 "TypeAscriptionOwner"
288 "PosFieldDefList": (collections: [["fields", "PosFieldDef"]]),
289 "PosFieldDef": ( traits: ["VisibilityOwner", "AttrsOwner"], options: ["TypeRef"]),
290 "EnumDef": ( traits: [
296 ], options: [["variant_list", "EnumVariantList"]] ),
297 "EnumVariantList": ( collections: [["variants", "EnumVariant"]] ),
298 "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner", "AttrsOwner"], options: ["Expr"] ),
300 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeParamsOwner", "TypeBoundsOwner"],
301 options: ["ItemList"]
304 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ],
305 options: [ "ItemList" ]
308 collections: [["impl_items", "ImplItem"]],
309 traits: [ "FnDefOwner", "ModuleItemOwner" ],
318 "TypeAscriptionOwner",
320 options: [ ["body","Expr"]],
329 "TypeAscriptionOwner",
331 options: [ ["body","Expr"]],
344 "ImplBlock": (options: ["ItemList"], traits: ["TypeParamsOwner"]),
346 "ParenType": (options: ["TypeRef"]),
347 "TupleType": ( collections: [["fields", "TypeRef"]] ),
349 "PathType": (options: ["Path"]),
350 "PointerType": (options: ["TypeRef"]),
351 "ArrayType": ( options: ["TypeRef", "Expr"] ),
352 "SliceType": ( options: ["TypeRef"] ),
353 "ReferenceType": (options: ["TypeRef"]),
354 "PlaceholderType": (),
355 "FnPointerType": (options: ["ParamList", "RetType"]),
356 "ForType": (options: ["TypeRef"]),
358 traits: ["TypeBoundsOwner"],
361 traits: ["TypeBoundsOwner"],
381 enum: ["StructDef", "EnumDef"],
389 enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeAliasDef", "ImplBlock",
390 "UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ]
393 enum: ["FnDef", "TypeAliasDef", "ConstDef"]
397 collections: [["exprs", "Expr"]]
400 collections: [["exprs", "Expr"]]
402 "ParenExpr": (options: ["Expr"]),
403 "PathExpr": (options: ["Path"]),
411 options: [ "Condition" ]
414 traits: ["LoopBodyOwner"],
417 traits: ["LoopBodyOwner"],
420 ["iterable", "Expr"],
424 traits: ["LoopBodyOwner"],
425 options: [ "Condition" ]
428 "BreakExpr": (options: ["Expr"]),
433 "ReturnExpr": (options: ["Expr"]),
435 options: [ "Expr", "MatchArmList" ],
438 collections: [ ["arms", "MatchArm"] ],
439 traits: [ "AttrsOwner" ]
443 [ "guard", "MatchGuard" ],
446 collections: [ [ "pats", "Pat" ] ],
447 traits: [ "AttrsOwner" ]
449 "MatchGuard": (options: ["Expr"]),
450 "StructLit": (options: ["Path", "NamedFieldList", ["spread", "Expr"]]),
451 "NamedFieldList": (collections: [ ["fields", "NamedField"] ]),
452 "NamedField": (options: ["NameRef", "Expr"]),
454 traits: ["ArgListOwner"],
458 traits: ["ArgListOwner"],
459 options: [ "Expr", "NameRef", "TypeArgList" ],
462 "FieldExpr": (options: ["Expr", "NameRef"]),
463 "TryExpr": (options: ["Expr"]),
464 "CastExpr": (options: ["Expr", "TypeRef"]),
465 "RefExpr": (options: ["Expr"]),
466 "PrefixExpr": (options: ["Expr"]),
505 "RefPat": ( options: [ "Pat" ]),
508 traits: ["NameOwner"]
510 "PlaceholderPat": (),
511 "PathPat": ( options: [ "Path" ] ),
512 "StructPat": ( options: ["FieldPatList", "Path"] ),
515 ["field_pats", "FieldPat"],
516 ["bind_pats", "BindPat"],
520 traits: ["NameOwner"],
525 collections: [["args", "Pat"]],
527 "TuplePat": ( collections: [["args", "Pat"]] ),
530 "LiteralPat": (options: ["Literal"]),
551 traits: [ "NameOwner", "AttrsOwner" ],
552 options: [ "TokenTree", "Path" ],
554 "Attr": ( options: [ ["value", "TokenTree"] ] ),
558 ["type_params", "TypeParam" ],
559 ["lifetime_params", "LifetimeParam" ],
562 "TypeParam": ( traits: ["NameOwner", "AttrsOwner", "TypeBoundsOwner"] ),
564 traits: ["AttrsOwner"],
573 ["bounds", "TypeBound"],
586 ["predicates", "WherePred"],
590 options: [ ["expr", "Expr"] ]
595 ["initializer", "Expr"],
598 "TypeAscriptionOwner",
602 options: [ "Pat", "Expr" ]
605 enum: ["ExprStmt", "LetStmt"],
610 ["statements", "Stmt"],
617 options: [ "SelfParam" ],
624 "TypeAscriptionOwner",
630 "TypeAscriptionOwner",
634 traits: ["AttrsOwner"],
635 options: [ "UseTree" ],
638 options: [ "Path", "UseTreeList", "Alias" ]
641 traits: ["NameOwner"],
644 collections: [["use_trees", "UseTree"]]
647 options: ["NameRef", "Alias"],
656 ["segment", "PathSegment"],
657 ["qualifier", "Path"],
661 options: [ "NameRef", "TypeArgList" ]
663 "TypeArgList": (collections: [
664 ["type_args", "TypeArg"],
665 ["lifetime_args", "LifetimeArg"],
666 ["assoc_type_args", "AssocTypeArg"],
668 "TypeArg": (options: ["TypeRef"]),
669 "AssocTypeArg": (options: ["NameRef", "TypeRef"]),