about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2012-07-27 18:06:24 -0700
committerGraydon Hoare <graydon@mozilla.com>2012-07-27 18:06:24 -0700
commiteabd233dcd208bc21ca0f8eea02d87d56e5314eb (patch)
tree2ce72ee16c9e2fd5ad84b5f150bc791daffc49da /src/libsyntax
parent1d9f01cb421eae8e7ace0fa6b4d7f5ddf3ce4f65 (diff)
downloadrust-eabd233dcd208bc21ca0f8eea02d87d56e5314eb.tar.gz
rust-eabd233dcd208bc21ca0f8eea02d87d56e5314eb.zip
Start killing off obsolete/unused quoters, and fix long lines.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs11
-rw-r--r--src/libsyntax/ext/simplext.rs40
-rw-r--r--src/libsyntax/fold.rs2
-rw-r--r--src/libsyntax/parse/parser.rs19
-rw-r--r--src/libsyntax/print/pprust.rs11
-rw-r--r--src/libsyntax/visit.rs2
6 files changed, 9 insertions, 76 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 23aaab47950..35af5e7a9f5 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -406,7 +406,8 @@ type matcher = spanned<matcher_>;
 //        $foo:expr   =>     1 + $foo    // interpolate an expr
 //        $foo:tt     =>     $foo        // interpolate a token-tree
 //        $foo:tt     =>     bar! $foo   // only other valid interpolation
-//                                       // is in arg position for another macro
+//                                       // is in arg position for another
+//                                       // macro
 //
 // As a final, horrifying aside, note that macro-by-example's input is
 // also matched by one of these matchers. Holy self-referential! It is matched
@@ -441,11 +442,9 @@ type mac_body = option<mac_body_>;
 
 #[auto_serialize]
 enum mac_ {
-    mac_invoc(@path, mac_arg, mac_body),
-    mac_invoc_tt(@path,~[token_tree]), // will kill mac_invoc and steal its name
-    mac_embed_type(@ty),  // obsolete quoter
-    mac_embed_block(blk), // obsolete quoter
-    mac_ellipsis,         // obsolete pattern-match terminal
+    mac_invoc(@path, mac_arg, mac_body), // old macro-invocation
+    mac_invoc_tt(@path,~[token_tree]),   // new macro-invocation
+    mac_ellipsis,                        // old pattern-match (obsolete)
 
     // the span is used by the quoter/anti-quoter ...
     mac_aq(span /* span of quote */, @expr), // anti-quote
diff --git a/src/libsyntax/ext/simplext.rs b/src/libsyntax/ext/simplext.rs
index 333c510b7cd..2f8e63facf9 100644
--- a/src/libsyntax/ext/simplext.rs
+++ b/src/libsyntax/ext/simplext.rs
@@ -539,7 +539,7 @@ fn block_to_ident(blk: blk_) -> option<ident> {
         }
 }
 
