@@ -10,6 +10,7 @@ use crate::specific::core::exit::statement_exit_p;
1010use crate :: specific:: core:: for_loop:: for_loop_p;
1111use crate :: specific:: core:: go_sub:: { statement_go_sub_p, statement_return_p} ;
1212use crate :: specific:: core:: if_block:: if_block_p;
13+ use crate :: specific:: core:: macros:: bi_tuple;
1314use crate :: specific:: core:: name:: {
1415 bare_name_with_dots, identifier_with_dots, token_list_to_bare_name,
1516} ;
@@ -138,47 +139,6 @@ pub enum Statement {
138139 Print ( Print ) ,
139140}
140141
141- macro_rules! bi_tuple {
142- ( $( #[ $( $attrss: tt) * ] ) * $name: ident( $left: ty, $right: ty) ) => {
143- $( #[ $( $attrss) * ] ) *
144- #[ derive( Clone , Debug , PartialEq ) ]
145- pub struct $name( $left, $right) ;
146-
147- impl $name {
148- pub fn new( left: $left, right: $right) -> Self {
149- Self ( left, right)
150- }
151-
152- pub fn try_map_right<F , E >( self , f: F ) -> Result <Self , E >
153- where F : FnOnce ( $right) -> Result <$right, E >
154- {
155- let ( left, right) = self . into( ) ;
156- f( right) . map( |new_right| Self :: new( left, new_right) )
157- }
158-
159- pub fn left( & self ) -> & $left {
160- & self . 0
161- }
162-
163- pub fn right( & self ) -> & $right {
164- & self . 1
165- }
166- }
167-
168- impl From <$name> for ( $left, $right) {
169- fn from( value: $name) -> Self {
170- ( value. 0 , value. 1 )
171- }
172- }
173-
174- impl <' a> From <& ' a $name> for ( & ' a $left, & ' a $right) {
175- fn from( value: & ' a $name) -> Self {
176- ( & value. 0 , & value. 1 )
177- }
178- }
179- } ;
180- }
181-
182142bi_tuple ! (
183143 /// A constant declaration.
184144 Constant ( NamePos , ExpressionPos )
0 commit comments