File tree 2 files changed +40
-1
lines changed
2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -350,7 +350,16 @@ pub fn parse(sess: &ParseSess,
350
350
sp_lo : sp. lo
351
351
} ) ;
352
352
}
353
- MatchNonterminal ( _, _, _) => { bb_eis. push ( ei) }
353
+ MatchNonterminal ( _, _, _) => {
354
+ // Built-in nonterminals never start with these tokens,
355
+ // so we can eliminate them from consideration.
356
+ match tok {
357
+ token:: RPAREN |
358
+ token:: RBRACE |
359
+ token:: RBRACKET => { } ,
360
+ _ => bb_eis. push ( ei)
361
+ }
362
+ }
354
363
MatchTok ( ref t) => {
355
364
let mut ei_t = ei. clone ( ) ;
356
365
if token_name_eq ( t, & tok) {
Original file line number Diff line number Diff line change
1
+ // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ #![ feature( macro_rules) ]
12
+
13
+ macro_rules! list (
14
+ ( ( $( $id: ident) ,* ) ) => ( ( ) ) ;
15
+ ( [ $( $id: ident) ,* ] ) => ( ( ) ) ;
16
+ ( { $( $id: ident) ,* } ) => ( ( ) ) ;
17
+ )
18
+
19
+ macro_rules! tt_list (
20
+ ( ( $( $tt: tt) ,* ) ) => ( ( ) ) ;
21
+ )
22
+
23
+ pub fn main ( ) {
24
+ list ! ( ( ) ) ;
25
+ list ! ( [ ] ) ;
26
+ list ! ( { } ) ;
27
+
28
+ tt_list ! ( ( a, b, c) ) ;
29
+ tt_list ! ( ( ) ) ;
30
+ }
You can’t perform that action at this time.
0 commit comments