Add _token suffix to token accessors

I think this makes is more clear which things are : AstNode and which
are : AstToken
This commit is contained in:
Aleksey Kladov 2020-04-09 18:25:36 +02:00
parent a95116fbfa
commit e6d22187a6
12 changed files with 210 additions and 213 deletions

View file

@ -208,6 +208,7 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: AstSrc<'_>) -> Result<String> {
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)