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
257 traits: [ "ModuleItemOwner", "FnDefOwner" ],
259 ["modules", "Module"],
270 options: [ "ParamList", ["body", "Block"], "RetType" ],
272 "RetType": (options: ["TypeRef"]),
282 "NamedFieldDefList": (collections: [["fields", "NamedFieldDef"]]),
289 "TypeAscriptionOwner"
292 "PosFieldDefList": (collections: [["fields", "PosFieldDef"]]),
293 "PosFieldDef": ( traits: ["VisibilityOwner", "AttrsOwner"], options: ["TypeRef"]),
294 "EnumDef": ( traits: [
300 ], options: [["variant_list", "EnumVariantList"]] ),
301 "EnumVariantList": ( collections: [["variants", "EnumVariant"]] ),
302 "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner", "AttrsOwner"], options: ["Expr"] ),
304 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeParamsOwner", "TypeBoundsOwner"],
305 options: ["ItemList"]
308 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ],
309 options: [ "ItemList" ]
312 collections: [["impl_items", "ImplItem"]],
313 traits: [ "FnDefOwner", "ModuleItemOwner" ],
322 "TypeAscriptionOwner",
324 options: [ ["body","Expr"]],
333 "TypeAscriptionOwner",
335 options: [ ["body","Expr"]],
348 "ImplBlock": (options: ["ItemList"], traits: ["TypeParamsOwner", "AttrsOwner"]),
350 "ParenType": (options: ["TypeRef"]),
351 "TupleType": ( collections: [["fields", "TypeRef"]] ),
353 "PathType": (options: ["Path"]),
354 "PointerType": (options: ["TypeRef"]),
355 "ArrayType": ( options: ["TypeRef", "Expr"] ),
356 "SliceType": ( options: ["TypeRef"] ),
357 "ReferenceType": (options: ["TypeRef"]),
358 "PlaceholderType": (),
359 "FnPointerType": (options: ["ParamList", "RetType"]),
360 "ForType": (options: ["TypeRef"]),
362 traits: ["TypeBoundsOwner"],
365 traits: ["TypeBoundsOwner"],
385 enum: ["StructDef", "EnumDef"],
393 enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeAliasDef", "ImplBlock",
394 "UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ]
397 enum: ["FnDef", "TypeAliasDef", "ConstDef"]
401 collections: [["exprs", "Expr"]]
404 collections: [["exprs", "Expr"]]
406 "ParenExpr": (options: ["Expr"]),
407 "PathExpr": (options: ["Path"]),
415 options: [ "Condition" ]
418 traits: ["LoopBodyOwner"],
421 traits: ["LoopBodyOwner"],
424 ["iterable", "Expr"],
428 traits: ["LoopBodyOwner"],
429 options: [ "Condition" ]
432 "BreakExpr": (options: ["Expr"]),
437 "ReturnExpr": (options: ["Expr"]),
439 options: [ "Expr", "MatchArmList" ],
442 collections: [ ["arms", "MatchArm"] ],
443 traits: [ "AttrsOwner" ]
447 [ "guard", "MatchGuard" ],
450 collections: [ [ "pats", "Pat" ] ],
451 traits: [ "AttrsOwner" ]
453 "MatchGuard": (options: ["Expr"]),
454 "StructLit": (options: ["Path", "NamedFieldList", ["spread", "Expr"]]),
455 "NamedFieldList": (collections: [ ["fields", "NamedField"] ]),
456 "NamedField": (options: ["NameRef", "Expr"]),
458 traits: ["ArgListOwner"],
462 traits: ["ArgListOwner"],
463 options: [ "Expr", "NameRef", "TypeArgList" ],
466 "FieldExpr": (options: ["Expr", "NameRef"]),
467 "TryExpr": (options: ["Expr"]),
468 "CastExpr": (options: ["Expr", "TypeRef"]),
469 "RefExpr": (options: ["Expr"]),
470 "PrefixExpr": (options: ["Expr"]),
509 "RefPat": ( options: [ "Pat" ]),
512 traits: ["NameOwner"]
514 "PlaceholderPat": (),
515 "PathPat": ( options: [ "Path" ] ),
516 "StructPat": ( options: ["FieldPatList", "Path"] ),
519 ["field_pats", "FieldPat"],
520 ["bind_pats", "BindPat"],
524 traits: ["NameOwner"],
529 collections: [["args", "Pat"]],
531 "TuplePat": ( collections: [["args", "Pat"]] ),
534 "LiteralPat": (options: ["Literal"]),
555 traits: [ "NameOwner", "AttrsOwner" ],
556 options: [ "TokenTree", "Path" ],
558 "Attr": ( options: [ ["value", "TokenTree"] ] ),
562 ["type_params", "TypeParam" ],
563 ["lifetime_params", "LifetimeParam" ],
566 "TypeParam": ( traits: ["NameOwner", "AttrsOwner", "TypeBoundsOwner", "DefaultTypeParamOwner"] ),
568 traits: ["AttrsOwner"],
577 ["bounds", "TypeBound"],
590 ["predicates", "WherePred"],
594 options: [ ["expr", "Expr"] ]
599 ["initializer", "Expr"],
602 "TypeAscriptionOwner",
606 options: [ "Pat", "Expr" ]
609 enum: ["ExprStmt", "LetStmt"],
614 ["statements", "Stmt"],
621 options: [ "SelfParam" ],
628 "TypeAscriptionOwner",
634 "TypeAscriptionOwner",
638 traits: ["AttrsOwner"],
639 options: [ "UseTree" ],
642 options: [ "Path", "UseTreeList", "Alias" ]
645 traits: ["NameOwner"],
648 collections: [["use_trees", "UseTree"]]
651 options: ["NameRef", "Alias"],
660 ["segment", "PathSegment"],
661 ["qualifier", "Path"],
665 options: [ "NameRef", "TypeArgList" ]
667 "TypeArgList": (collections: [
668 ["type_args", "TypeArg"],
669 ["lifetime_args", "LifetimeArg"],
670 ["assoc_type_args", "AssocTypeArg"],
672 "TypeArg": (options: ["TypeRef"]),
673 "AssocTypeArg": (options: ["NameRef", "TypeRef"]),
677 traits: [ "ModuleItemOwner", "FnDefOwner" ],
683 ["statements", "Stmt"],