Move modules outside the proc macro
This commit is contained in:
parent
afeda72dad
commit
baebf79057
2 changed files with 42 additions and 24 deletions
|
@ -129,18 +129,8 @@ pub fn symbols(input: TokenStream) -> TokenStream {
|
||||||
}
|
}
|
||||||
|
|
||||||
TokenStream::from(quote! {
|
TokenStream::from(quote! {
|
||||||
#[allow(non_upper_case_globals)]
|
macro_rules! keywords {
|
||||||
pub mod keywords {
|
() => {
|
||||||
use super::{Symbol, Ident};
|
|
||||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
|
||||||
pub struct Keyword {
|
|
||||||
ident: Ident,
|
|
||||||
}
|
|
||||||
impl Keyword {
|
|
||||||
#[inline] pub fn ident(self) -> Ident { self.ident }
|
|
||||||
#[inline] pub fn name(self) -> Symbol { self.ident.name }
|
|
||||||
}
|
|
||||||
|
|
||||||
#keyword_stream
|
#keyword_stream
|
||||||
|
|
||||||
impl std::str::FromStr for Keyword {
|
impl std::str::FromStr for Keyword {
|
||||||
|
@ -154,13 +144,13 @@ pub fn symbols(input: TokenStream) -> TokenStream {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(non_upper_case_globals)]
|
macro_rules! symbols {
|
||||||
pub mod symbols {
|
() => {
|
||||||
use super::Symbol;
|
|
||||||
|
|
||||||
#symbols_stream
|
#symbols_stream
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Interner {
|
impl Interner {
|
||||||
pub fn fresh() -> Self {
|
pub fn fresh() -> Self {
|
||||||
|
|
|
@ -406,6 +406,34 @@ impl Interner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub mod keywords {
|
||||||
|
use super::{Symbol, Ident};
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||||
|
pub struct Keyword {
|
||||||
|
ident: Ident,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Keyword {
|
||||||
|
#[inline]
|
||||||
|
pub fn ident(self) -> Ident {
|
||||||
|
self.ident
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn name(self) -> Symbol {
|
||||||
|
self.ident.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
keywords!();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub mod symbols {
|
||||||
|
use super::Symbol;
|
||||||
|
symbols!();
|
||||||
|
}
|
||||||
|
|
||||||
impl Symbol {
|
impl Symbol {
|
||||||
fn is_used_keyword_2018(self) -> bool {
|
fn is_used_keyword_2018(self) -> bool {
|
||||||
self == keywords::Dyn.name()
|
self == keywords::Dyn.name()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue