about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-10-08 02:52:08 +0000
committerbors <bors@rust-lang.org>2014-10-08 02:52:08 +0000
commit593174b42d522f7c5e90ea18402cf67306e2481d (patch)
tree16f8be555768e5250ddbf8dc2325da6a022b4c26 /src/libsyntax
parent0606234880ac8318a8e247e836ac61b32c63e9f9 (diff)
parentfc60797f7f3079288bdd1717dedbb885eaf1dbfa (diff)
downloadrust-593174b42d522f7c5e90ea18402cf67306e2481d.tar.gz
rust-593174b42d522f7c5e90ea18402cf67306e2481d.zip
auto merge of #17838 : vadimcn/rust/macros, r=alexcrichton
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) {