File tree 2 files changed +44
-26
lines changed
2 files changed +44
-26
lines changed Original file line number Diff line number Diff line change @@ -129,37 +129,27 @@ pub fn symbols(input: TokenStream) -> TokenStream {
129
129
}
130
130
131
131
TokenStream :: from ( quote ! {
132
- #[ allow( non_upper_case_globals) ]
133
- pub mod keywords {
134
- use super :: { Symbol , Ident } ;
135
- #[ derive( Clone , Copy , PartialEq , Eq ) ]
136
- pub struct Keyword {
137
- ident: Ident ,
138
- }
139
- impl Keyword {
140
- #[ inline] pub fn ident( self ) -> Ident { self . ident }
141
- #[ inline] pub fn name( self ) -> Symbol { self . ident. name }
142
- }
143
-
144
- #keyword_stream
145
-
146
- impl std:: str :: FromStr for Keyword {
147
- type Err = ( ) ;
148
-
149
- fn from_str( s: & str ) -> Result <Self , ( ) > {
150
- match s {
151
- #from_str_stream
152
- _ => Err ( ( ) ) ,
132
+ macro_rules! keywords {
133
+ ( ) => {
134
+ #keyword_stream
135
+
136
+ impl std:: str :: FromStr for Keyword {
137
+ type Err = ( ) ;
138
+
139
+ fn from_str( s: & str ) -> Result <Self , ( ) > {
140
+ match s {
141
+ #from_str_stream
142
+ _ => Err ( ( ) ) ,
143
+ }
153
144
}
154
145
}
155
146
}
156
147
}
157
148
158
- #[ allow( non_upper_case_globals) ]
159
- pub mod symbols {
160
- use super :: Symbol ;
161
-
162
- #symbols_stream
149
+ macro_rules! symbols {
150
+ ( ) => {
151
+ #symbols_stream
152
+ }
163
153
}
164
154
165
155
impl Interner {
Original file line number Diff line number Diff line change @@ -406,6 +406,34 @@ impl Interner {
406
406
}
407
407
}
408
408
409
+ pub mod keywords {
410
+ use super :: { Symbol , Ident } ;
411
+
412
+ #[ derive( Clone , Copy , PartialEq , Eq ) ]
413
+ pub struct Keyword {
414
+ ident : Ident ,
415
+ }
416
+
417
+ impl Keyword {
418
+ #[ inline]
419
+ pub fn ident ( self ) -> Ident {
420
+ self . ident
421
+ }
422
+
423
+ #[ inline]
424
+ pub fn name ( self ) -> Symbol {
425
+ self . ident . name
426
+ }
427
+ }
428
+
429
+ keywords ! ( ) ;
430
+ }
431
+
432
+ pub mod symbols {
433
+ use super :: Symbol ;
434
+ symbols ! ( ) ;
435
+ }
436
+
409
437
impl Symbol {
410
438
fn is_used_keyword_2018 ( self ) -> bool {
411
439
self == keywords:: Dyn . name ( )
You can’t perform that action at this time.
0 commit comments