about summary refs log tree commit diff
path: root/src/comp/syntax/parse
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2011-08-24 13:39:15 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2011-08-24 14:21:37 -0700
commitc6155d1fd112407c2d111c0c81c38a3606a0954e (patch)
tree3e28872864ee455b0a7e931bd0393c7038ea24d7 /src/comp/syntax/parse
parent5b5689d4ddbc75c34c5c9c70fdbc27b351a7a2f4 (diff)
downloadrust-c6155d1fd112407c2d111c0c81c38a3606a0954e.tar.gz
rust-c6155d1fd112407c2d111c0c81c38a3606a0954e.zip
Change "pred" to "pure fn" (but still accept "pred")
This is part 1 of changing the "pred" keyword to "pure fn".
Right now, the compiler accepts both "pred" and "pure fn".
Diffstat (limited to 'src/comp/syntax/parse')
-rw-r--r--src/comp/syntax/parse/parser.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
index aa553e32e39..b4ad7339e25 100644
--- a/src/comp/syntax/parse/parser.rs
+++ b/src/comp/syntax/parse/parser.rs
@@ -173,7 +173,7 @@ fn bad_expr_word_table() -> hashmap<str, ()> {
     words.insert("fn", ());
     words.insert("block", ());
     words.insert("lambda", ());
-    words.insert("pred", ());
+    words.insert("pure", ());
     words.insert("iter", ());
     words.insert("block", ());
     words.insert("import", ());
@@ -326,8 +326,6 @@ fn parse_proto(p: &parser) -> ast::proto {
         ret ast::proto_fn;
     } else if eat_word(p, "block") {
         ret ast::proto_block;
-    } else if eat_word(p, "pred") {
-        ret ast::proto_fn;
     } else { unexpected(p, p.peek()); }
 }
 
@@ -2123,7 +2121,13 @@ fn parse_item(p: &parser, attrs: &[ast::attribute]) -> option::t<@ast::item> {
         p.bump();
         ret some(parse_item_fn_or_iter(p, ast::impure_fn, ast::proto_fn,
                                        attrs, ast::il_normal));
-    } else if eat_word(p, "pred") {
+    } else if eat_word(p, "pure") {
+        expect_word(p, "fn");
+        ret some(parse_item_fn_or_iter(p, ast::pure_fn, ast::proto_fn, attrs,
+                                       ast::il_normal));
+    }
+    // FIXME: remove
+    else if eat_word(p, "pred") {
         ret some(parse_item_fn_or_iter(p, ast::pure_fn, ast::proto_fn, attrs,
                                        ast::il_normal));
     } else if eat_word(p, "iter") {