From e6d22187a67e762bb950de244a6ca15f3a0b0731 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 9 Apr 2020 18:25:36 +0200 Subject: Add _token suffix to token accessors I think this makes is more clear which things are : AstNode and which are : AstToken --- xtask/src/codegen/gen_syntax.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'xtask') diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs index 6657c9fc5..b5594e3a9 100644 --- a/xtask/src/codegen/gen_syntax.rs +++ b/xtask/src/codegen/gen_syntax.rs @@ -208,6 +208,7 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: AstSrc<'_>) -> Result { FieldSrc::Optional(_) | FieldSrc::Shorthand => { let is_token = token_kinds.contains(&ty.to_string()); if is_token { + let method_name = format_ident!("{}_token", method_name); quote! { pub fn #method_name(&self) -> Option<#ty> { support::token(&self.syntax) -- cgit v1.2.3 From 2bfb65db93e48d8f9e8ecac0b2ea837c081a4db5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 9 Apr 2020 18:40:43 +0200 Subject: Be consistent about token accesors --- xtask/src/ast_src.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'xtask') diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index eba66ff4d..74a87e900 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs @@ -408,7 +408,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { struct TupleType { LParen, fields: [TypeRef], RParen } struct NeverType { Excl } struct PathType { Path } - struct PointerType { Star, ConstKw, TypeRef } + struct PointerType { Star, ConstKw, MutKw, TypeRef } struct ArrayType { LBrack, TypeRef, Semi, Expr, RBrack } struct SliceType { LBrack, TypeRef, RBrack } struct ReferenceType { Amp, Lifetime, MutKw, TypeRef } @@ -485,7 +485,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { struct ParenPat { LParen, Pat, RParen } struct RefPat { Amp, MutKw, Pat } struct BoxPat { BoxKw, Pat } - struct BindPat: AttrsOwner, NameOwner { RefKw, MutKw, Pat } + struct BindPat: AttrsOwner, NameOwner { RefKw, MutKw, At, Pat } struct PlaceholderPat { Underscore } struct DotDotPat { Dotdot } struct PathPat { Path } @@ -545,6 +545,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { Pat, Eq, initializer: Expr, + Semi, } struct Condition { LetKw, Pat, Eq, Expr } struct Block: AttrsOwner, ModuleItemOwner { -- cgit v1.2.3