File tree Expand file tree Collapse file tree 2 files changed +4
-11
lines changed
Expand file tree Collapse file tree 2 files changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,6 @@ impl syn::parse::Parse for ParseIt {
3535 fn parse ( input : syn:: parse:: ParseStream ) -> syn:: Result < Self > {
3636 let mut mods = vec ! [ ] ;
3737 while !input. is_empty ( ) {
38- let fork = input. fork ( ) ;
3938 let mut attrs = input. call ( syn:: Attribute :: parse_outer) ?;
4039
4140 input. parse :: < Token ! [ mod ] > ( ) ?;
@@ -48,7 +47,6 @@ impl syn::parse::Parse for ParseIt {
4847 enum ModType {
4948 Parser ,
5049 Lexer ,
51- Common ,
5250 }
5351 let mut mod_types = vec ! [ ] ;
5452 attrs. retain ( |attr| {
@@ -62,7 +60,10 @@ impl syn::parse::Parse for ParseIt {
6260 true
6361 } ) ;
6462 let mod_type = if mod_types. is_empty ( ) {
65- ModType :: Common
63+ return Err ( syn:: Error :: new_spanned (
64+ mod_name,
65+ "module must be marked as parser or lexer" ,
66+ ) ) ;
6667 } else if mod_types. len ( ) == 1 {
6768 mod_types[ 0 ]
6869 } else {
@@ -77,10 +78,6 @@ impl syn::parse::Parse for ParseIt {
7778 mods. push ( Mod :: Parser ( parser_mod) ) ;
7879 }
7980 ModType :: Lexer => todo ! ( ) ,
80- ModType :: Common => {
81- mods. push ( Mod :: Common ( fork. parse :: < syn:: ItemMod > ( ) ?) ) ;
82- input. advance_to ( & fork) ;
83- }
8481 }
8582 }
8683 Ok ( Self { mods } )
@@ -90,7 +87,6 @@ impl syn::parse::Parse for ParseIt {
9087#[ derive( Debug ) ]
9188pub enum Mod {
9289 Parser ( ParserMod ) ,
93- Common ( syn:: ItemMod ) ,
9490}
9591
9692#[ derive( Debug ) ]
Original file line number Diff line number Diff line change @@ -17,9 +17,6 @@ pub fn parse_it(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
1717 } ;
1818 result. extend ( tokens) ;
1919 }
20- Mod :: Common ( item_mod) => {
21- result. extend ( proc_macro:: TokenStream :: from ( quote:: quote! { #item_mod } ) ) ;
22- } ,
2320 }
2421 }
2522 result
You can’t perform that action at this time.
0 commit comments