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",
326 "TypeAscriptionOwner",
340 "ImplBlock": (options: ["ItemList"], traits: ["TypeParamsOwner"]),
342 "ParenType": (options: ["TypeRef"]),
343 "TupleType": ( collections: [["fields", "TypeRef"]] ),
345 "PathType": (options: ["Path"]),
346 "PointerType": (options: ["TypeRef"]),
347 "ArrayType": ( options: ["TypeRef", "Expr"] ),
348 "SliceType": ( options: ["TypeRef"] ),
349 "ReferenceType": (options: ["TypeRef"]),
350 "PlaceholderType": (),
351 "FnPointerType": (options: ["ParamList", "RetType"]),
352 "ForType": (options: ["TypeRef"]),
354 traits: ["TypeBoundsOwner"],
357 traits: ["TypeBoundsOwner"],
377 enum: ["StructDef", "EnumDef"],
385 enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeAliasDef", "ImplBlock",
386 "UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ]
389 enum: ["FnDef", "TypeAliasDef", "ConstDef"]
393 collections: [["exprs", "Expr"]]
396 collections: [["exprs", "Expr"]]
398 "ParenExpr": (options: ["Expr"]),
399 "PathExpr": (options: ["Path"]),
407 options: [ "Condition" ]
410 traits: ["LoopBodyOwner"],
413 traits: ["LoopBodyOwner"],
416 ["iterable", "Expr"],
420 traits: ["LoopBodyOwner"],
421 options: [ "Condition" ]
424 "BreakExpr": (options: ["Expr"]),
429 "ReturnExpr": (options: ["Expr"]),
431 options: [ "Expr", "MatchArmList" ],
434 collections: [ ["arms", "MatchArm"] ],
435 traits: [ "AttrsOwner" ]
439 [ "guard", "MatchGuard" ],
442 collections: [ [ "pats", "Pat" ] ],
443 traits: [ "AttrsOwner" ]
445 "MatchGuard": (options: ["Expr"]),
446 "StructLit": (options: ["Path", "NamedFieldList", ["spread", "Expr"]]),
447 "NamedFieldList": (collections: [ ["fields", "NamedField"] ]),
448 "NamedField": (options: ["NameRef", "Expr"]),
450 traits: ["ArgListOwner"],
454 traits: ["ArgListOwner"],
455 options: [ "Expr", "NameRef", "TypeArgList" ],
458 "FieldExpr": (options: ["Expr", "NameRef"]),
459 "TryExpr": (options: ["Expr"]),
460 "CastExpr": (options: ["Expr", "TypeRef"]),
461 "RefExpr": (options: ["Expr"]),
462 "PrefixExpr": (options: ["Expr"]),
466 "IntNumber": ( traits: ["AstToken"] ),
467 "FloatNumber": ( traits: ["AstToken"] ),
468 "String": ( traits: ["AstToken"] ),
469 "RawString": ( traits: ["AstToken"] ),
470 "Byte": ( traits: ["AstToken"] ),
471 "RawByteString": ( traits: ["AstToken"] ),
472 "ByteString": ( traits: ["AstToken"] ),
473 "Char": ( traits: ["AstToken"] ),
474 "TrueKw": ( traits: ["AstToken"] ),
475 "FalseKw": ( traits: ["AstToken"] ),
490 "Literal": (options: ["LiteralExpr"]),
524 "RefPat": ( options: [ "Pat" ]),
527 traits: ["NameOwner"]
529 "PlaceholderPat": (),
530 "PathPat": ( options: [ "Path" ] ),
531 "StructPat": ( options: ["FieldPatList", "Path"] ),
534 ["field_pats", "FieldPat"],
535 ["bind_pats", "BindPat"],
539 traits: ["NameOwner"],
544 collections: [["args", "Pat"]],
546 "TuplePat": ( collections: [["args", "Pat"]] ),
549 "LiteralPat": (options: ["Literal"]),
570 traits: [ "NameOwner", "AttrsOwner" ],
571 options: [ "TokenTree", "Path" ],
573 "Attr": ( options: [ ["value", "TokenTree"] ] ),
577 ["type_params", "TypeParam" ],
578 ["lifetime_params", "LifetimeParam" ],
581 "TypeParam": ( traits: ["NameOwner", "AttrsOwner", "TypeBoundsOwner"] ),
583 options: [ "Lifetime"],
584 traits: ["AttrsOwner"],
586 "Lifetime": ( traits: ["AstToken"] ),
595 ["bounds", "TypeBound"],
600 options: [ ["expr", "Expr"] ]
605 ["initializer", "Expr"],
608 "TypeAscriptionOwner",
612 options: [ "Pat", "Expr" ]
615 enum: ["ExprStmt", "LetStmt"],
620 ["statements", "Stmt"],
627 options: [ "SelfParam" ],
635 "TypeAscriptionOwner",
642 "TypeAscriptionOwner",
646 traits: ["AttrsOwner"],
647 options: [ "UseTree" ],
650 options: [ "Path", "UseTreeList", "Alias" ]
653 traits: ["NameOwner"],
656 collections: [["use_trees", "UseTree"]]
659 options: ["NameRef", "Alias"],
668 ["segment", "PathSegment"],
669 ["qualifier", "Path"],
673 options: [ "NameRef", "TypeArgList" ]
675 "TypeArgList": (collections: [
676 ["type_args", "TypeArg"],
677 ["lifetime_args", "LifetimeArg"],
678 ["assoc_type_args", "AssocTypeArg"],
680 "TypeArg": (options: ["TypeRef"]),
681 "AssocTypeArg": (options: ["NameRef", "TypeRef"]),
682 "LifetimeArg": (options: ["Lifetime"]),
683 "Comment": ( traits: ["AstToken"] ),
684 "Whitespace": ( traits: ["AstToken"] ),