about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorPaul Stansifer <paul.stansifer@gmail.com>2012-06-25 15:04:50 -0700
committerPaul Stansifer <paul.stansifer@gmail.com>2012-06-25 18:01:37 -0700
commit4df2654f828b1346dab75166ddca7222666b5939 (patch)
tree584c11a146e698538b8b6da99eb980404c8bd90e /src/libsyntax/parse
parent4f104954a67ad736244ce212467290c836394fad (diff)
downloadrust-4df2654f828b1346dab75166ddca7222666b5939.tar.gz
rust-4df2654f828b1346dab75166ddca7222666b5939.zip
Make it possible to make built-in tt syntax extensions
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 02d08ab5ae8..13b68b2ce70 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -883,8 +883,17 @@ class parser {
             is_ident(self.token) && !self.is_keyword("true") &&
             !self.is_keyword("false") {
             let pth = self.parse_path_with_tps(true);
-            hi = pth.span.hi;
-            ex = expr_path(pth);
+
+            /* `!`, as an operator, is prefix, so we know this isn't that */
+            if self.token == token::NOT {
+                self.bump();
+                let m_body = self.parse_token_tree();
+                let hi = self.span.hi;
+                ret pexpr(self.mk_mac_expr(lo, hi, mac_invoc_tt(pth,m_body)));
+            } else {
+                hi = pth.span.hi;
+                ex = expr_path(pth);
+            }
         } else {
             let lit = self.parse_lit();
             hi = lit.span.hi;