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: [
203 "RANGE_EXPR", // just weird
210 "NAMED_FIELD_DEF_LIST",
212 "POS_FIELD_DEF_LIST",
217 "META_ITEM", // not an item actually
251 traits: [ "ModuleItemOwner", "FnDefOwner" ],
253 ["modules", "Module"],
264 options: [ "ParamList", ["body", "Block"], "RetType" ],
266 "RetType": (options: ["TypeRef"]),
276 "NamedFieldDefList": (collections: [["fields", "NamedFieldDef"]]),
283 "TypeAscriptionOwner"
286 "PosFieldDefList": (collections: [["fields", "PosFieldDef"]]),
287 "PosFieldDef": ( traits: ["VisibilityOwner", "AttrsOwner"], options: ["TypeRef"]),
288 "EnumDef": ( traits: [
294 ], options: [["variant_list", "EnumVariantList"]] ),
295 "EnumVariantList": ( collections: [["variants", "EnumVariant"]] ),
296 "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner", "AttrsOwner"], options: ["Expr"] ),
298 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeParamsOwner", "TypeBoundsOwner"],
299 options: ["ItemList"]
302 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ],
303 options: [ "ItemList" ]
306 collections: [["impl_items", "ImplItem"]],
307 traits: [ "FnDefOwner", "ModuleItemOwner" ],
316 "TypeAscriptionOwner",
318 options: [ ["body","Expr"]],
327 "TypeAscriptionOwner",
329 options: [ ["body","Expr"]],
342 "ImplBlock": (options: ["ItemList"], traits: ["TypeParamsOwner"]),
344 "ParenType": (options: ["TypeRef"]),
345 "TupleType": ( collections: [["fields", "TypeRef"]] ),
347 "PathType": (options: ["Path"]),
348 "PointerType": (options: ["TypeRef"]),
349 "ArrayType": ( options: ["TypeRef", "Expr"] ),
350 "SliceType": ( options: ["TypeRef"] ),
351 "ReferenceType": (options: ["TypeRef"]),
352 "PlaceholderType": (),
353 "FnPointerType": (options: ["ParamList", "RetType"]),
354 "ForType": (options: ["TypeRef"]),
356 traits: ["TypeBoundsOwner"],
359 traits: ["TypeBoundsOwner"],
379 enum: ["StructDef", "EnumDef"],
387 enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeAliasDef", "ImplBlock",
388 "UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ]
391 enum: ["FnDef", "TypeAliasDef", "ConstDef"]
395 collections: [["exprs", "Expr"]]
398 collections: [["exprs", "Expr"]]
400 "ParenExpr": (options: ["Expr"]),
401 "PathExpr": (options: ["Path"]),
409 options: [ "Condition" ]
412 traits: ["LoopBodyOwner"],
415 traits: ["LoopBodyOwner"],
418 ["iterable", "Expr"],
422 traits: ["LoopBodyOwner"],
423 options: [ "Condition" ]
426 "BreakExpr": (options: ["Expr"]),
431 "ReturnExpr": (options: ["Expr"]),
433 options: [ "Expr", "MatchArmList" ],
436 collections: [ ["arms", "MatchArm"] ],
437 traits: [ "AttrsOwner" ]
441 [ "guard", "MatchGuard" ],
444 collections: [ [ "pats", "Pat" ] ],
445 traits: [ "AttrsOwner" ]
447 "MatchGuard": (options: ["Expr"]),
448 "StructLit": (options: ["Path", "NamedFieldList", ["spread", "Expr"]]),
449 "NamedFieldList": (collections: [ ["fields", "NamedField"] ]),
450 "NamedField": (options: ["NameRef", "Expr"]),
452 traits: ["ArgListOwner"],
456 traits: ["ArgListOwner"],
457 options: [ "Expr", "NameRef", "TypeArgList" ],
460 "FieldExpr": (options: ["Expr", "NameRef"]),
461 "TryExpr": (options: ["Expr"]),
462 "CastExpr": (options: ["Expr", "TypeRef"]),
463 "RefExpr": (options: ["Expr"]),
464 "PrefixExpr": (options: ["Expr"]),
503 "RefPat": ( options: [ "Pat" ]),
506 traits: ["NameOwner"]
508 "PlaceholderPat": (),
509 "PathPat": ( options: [ "Path" ] ),
510 "StructPat": ( options: ["FieldPatList", "Path"] ),
513 ["field_pats", "FieldPat"],
514 ["bind_pats", "BindPat"],
518 traits: ["NameOwner"],
523 collections: [["args", "Pat"]],
525 "TuplePat": ( collections: [["args", "Pat"]] ),
528 "LiteralPat": (options: ["Literal"]),
549 traits: [ "NameOwner", "AttrsOwner" ],
550 options: [ "TokenTree", "Path" ],
552 "Attr": ( options: [ ["value", "TokenTree"] ] ),
556 ["type_params", "TypeParam" ],
557 ["lifetime_params", "LifetimeParam" ],
560 "TypeParam": ( traits: ["NameOwner", "AttrsOwner", "TypeBoundsOwner"] ),
562 traits: ["AttrsOwner"],
571 ["bounds", "TypeBound"],
584 ["predicates", "WherePred"],
588 options: [ ["expr", "Expr"] ]
593 ["initializer", "Expr"],
596 "TypeAscriptionOwner",
600 options: [ "Pat", "Expr" ]
603 enum: ["ExprStmt", "LetStmt"],
608 ["statements", "Stmt"],
615 options: [ "SelfParam" ],
622 "TypeAscriptionOwner",
628 "TypeAscriptionOwner",
632 traits: ["AttrsOwner"],
633 options: [ "UseTree" ],
636 options: [ "Path", "UseTreeList", "Alias" ]
639 traits: ["NameOwner"],
642 collections: [["use_trees", "UseTree"]]
645 options: ["NameRef", "Alias"],
654 ["segment", "PathSegment"],
655 ["qualifier", "Path"],
659 options: [ "NameRef", "TypeArgList" ]
661 "TypeArgList": (collections: [
662 ["type_args", "TypeArg"],
663 ["lifetime_args", "LifetimeArg"],
664 ["assoc_type_args", "AssocTypeArg"],
666 "TypeArg": (options: ["TypeRef"]),
667 "AssocTypeArg": (options: ["NameRef", "TypeRef"]),