File tree 1 file changed +8
-0
lines changed
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -289,11 +289,17 @@ pub enum NamedMatch {
289
289
MatchedNonterminal ( Rc < Nonterminal > ) ,
290
290
}
291
291
292
+ /// Takes a sequence of token trees `ms` representing a matcher which successfully matched input
293
+ /// and an iterator of items that matched input and produces a `NamedParseResult`.
292
294
fn nameize < I : Iterator < Item = NamedMatch > > (
293
295
sess : & ParseSess ,
294
296
ms : & [ TokenTree ] ,
295
297
mut res : I ,
296
298
) -> NamedParseResult {
299
+ // Recursively descend into each type of matcher (e.g. sequences, delimited, metavars) and make
300
+ // sure that each metavar has _exactly one_ binding. If a metavar does not have exactly one
301
+ // binding, then there is an error. If it does, then we insert the binding into the
302
+ // `NamedParseResult`.
297
303
fn n_rec < I : Iterator < Item = NamedMatch > > (
298
304
sess : & ParseSess ,
299
305
m : & TokenTree ,
@@ -340,6 +346,8 @@ fn nameize<I: Iterator<Item = NamedMatch>>(
340
346
Success ( ret_val)
341
347
}
342
348
349
+ /// Generate an appropriate parsing failure message. For EOF, this is "unexpected end...". For
350
+ /// other tokens, this is "unexpected token...".
343
351
pub fn parse_failure_msg ( tok : Token ) -> String {
344
352
match tok {
345
353
token:: Eof => "unexpected end of macro invocation" . to_string ( ) ,
You can’t perform that action at this time.
0 commit comments