aboutsummaryrefslogtreecommitdiff
path: root/xtask
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-04-10 09:11:05 +0100
committerAleksey Kladov <[email protected]>2020-04-10 15:10:28 +0100
commitc8b4c36f8161d34c8145a49965efee4514275989 (patch)
tree3b0a50994d76571cdfb2318f2799e6161962974c /xtask
parentf89f2e38855f5b47f68758e98139aa962cb7a01d (diff)
Semicolon token
Diffstat (limited to 'xtask')
-rw-r--r--xtask/src/ast_src.rs22
-rw-r--r--xtask/src/codegen/gen_syntax.rs10
2 files changed, 19 insertions, 13 deletions
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs
index 3da280551..1a6ee935f 100644
--- a/xtask/src/ast_src.rs
+++ b/xtask/src/ast_src.rs
@@ -319,7 +319,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
319 ParamList, 319 ParamList,
320 RetType, 320 RetType,
321 body: BlockExpr, 321 body: BlockExpr,
322 Semi 322 T![;]
323 } 323 }
324 324
325 struct RetType { ThinArrow, TypeRef } 325 struct RetType { ThinArrow, TypeRef }
@@ -327,7 +327,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
327 struct StructDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner { 327 struct StructDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner {
328 T![struct], 328 T![struct],
329 FieldDefList, 329 FieldDefList,
330 Semi 330 T![;]
331 } 331 }
332 332
333 struct UnionDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner { 333 struct UnionDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner {
@@ -368,7 +368,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
368 struct Module: VisibilityOwner, NameOwner, AttrsOwner, DocCommentsOwner { 368 struct Module: VisibilityOwner, NameOwner, AttrsOwner, DocCommentsOwner {
369 T![mod], 369 T![mod],
370 ItemList, 370 ItemList,
371 Semi 371 T![;]
372 } 372 }
373 373
374 struct ItemList: ModuleItemOwner { 374 struct ItemList: ModuleItemOwner {
@@ -382,7 +382,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
382 T![const], 382 T![const],
383 Eq, 383 Eq,
384 body: Expr, 384 body: Expr,
385 Semi 385 T![;]
386 } 386 }
387 387
388 struct StaticDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner, TypeAscriptionOwner { 388 struct StaticDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner, TypeAscriptionOwner {
@@ -390,7 +390,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
390 T![mut], 390 T![mut],
391 Eq, 391 Eq,
392 body: Expr, 392 body: Expr,
393 Semi 393 T![;]
394 } 394 }
395 395
396 struct TypeAliasDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner, TypeBoundsOwner { 396 struct TypeAliasDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, DocCommentsOwner, TypeBoundsOwner {
@@ -398,7 +398,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
398 T![type], 398 T![type],
399 Eq, 399 Eq,
400 TypeRef, 400 TypeRef,
401 Semi 401 T![;]
402 } 402 }
403 403
404 struct ImplDef: TypeParamsOwner, AttrsOwner { 404 struct ImplDef: TypeParamsOwner, AttrsOwner {
@@ -416,7 +416,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
416 struct NeverType { Excl } 416 struct NeverType { Excl }
417 struct PathType { Path } 417 struct PathType { Path }
418 struct PointerType { Star, T![const], T![mut], TypeRef } 418 struct PointerType { Star, T![const], T![mut], TypeRef }
419 struct ArrayType { LBrack, TypeRef, Semi, Expr, RBrack } 419 struct ArrayType { LBrack, TypeRef, T![;], Expr, RBrack }
420 struct SliceType { LBrack, TypeRef, RBrack } 420 struct SliceType { LBrack, TypeRef, RBrack }
421 struct ReferenceType { Amp, Lifetime, T![mut], TypeRef } 421 struct ReferenceType { Amp, Lifetime, T![mut], TypeRef }
422 struct PlaceholderType { Underscore } 422 struct PlaceholderType { Underscore }
@@ -426,7 +426,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
426 struct DynTraitType: TypeBoundsOwner { T![dyn] } 426 struct DynTraitType: TypeBoundsOwner { T![dyn] }
427 427
428 struct TupleExpr: AttrsOwner { LParen, exprs: [Expr], RParen } 428 struct TupleExpr: AttrsOwner { LParen, exprs: [Expr], RParen }
429 struct ArrayExpr: AttrsOwner { LBrack, exprs: [Expr], Semi, RBrack } 429 struct ArrayExpr: AttrsOwner { LBrack, exprs: [Expr], T![;], RBrack }
430 struct ParenExpr: AttrsOwner { LParen, Expr, RParen } 430 struct ParenExpr: AttrsOwner { LParen, Expr, RParen }
431 struct PathExpr { Path } 431 struct PathExpr { Path }
432 struct LambdaExpr: AttrsOwner { 432 struct LambdaExpr: AttrsOwner {
@@ -520,7 +520,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
520 struct NameRef { NameRefToken } 520 struct NameRef { NameRefToken }
521 521
522 struct MacroCall: NameOwner, AttrsOwner,DocCommentsOwner { 522 struct MacroCall: NameOwner, AttrsOwner,DocCommentsOwner {
523 Path, Excl, TokenTree, Semi 523 Path, Excl, TokenTree, T![;]
524 } 524 }
525 struct Attr { Pound, Excl, LBrack, Path, Eq, input: AttrInput, RBrack } 525 struct Attr { Pound, Excl, LBrack, Path, Eq, input: AttrInput, RBrack }
526 struct TokenTree {} 526 struct TokenTree {}
@@ -546,13 +546,13 @@ pub(crate) const AST_SRC: AstSrc = AstSrc {
546 struct WherePred: TypeBoundsOwner { Lifetime, TypeRef } 546 struct WherePred: TypeBoundsOwner { Lifetime, TypeRef }
547 struct WhereClause { T![where], predicates: [WherePred] } 547 struct WhereClause { T![where], predicates: [WherePred] }
548 struct Abi { String } 548 struct Abi { String }
549 struct ExprStmt: AttrsOwner { Expr, Semi } 549 struct ExprStmt: AttrsOwner { Expr, T![;] }
550 struct LetStmt: AttrsOwner, TypeAscriptionOwner { 550 struct LetStmt: AttrsOwner, TypeAscriptionOwner {
551 T![let], 551 T![let],
552 Pat, 552 Pat,
553 Eq, 553 Eq,
554 initializer: Expr, 554 initializer: Expr,
555 Semi, 555 T![;],
556 } 556 }
557 struct Condition { T![let], Pat, Eq, Expr } 557 struct Condition { T![let], Pat, Eq, Expr }
558 struct Block: AttrsOwner, ModuleItemOwner { 558 struct Block: AttrsOwner, ModuleItemOwner {
diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs
index c4fb29bbf..26f541da1 100644
--- a/xtask/src/codegen/gen_syntax.rs
+++ b/xtask/src/codegen/gen_syntax.rs
@@ -515,7 +515,7 @@ impl Field<'_> {
515 fn token_kind(&self) -> Option<proc_macro2::TokenStream> { 515 fn token_kind(&self) -> Option<proc_macro2::TokenStream> {
516 let res = match self { 516 let res = match self {
517 Field::Token(token) => { 517 Field::Token(token) => {
518 let token = format_ident!("{}", token); 518 let token: proc_macro2::TokenStream = token.parse().unwrap();
519 quote! { T![#token] } 519 quote! { T![#token] }
520 } 520 }
521 _ => return None, 521 _ => return None,
@@ -524,7 +524,13 @@ impl Field<'_> {
524 } 524 }
525 fn method_name(&self) -> proc_macro2::Ident { 525 fn method_name(&self) -> proc_macro2::Ident {
526 match self { 526 match self {
527 Field::Token(name) => format_ident!("{}_token", name), 527 Field::Token(name) => {
528 let name = match *name {
529 ";" => "semicolon",
530 _ => name,
531 };
532 format_ident!("{}_token", name)
533 }
528 Field::Node { name, src } => match src { 534 Field::Node { name, src } => match src {
529 FieldSrc::Shorthand => format_ident!("{}", to_lower_snake_case(name)), 535 FieldSrc::Shorthand => format_ident!("{}", to_lower_snake_case(name)),
530 _ => format_ident!("{}", name), 536 _ => format_ident!("{}", name),