@@ -561,56 +561,56 @@ pub enum TokenTree {
561
561
TTNonterminal ( Span , Ident )
562
562
}
563
563
564
- /// Matchers are nodes defined-by and recognized-by the main rust parser and
565
- /// language, but they're only ever found inside syntax-extension invocations;
566
- /// indeed, the only thing that ever _activates_ the rules in the rust parser
567
- /// for parsing a matcher is a matcher looking for the 'matchers' nonterminal
568
- /// itself. Matchers represent a small sub-language for pattern-matching
569
- /// token-trees, and are thus primarily used by the macro-defining extension
570
- /// itself.
571
- ///
572
- /// MatchTok
573
- /// --------
574
- ///
575
- /// A matcher that matches a single token, denoted by the token itself. So
576
- /// long as there's no $ involved.
577
- ///
578
- ///
579
- /// MatchSeq
580
- /// --------
581
- ///
582
- /// A matcher that matches a sequence of sub-matchers, denoted various
583
- /// possible ways:
584
- ///
585
- /// $(M)* zero or more Ms
586
- /// $(M)+ one or more Ms
587
- /// $(M),+ one or more comma-separated Ms
588
- /// $(A B C);* zero or more semi-separated 'A B C' seqs
589
- ///
590
- ///
591
- /// MatchNonterminal
592
- /// -----------------
593
- ///
594
- /// A matcher that matches one of a few interesting named rust
595
- /// nonterminals, such as types, expressions, items, or raw token-trees. A
596
- /// black-box matcher on expr, for example, binds an expr to a given ident,
597
- /// and that ident can re-occur as an interpolation in the RHS of a
598
- /// macro-by-example rule. For example:
599
- ///
600
- /// $foo:expr => 1 + $foo // interpolate an expr
601
- /// $foo:tt => $foo // interpolate a token-tree
602
- /// $foo:tt => bar! $foo // only other valid interpolation
603
- /// // is in arg position for another
604
- /// // macro
605
- ///
606
- /// As a final, horrifying aside, note that macro-by-example's input is
607
- /// also matched by one of these matchers. Holy self-referential! It is matched
608
- /// by a MatchSeq, specifically this one:
609
- ///
610
- /// $( $lhs:matchers => $rhs:tt );+
611
- ///
612
- /// If you understand that, you have closed the loop and understand the whole
613
- /// macro system. Congratulations.
564
+ // Matchers are nodes defined-by and recognized-by the main rust parser and
565
+ // language, but they're only ever found inside syntax-extension invocations;
566
+ // indeed, the only thing that ever _activates_ the rules in the rust parser
567
+ // for parsing a matcher is a matcher looking for the 'matchers' nonterminal
568
+ // itself. Matchers represent a small sub-language for pattern-matching
569
+ // token-trees, and are thus primarily used by the macro-defining extension
570
+ // itself.
571
+ //
572
+ // MatchTok
573
+ // --------
574
+ //
575
+ // A matcher that matches a single token, denoted by the token itself. So
576
+ // long as there's no $ involved.
577
+ //
578
+ //
579
+ // MatchSeq
580
+ // --------
581
+ //
582
+ // A matcher that matches a sequence of sub-matchers, denoted various
583
+ // possible ways:
584
+ //
585
+ // $(M)* zero or more Ms
586
+ // $(M)+ one or more Ms
587
+ // $(M),+ one or more comma-separated Ms
588
+ // $(A B C);* zero or more semi-separated 'A B C' seqs
589
+ //
590
+ //
591
+ // MatchNonterminal
592
+ // -----------------
593
+ //
594
+ // A matcher that matches one of a few interesting named rust
595
+ // nonterminals, such as types, expressions, items, or raw token-trees. A
596
+ // black-box matcher on expr, for example, binds an expr to a given ident,
597
+ // and that ident can re-occur as an interpolation in the RHS of a
598
+ // macro-by-example rule. For example:
599
+ //
600
+ // $foo:expr => 1 + $foo // interpolate an expr
601
+ // $foo:tt => $foo // interpolate a token-tree
602
+ // $foo:tt => bar! $foo // only other valid interpolation
603
+ // // is in arg position for another
604
+ // // macro
605
+ //
606
+ // As a final, horrifying aside, note that macro-by-example's input is
607
+ // also matched by one of these matchers. Holy self-referential! It is matched
608
+ // by a MatchSeq, specifically this one:
609
+ //
610
+ // $( $lhs:matchers => $rhs:tt );+
611
+ //
612
+ // If you understand that, you have closed the loop and understand the whole
613
+ // macro system. Congratulations.
614
614
pub type Matcher = Spanned < Matcher_ > ;
615
615
616
616
#[ deriving( Clone , PartialEq , Eq , Encodable , Decodable , Hash ) ]
0 commit comments