Skip to content

Commit 68abb24

Browse files
Factor out NamedParseResult.
1 parent eef10d0 commit 68abb24

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/libsyntax/ext/tt/macro_parser.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ pub struct MatcherPos {
143143
sp_lo: BytePos,
144144
}
145145

146+
pub type NamedParseResult = ParseResult<HashMap<Ident, Rc<NamedMatch>>>;
147+
146148
pub fn count_names(ms: &[TokenTree]) -> usize {
147149
ms.iter().fold(0, |count, elt| {
148150
count + match *elt {
@@ -200,8 +202,7 @@ pub enum NamedMatch {
200202
MatchedNonterminal(Rc<Nonterminal>)
201203
}
202204

203-
fn nameize(ms: &[TokenTree], res: &[Rc<NamedMatch>])
204-
-> ParseResult<HashMap<Ident, Rc<NamedMatch>>> {
205+
fn nameize(ms: &[TokenTree], res: &[Rc<NamedMatch>]) -> NamedParseResult {
205206
fn n_rec(m: &TokenTree, res: &[Rc<NamedMatch>],
206207
ret_val: &mut HashMap<Ident, Rc<NamedMatch>>, idx: &mut usize)
207208
-> Result<(), (syntax_pos::Span, String)> {
@@ -265,8 +266,6 @@ pub fn parse_failure_msg(tok: Token) -> String {
265266
}
266267
}
267268

268-
pub type NamedParseResult = ParseResult<HashMap<Ident, Rc<NamedMatch>>>;
269-
270269
/// Perform a token equality check, ignoring syntax context (that is, an
271270
/// unhygienic comparison)
272271
pub fn token_name_eq(t1 : &Token, t2 : &Token) -> bool {

0 commit comments

Comments
 (0)