Semicolon token

This commit is contained in:
Aleksey Kladov 2020-04-10 10:11:05 +02:00
parent f89f2e3885
commit c8b4c36f81
7 changed files with 57 additions and 29 deletions

View file

@ -515,7 +515,7 @@ impl Field<'_> {
fn token_kind(&self) -> Option<proc_macro2::TokenStream> {
let res = match self {
Field::Token(token) => {
let token = format_ident!("{}", token);
let token: proc_macro2::TokenStream = token.parse().unwrap();
quote! { T![#token] }
}
_ => return None,
@ -524,7 +524,13 @@ impl Field<'_> {
}
fn method_name(&self) -> proc_macro2::Ident {
match self {
Field::Token(name) => format_ident!("{}_token", name),
Field::Token(name) => {
let name = match *name {
";" => "semicolon",
_ => name,
};
format_ident!("{}_token", name)
}
Field::Node { name, src } => match src {
FieldSrc::Shorthand => format_ident!("{}", to_lower_snake_case(name)),
_ => format_ident!("{}", name),