@@ -143,6 +143,8 @@ pub struct MatcherPos {
143
143
sp_lo : BytePos ,
144
144
}
145
145
146
+ pub type NamedParseResult = ParseResult < HashMap < Ident , Rc < NamedMatch > > > ;
147
+
146
148
pub fn count_names ( ms : & [ TokenTree ] ) -> usize {
147
149
ms. iter ( ) . fold ( 0 , |count, elt| {
148
150
count + match * elt {
@@ -200,8 +202,7 @@ pub enum NamedMatch {
200
202
MatchedNonterminal ( Rc < Nonterminal > )
201
203
}
202
204
203
- fn nameize ( ms : & [ TokenTree ] , res : & [ Rc < NamedMatch > ] )
204
- -> ParseResult < HashMap < Ident , Rc < NamedMatch > > > {
205
+ fn nameize ( ms : & [ TokenTree ] , res : & [ Rc < NamedMatch > ] ) -> NamedParseResult {
205
206
fn n_rec ( m : & TokenTree , res : & [ Rc < NamedMatch > ] ,
206
207
ret_val : & mut HashMap < Ident , Rc < NamedMatch > > , idx : & mut usize )
207
208
-> Result < ( ) , ( syntax_pos:: Span , String ) > {
@@ -265,8 +266,6 @@ pub fn parse_failure_msg(tok: Token) -> String {
265
266
}
266
267
}
267
268
268
- pub type NamedParseResult = ParseResult < HashMap < Ident , Rc < NamedMatch > > > ;
269
-
270
269
/// Perform a token equality check, ignoring syntax context (that is, an
271
270
/// unhygienic comparison)
272
271
pub fn token_name_eq ( t1 : & Token , t2 : & Token ) -> bool {
0 commit comments