about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-06-14 19:02:30 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-06-14 19:09:02 -0700
commit39d9c30a1549ca0b69325bb7e4d9c993d3bc9a71 (patch)
tree673b3ed3c75c4e40e4d753d19c026de43af69e52 /src/libsyntax
parentbc507c4ef5a5e4da95e95c080239dbe10ffcd376 (diff)
downloadrust-39d9c30a1549ca0b69325bb7e4d9c993d3bc9a71.tar.gz
rust-39d9c30a1549ca0b69325bb7e4d9c993d3bc9a71.zip
Remove code from parser that was awaiting snapshot
Remove old parser functions as well as support for old-style capture
clauses. Remove remaining old-style capture clauses.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/source_util.rs2
-rw-r--r--src/libsyntax/parse/parser.rs62
2 files changed, 2 insertions, 62 deletions
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs
index 23c6a3714c3..ae76cbafef7 100644
--- a/src/libsyntax/ext/source_util.rs
+++ b/src/libsyntax/ext/source_util.rs
@@ -59,7 +59,7 @@ fn expand_include(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
     let p = parse::new_parser_from_file(cx.parse_sess(), cx.cfg(),
                                         res_rel_file(cx, sp, file),
                                         parse::parser::SOURCE_FILE);
-    ret parse::parser::parse_expr(p)
+    ret p.parse_expr();
 }
 
 fn expand_include_str(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg,
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index e0029b2a222..20452cd8724 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -16,8 +16,6 @@ import dvec::{dvec, extensions};
 
 export file_type;
 export parser;
-export parse_expr;
-export parse_pat;
 
 // FIXME: #ast expects to find this here but it's actually defined in `parse`
 // Fixing this will be easier when we have export decls on individual items --
@@ -26,12 +24,6 @@ export parse_pat;
 import parse_from_source_str;
 export parse_from_source_str;
 
-// TODO: remove these once we go around a snapshot cycle.
-// These are here for the old way that #ast (qquote.rs) worked
-fn parse_expr(p: parser) -> @ast::expr { p.parse_expr() }
-fn parse_pat(p: parser) -> @ast::pat { p.parse_pat() }
-
-
 enum restriction {
     UNRESTRICTED,
     RESTRICT_STMT_EXPR,
@@ -1231,8 +1223,6 @@ class parser {
     fn parse_fn_expr(proto: proto) -> @expr {
         let lo = self.last_span.lo;
 
-        let cc_old = self.parse_old_skool_capture_clause();
-
         // if we want to allow fn expression argument types to be inferred in
         // the future, just have to change parse_arg to parse_fn_block_arg.
         let (decl, capture_clause) =
@@ -1241,8 +1231,7 @@ class parser {
 
         let body = self.parse_block();
         ret self.mk_expr(lo, body.span.hi,
-                         expr_fn(proto, decl, body,
-                                 @(*capture_clause + cc_old)));
+                         expr_fn(proto, decl, body, capture_clause));
     }
 
     fn parse_fn_block_expr() -> @expr {
@@ -1731,55 +1720,6 @@ class parser {
         } else { [] }
     }
 
-    // FIXME Remove after snapshot
-    fn parse_old_skool_capture_clause() -> [capture_item] {
-        fn expect_opt_trailing_semi(p: parser) {
-            if !p.eat(token::SEMI) {
-                if p.token != token::RBRACKET {
-                    p.fatal("expecting ; or ]");
-                }
-            }
-        }
-
-        fn eat_ident_list(p: parser, is_move: bool) -> [capture_item] {
-            let mut res = [];
-            loop {
-                alt p.token {
-                  token::IDENT(_, _) {
-                    let id = p.get_id();
-                    let sp = mk_sp(p.span.lo, p.span.hi);
-                    let ident = p.parse_ident();
-                    res += [@{id:id, is_move: is_move, name:ident, span:sp}];
-                    if !p.eat(token::COMMA) {
-                        ret res;
-                    }
-                  }
-
-                  _ { ret res; }
-                }
-            };
-        }
-
-        let mut cap_items = [];
-
-        if self.eat(token::LBRACKET) {
-            while !self.eat(token::RBRACKET) {
-                if self.eat_keyword("copy") {
-                    cap_items += eat_ident_list(self, false);
-                    expect_opt_trailing_semi(self);
-                } else if self.eat_keyword("move") {
-                    cap_items += eat_ident_list(self, true);
-                    expect_opt_trailing_semi(self);
-                } else {
-                    let s: str = "expecting send, copy, or move clause";
-                    self.fatal(s);
-                }
-            }
-        }
-
-        ret cap_items;
-    }
-
     fn parse_fn_decl(purity: purity,
                      parse_arg_fn: fn(parser) -> arg_or_capture_item)
         -> (fn_decl, capture_clause) {