-fn p_t_s_r_mac(cx: ext_ctxt, mac: ast::mac, s: selector, b: binders) {
+fn p_t_s_r_mac(cx: ext_ctxt, mac: ast::mac, _s: selector, _b: binders) {
     fn select_pt_1(cx: ext_ctxt, m: matchable,
                    fn_m: fn(ast::mac) -> match_result) -> match_result {
         ret alt m {
@@ -556,44 +556,6 @@ fn p_t_s_r_mac(cx: ext_ctxt, mac: ast::mac, s: selector, b: binders) {
       ast::mac_ellipsis { cx.span_fatal(mac.span, ~"misused `...`"); }
       ast::mac_invoc(_, _, _) { no_des(cx, mac.span, ~"macro calls"); }
       ast::mac_invoc_tt(_, _) { no_des(cx, mac.span, ~"macro calls"); }
-      ast::mac_embed_type(ty) {
-        alt ty.node {
-          ast::ty_path(pth, _) {
-            alt path_to_ident(pth) {
-              some(id) {
-                /* look for an embedded type */
-                fn select_pt_2(m: ast::mac) -> match_result {
-                    ret alt m.node {
-                          ast::mac_embed_type(t) { some(leaf(match_ty(t))) }
-                          _ { none }
-                        }
-                }
-                let final_step = |x| select_pt_1(cx, x, select_pt_2);
-                b.real_binders.insert(id, compose_sels(s, final_step));
-              }
-              none { no_des(cx, pth.span, ~"under `#<>`"); }
-            }
-          }
-          _ { no_des(cx, ty.span, ~"under `#<>`"); }
-        }
-      }
-      ast::mac_embed_block(blk) {
-        alt block_to_ident(blk.node) {
-          some(id) {
-            fn select_pt_2(m: ast::mac) -> match_result {
-                ret alt m.node {
-                      ast::mac_embed_block(blk) {
-                        some(leaf(match_block(blk)))
-                      }
-                      _ { none }
-                    }
-            }
-            let final_step = |x| select_pt_1(cx, x, select_pt_2);
-            b.real_binders.insert(id, compose_sels(s, final_step));
-          }
-          none { no_des(cx, blk.span, ~"under `#{}`"); }
-        }
-      }
       ast::mac_aq(_,_) { no_des(cx, mac.span, ~"antiquotes"); }
       ast::mac_var(_) { no_des(cx, mac.span, ~"antiquote variables"); }
     }
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index de9ed4b2570..168d82344d3 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -118,8 +118,6 @@ fn fold_mac_(m: mac, fld: ast_fold) -> mac {
                            option::map(arg, |x| fld.fold_expr(x)), body)
                }
                mac_invoc_tt(pth, tt) { m.node }
-               mac_embed_type(ty) { mac_embed_type(fld.fold_ty(ty)) }
-               mac_embed_block(blk) { mac_embed_block(fld.fold_block(blk)) }
                mac_ellipsis { mac_ellipsis }
                mac_aq(_,_) { /* FIXME (#2543) */ copy m.node }
                mac_var(_) { /* FIXME (#2543) */ copy m.node }
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 0723103877b..51f6ae021cd 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -38,8 +38,8 @@ import ast::{_mod, add, alt_check, alt_exhaustive, arg, arm, attribute,
              item_foreign_mod, item_impl, item_mac, item_mod, item_trait,
              item_ty, lit, lit_, lit_bool, lit_float, lit_int,
              lit_int_unsuffixed, lit_nil, lit_str, lit_uint, local, m_const,
-             m_imm, m_mutbl, mac_, mac_aq, mac_ellipsis, mac_embed_block,
-             mac_embed_type, mac_invoc, mac_invoc_tt, mac_var, matcher,
+             m_imm, m_mutbl, mac_, mac_aq, mac_ellipsis,
+             mac_invoc, mac_invoc_tt, mac_var, matcher,
              method, mode, mt, mtc_bb, mtc_rep, mtc_tok, mul, mutability, neg,
              noreturn, not, pat, pat_box, pat_enum, pat_ident, pat_lit,
              pat_range, pat_rec, pat_tup, pat_uniq, pat_wild, path, private,
@@ -831,21 +831,6 @@ class parser {
                 |p| p.parse_expr());
             hi = self.span.hi;
             ex = expr_vec(es, mutbl);
-        } else if self.token == token::POUND
-            && self.look_ahead(1u) == token::LT {
-            self.bump(); self.bump();
-            let ty = self.parse_ty(false);
-            self.expect(token::GT);
-
-            /* hack: early return to take advantage of specialized function */
-            ret pexpr(self.mk_mac_expr(lo, self.span.hi,
-                                       mac_embed_type(ty)));
-        } else if self.token == token::POUND
-            && self.look_ahead(1u) == token::LBRACE {
-            self.bump(); self.bump();
-            let blk = mac_embed_block(
-                self.parse_block_tail(lo, default_blk));
-            ret pexpr(self.mk_mac_expr(lo, self.span.hi, blk));
         } else if self.token == token::ELLIPSIS {
             self.bump();
             ret pexpr(self.mk_mac_expr(lo, self.span.hi, mac_ellipsis));
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index aacb725ec6c..8e541aed76d 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -728,7 +728,7 @@ fn print_block_with_attrs(s: ps, blk: ast::blk, attrs: ~[ast::attribute]) {
     print_possibly_embedded_block_(s, blk, block_normal, indent_unit, attrs);
 }
 
-enum embed_type { block_macro, block_block_fn, block_normal, }
+enum embed_type { block_block_fn, block_normal, }
 
 fn print_possibly_embedded_block(s: ps, blk: ast::blk, embedded: embed_type,
                                  indented: uint) {
@@ -747,7 +747,6 @@ fn print_possibly_embedded_block_(s: ps, blk: ast::blk, embedded: embed_type,
     let ann_node = node_block(s, blk);
     s.ann.pre(ann_node);
     alt embedded {
-      block_macro { word(s.s, ~"#{"); end(s); }
       block_block_fn { end(s); }
       block_normal { bopen(s); }
     }
@@ -841,14 +840,6 @@ fn print_mac(s: ps, m: ast::mac) {
         for tts.each() |tt| { print_tt(s, tt); }
         bclose(s, m.span);
       }
-      ast::mac_embed_type(ty) {
-        word(s.s, ~"#<");
-        print_type(s, ty);
-        word(s.s, ~">");
-      }
-      ast::mac_embed_block(blk) {
-        print_possibly_embedded_block(s, blk, block_normal, indent_unit);
-      }
       ast::mac_ellipsis { word(s.s, ~"..."); }
       ast::mac_var(v) { word(s.s, #fmt("$%u", v)); }
       _ { /* fixme */ }
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index c7aed0ef90a..e279bf3a7f8 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -351,8 +351,6 @@ fn visit_mac<E>(m: mac, e: E, v: vt<E>) {
       ast::mac_invoc(pth, arg, body) {
         option::map(arg, |arg| v.visit_expr(arg, e, v)); }
       ast::mac_invoc_tt(pth, tt) { /* no user-serviceable parts inside */ }
-      ast::mac_embed_type(ty) { v.visit_ty(ty, e, v); }
-      ast::mac_embed_block(blk) { v.visit_block(blk, e, v); }
       ast::mac_ellipsis { }
       ast::mac_aq(_, e) { /* FIXME: maybe visit (Issue #2340) */ }
       ast::mac_var(_) { }