about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 090b39eee47..88376108fec 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -350,7 +350,16 @@ pub fn parse(sess: &ParseSess,
                         sp_lo: sp.lo
                     });
                   }
-                  MatchNonterminal(_,_,_) => { bb_eis.push(ei) }
+                  MatchNonterminal(_,_,_) => {
+                    // Built-in nonterminals never start with these tokens,
+                    // so we can eliminate them from consideration.
+                    match tok {
+                        token::RPAREN |
+                        token::RBRACE |
+                        token::RBRACKET => {},
+                        _ => bb_eis.push(ei)
+                    }
+                  }
                   MatchTok(ref t) => {
                     let mut ei_t = ei.clone();
                     if token_name_eq(t,&tok) {