@@ -345,6 +345,38 @@ fn initial_matcher_pos<'root, 'tt>(ms: &'tt [TokenTree]) -> MatcherPos<'root, 't
345345/// token tree. The depth of the `NamedMatch` structure will therefore depend
346346/// only on the nesting depth of `ast::TTSeq`s in the originating
347347/// token tree it was derived from.
348+ ///
349+ /// In layman's terms: `NamedMatch` will form a tree representing nested matches of a particular
350+ /// meta variable. For example, if we are matching the following macro against the following
351+ /// invocation...
352+ ///
353+ /// ```rust
354+ /// macro_rules! foo {
355+ /// ($($($x:ident),+);+) => {}
356+ /// }
357+ ///
358+ /// foo!(a, b, c, d; a, b, c, d, e);
359+ /// ```
360+ ///
361+ /// Then, the tree will have the following shape:
362+ ///
363+ /// ```rust
364+ /// MatchedSeq([
365+ /// MatchedSeq([
366+ /// MatchedNonterminal(a),
367+ /// MatchedNonterminal(b),
368+ /// MatchedNonterminal(c),
369+ /// MatchedNonterminal(d),
370+ /// ]),
371+ /// MatchedSeq([
372+ /// MatchedNonterminal(a),
373+ /// MatchedNonterminal(b),
374+ /// MatchedNonterminal(c),
375+ /// MatchedNonterminal(d),
376+ /// MatchedNonterminal(e),
377+ /// ])
378+ /// ])
379+ /// ```
348380#[ derive( Debug , Clone ) ]
349381crate enum NamedMatch {
350382 MatchedSeq ( Lrc < NamedMatchVec > ) ,
0 commit comments