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: [
166 "RECORD_FIELD_PAT_LIST",
213 "RANGE_EXPR", // just weird
220 "RECORD_FIELD_DEF_LIST",
222 "TUPLE_FIELD_DEF_LIST",
227 "META_ITEM", // not an item actually
265 traits: [ "ModuleItemOwner", "FnDefOwner" ],
267 ("modules", "Module"),
278 options: [ "ParamList", ["body", "BlockExpr"], "RetType" ],
280 "RetType": (options: ["TypeRef"]),
290 "RecordFieldDefList": (collections: [("fields", "RecordFieldDef")]),
297 "TypeAscriptionOwner"
300 "TupleFieldDefList": (collections: [("fields", "TupleFieldDef")]),
301 "TupleFieldDef": ( traits: ["VisibilityOwner", "AttrsOwner"], options: ["TypeRef"]),
302 "EnumDef": ( traits: [
308 ], options: [["variant_list", "EnumVariantList"]] ),
309 "EnumVariantList": ( collections: [("variants", "EnumVariant")] ),
310 "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner", "AttrsOwner"], options: ["Expr"] ),
312 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeParamsOwner", "TypeBoundsOwner"],
313 options: ["ItemList"]
316 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ],
317 options: [ "ItemList" ]
320 collections: [("impl_items", "ImplItem")],
321 traits: [ "FnDefOwner", "ModuleItemOwner" ],
330 "TypeAscriptionOwner",
332 options: [ ["body","Expr"]],
341 "TypeAscriptionOwner",
343 options: [ ["body","Expr"]],
356 "ImplBlock": (options: ["ItemList"], traits: ["TypeParamsOwner", "AttrsOwner"]),
358 "ParenType": (options: ["TypeRef"]),
359 "TupleType": ( collections: [("fields", "TypeRef")] ),
361 "PathType": (options: ["Path"]),
362 "PointerType": (options: ["TypeRef"]),
363 "ArrayType": ( options: ["TypeRef", "Expr"] ),
364 "SliceType": ( options: ["TypeRef"] ),
365 "ReferenceType": (options: ["TypeRef"]),
366 "PlaceholderType": (),
367 "FnPointerType": (options: ["ParamList", "RetType"]),
368 "ForType": (options: ["TypeRef"]),
370 traits: ["TypeBoundsOwner"],
373 traits: ["TypeBoundsOwner"],
393 enum: ["StructDef", "EnumDef"],
401 enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeAliasDef", "ImplBlock",
402 "UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ]
405 enum: ["FnDef", "TypeAliasDef", "ConstDef"]
409 collections: [("exprs", "Expr")]
412 collections: [("exprs", "Expr")]
414 "ParenExpr": (options: ["Expr"]),
415 "PathExpr": (options: ["Path"]),
423 options: [ "Condition" ]
426 traits: ["LoopBodyOwner"],
429 options: [["body", "BlockExpr"]],
432 traits: ["LoopBodyOwner"],
435 ["iterable", "Expr"],
439 traits: ["LoopBodyOwner"],
440 options: [ "Condition" ]
443 "BreakExpr": (options: ["Expr"]),
448 "ReturnExpr": (options: ["Expr"]),
450 options: [ "Expr", "MatchArmList" ],
453 collections: [ ("arms", "MatchArm") ],
454 traits: [ "AttrsOwner" ]
458 [ "guard", "MatchGuard" ],
461 collections: [ ("pats", "Pat") ],
462 traits: [ "AttrsOwner" ]
464 "MatchGuard": (options: ["Expr"]),
465 "RecordLit": (options: ["Path", "RecordFieldList"]),
467 collections: [ ("fields", "RecordField") ],
468 options: [["spread", "Expr"]]
470 "RecordField": (options: ["NameRef", "Expr"]),
472 traits: ["ArgListOwner"],
476 traits: ["ArgListOwner"],
477 options: [ "Expr", "NameRef", "TypeArgList" ],
480 "FieldExpr": (options: ["Expr", "NameRef"]),
481 "AwaitExpr": (options: ["Expr"]),
482 "TryExpr": (options: ["Expr"]),
483 "CastExpr": (options: ["Expr", "TypeRef"]),
484 "RefExpr": (options: ["Expr"]),
485 "PrefixExpr": (options: ["Expr"]),
526 "RefPat": ( options: [ "Pat" ]),
527 "BoxPat": ( options: [ "Pat" ]),
530 traits: ["NameOwner"]
532 "PlaceholderPat": (),
533 "PathPat": ( options: [ "Path" ] ),
534 "RecordPat": ( options: ["RecordFieldPatList", "Path"] ),
535 "RecordFieldPatList": (
537 ("record_field_pats", "RecordFieldPat"),
538 ("bind_pats", "BindPat"),
542 traits: ["NameOwner"],
547 collections: [("args", "Pat")],
549 "TuplePat": ( collections: [("args", "Pat")] ),
552 "LiteralPat": (options: ["Literal"]),
574 traits: [ "NameOwner", "AttrsOwner","DocCommentsOwner" ],
575 options: [ "TokenTree", "Path" ],
577 "Attr": ( options: [ ["value", "TokenTree"] ] ),
581 ("type_params", "TypeParam" ),
582 ("lifetime_params", "LifetimeParam" ),
585 "TypeParam": ( traits: ["NameOwner", "AttrsOwner", "TypeBoundsOwner", "DefaultTypeParamOwner"] ),
587 traits: ["AttrsOwner"],
596 ("bounds", "TypeBound"),
609 ("predicates", "WherePred"),
613 options: [ ["expr", "Expr"] ]
618 ["initializer", "Expr"],
621 "TypeAscriptionOwner",
625 options: [ "Pat", "Expr" ]
628 enum: ["ExprStmt", "LetStmt"],
633 ("statements", "Stmt"),
640 options: [ "SelfParam" ],
647 "TypeAscriptionOwner",
654 "TypeAscriptionOwner",
659 traits: ["AttrsOwner"],
660 options: [ "UseTree" ],
663 options: [ "Path", "UseTreeList", "Alias" ]
666 traits: ["NameOwner"],
669 collections: [("use_trees", "UseTree")]
672 traits: ["AttrsOwner"],
673 options: ["NameRef", "Alias"],
682 ["segment", "PathSegment"],
683 ["qualifier", "Path"],
687 options: [ "NameRef", "TypeArgList", "ParamList", "RetType" ]
689 "TypeArgList": (collections: [
690 ("type_args", "TypeArg"),
691 ("lifetime_args", "LifetimeArg"),
692 ("assoc_type_args", "AssocTypeArg"),
694 "TypeArg": (options: ["TypeRef"]),
695 "AssocTypeArg": (options: ["NameRef", "TypeRef"]),
699 traits: [ "ModuleItemOwner", "FnDefOwner" ],
705 ("statements", "Stmt"),