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
249 traits: [ "ModuleItemOwner", "FnDefOwner" ],
251 ["modules", "Module"],
262 options: [ "ParamList", ["body", "Block"], "RetType" ],
264 "RetType": (options: ["TypeRef"]),
274 "NamedFieldDefList": (collections: [["fields", "NamedFieldDef"]]),
281 "TypeAscriptionOwner"
284 "PosFieldDefList": (collections: [["fields", "PosFieldDef"]]),
285 "PosFieldDef": ( traits: ["VisibilityOwner", "AttrsOwner"], options: ["TypeRef"]),
286 "EnumDef": ( traits: [
292 ], options: [["variant_list", "EnumVariantList"]] ),
293 "EnumVariantList": ( collections: [["variants", "EnumVariant"]] ),
294 "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner", "AttrsOwner"], options: ["Expr"] ),
295 "TraitDef": ( traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeParamsOwner"] ),
297 traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ],
298 options: [ "ItemList" ]
301 collections: [["impl_items", "ImplItem"]],
302 traits: [ "FnDefOwner", "ModuleItemOwner" ],
311 "TypeAscriptionOwner",
321 "TypeAscriptionOwner",
334 "ImplBlock": (options: ["ItemList"], traits: ["TypeParamsOwner"]),
336 "ParenType": (options: ["TypeRef"]),
337 "TupleType": ( collections: [["fields", "TypeRef"]] ),
339 "PathType": (options: ["Path"]),
340 "PointerType": (options: ["TypeRef"]),
341 "ArrayType": ( options: ["TypeRef", "Expr"] ),
342 "SliceType": ( options: ["TypeRef"] ),
343 "ReferenceType": (options: ["TypeRef"]),
344 "PlaceholderType": (),
345 "FnPointerType": (options: ["ParamList", "RetType"]),
346 "ForType": (options: ["TypeRef"]),
367 enum: ["StructDef", "EnumDef"],
375 enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeAliasDef", "ImplBlock",
376 "UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ]
379 enum: ["FnDef", "TypeAliasDef", "ConstDef"]
383 collections: [["exprs", "Expr"]]
386 collections: [["exprs", "Expr"]]
388 "ParenExpr": (options: ["Expr"]),
389 "PathExpr": (options: ["Path"]),
397 options: [ "Condition" ]
400 traits: ["LoopBodyOwner"],
403 traits: ["LoopBodyOwner"],
406 ["iterable", "Expr"],
410 traits: ["LoopBodyOwner"],
411 options: [ "Condition" ]
414 "BreakExpr": (options: ["Expr"]),
419 "ReturnExpr": (options: ["Expr"]),
421 options: [ "Expr", "MatchArmList" ],
424 collections: [ ["arms", "MatchArm"] ],
425 traits: [ "AttrsOwner" ]
429 [ "guard", "MatchGuard" ],
432 collections: [ [ "pats", "Pat" ] ],
433 traits: [ "AttrsOwner" ]
435 "MatchGuard": (options: ["Expr"]),
436 "StructLit": (options: ["Path", "NamedFieldList", ["spread", "Expr"]]),
437 "NamedFieldList": (collections: [ ["fields", "NamedField"] ]),
438 "NamedField": (options: ["NameRef", "Expr"]),
440 traits: ["ArgListOwner"],
444 traits: ["ArgListOwner"],
445 options: [ "Expr", "NameRef", "TypeArgList" ],
448 "FieldExpr": (options: ["Expr", "NameRef"]),
449 "TryExpr": (options: ["Expr"]),
450 "CastExpr": (options: ["Expr", "TypeRef"]),
451 "RefExpr": (options: ["Expr"]),
452 "PrefixExpr": (options: ["Expr"]),
456 "IntNumber": ( traits: ["AstToken"] ),
457 "FloatNumber": ( traits: ["AstToken"] ),
458 "String": ( traits: ["AstToken"] ),
459 "RawString": ( traits: ["AstToken"] ),
460 "Byte": ( traits: ["AstToken"] ),
461 "RawByteString": ( traits: ["AstToken"] ),
462 "ByteString": ( traits: ["AstToken"] ),
463 "Char": ( traits: ["AstToken"] ),
464 "TrueKw": ( traits: ["AstToken"] ),
465 "FalseKw": ( traits: ["AstToken"] ),
480 "Literal": (options: ["LiteralExpr"]),
514 "RefPat": ( options: [ "Pat" ]),
517 traits: ["NameOwner"]
519 "PlaceholderPat": (),
520 "PathPat": ( options: [ "Path" ] ),
521 "StructPat": ( options: ["FieldPatList", "Path"] ),
524 ["field_pats", "FieldPat"],
525 ["bind_pats", "BindPat"],
529 traits: ["NameOwner"],
534 collections: [["args", "Pat"]],
536 "TuplePat": ( collections: [["args", "Pat"]] ),
539 "LiteralPat": (options: ["Literal"]),
560 traits: [ "NameOwner", "AttrsOwner" ],
561 options: [ "TokenTree", "Path" ],
563 "Attr": ( options: [ ["value", "TokenTree"] ] ),
567 ["type_params", "TypeParam" ],
568 ["lifetime_params", "LifetimeParam" ],
571 "TypeParam": ( traits: ["NameOwner", "AttrsOwner"] ),
573 options: [ "Lifetime"],
574 traits: ["AttrsOwner"],
576 "Lifetime": ( traits: ["AstToken"] ),
579 options: [ ["expr", "Expr"] ]
584 ["initializer", "Expr"],
587 "TypeAscriptionOwner",
591 options: [ "Pat", "Expr" ]
594 enum: ["ExprStmt", "LetStmt"],
599 ["statements", "Stmt"],
606 options: [ "SelfParam" ],
614 "TypeAscriptionOwner",
621 "TypeAscriptionOwner",
625 traits: ["AttrsOwner"],
626 options: [ "UseTree" ],
629 options: [ "Path", "UseTreeList", "Alias" ]
632 traits: ["NameOwner"],
635 collections: [["use_trees", "UseTree"]]
638 options: ["NameRef", "Alias"],
647 ["segment", "PathSegment"],
648 ["qualifier", "Path"],
652 options: [ "NameRef", "TypeArgList" ]
654 "TypeArgList": (collections: [
655 ["type_args", "TypeArg"],
656 ["lifetime_args", "LifetimeArg"],
657 ["assoc_type_args", "AssocTypeArg"],
659 "TypeArg": (options: ["TypeRef"]),
660 "AssocTypeArg": (options: ["NameRef", "TypeRef"]),
661 "LifetimeArg": (options: ["Lifetime"]),
662 "Comment": ( traits: ["AstToken"] ),
663 "Whitespace": ( traits: ["AstToken"] ),