summary refs log tree commit diff
path: root/src/rustc/syntax/parse
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2012-03-14 15:16:46 -0400
committerNiko Matsakis <niko@alum.mit.edu>2012-03-20 20:39:40 -0700
commitcfcbec3cc3bde0b8e811520e3bd842f53c2c9e26 (patch)
treef6b837b27e979fabfca3bc1df10a2b742d42d351 /src/rustc/syntax/parse
parentba39e277e2c63909cb35a0dd68e9f3bab728c425 (diff)
Implement an initial version of placement new.
Diffstat (limited to 'src/rustc/syntax/parse')
-rw-r--r--src/rustc/syntax/parse/parser.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rustc/syntax/parse/parser.rs b/src/rustc/syntax/parse/parser.rs
index 4fe7aade41c..99746aed84a 100644
--- a/src/rustc/syntax/parse/parser.rs
+++ b/src/rustc/syntax/parse/parser.rs
@@ -150,7 +150,7 @@ fn bad_expr_word_table() -> hashmap<str, ()> {
                  "enum", "export", "fail", "fn", "for", "if",  "iface",
                  "impl", "import", "let", "log", "loop", "mod", "mut",
                  "mutable", "native", "pure", "resource", "ret", "trait",
-                 "type", "unchecked", "unsafe", "while"] {
+                 "type", "unchecked", "unsafe", "while", "new"] {
         words.insert(word, ());
     }
     words
@@ -852,6 +852,13 @@ fn parse_bottom_expr(p: parser) -> pexpr {
             let blk = parse_block_tail(p, lo, ast::default_blk);
             ret mk_pexpr(p, blk.span.lo, blk.span.hi, ast::expr_block(blk));
         }
+    } else if eat_word(p, "new") {
+        expect(p, token::LPAREN);
+        let r = parse_expr(p);
+        expect(p, token::RPAREN);
+        let v = parse_expr(p);
+        ret mk_pexpr(p, lo, p.span.hi,
+                     ast::expr_new(r, p.get_id(), v));
     } else if eat_word(p, "if") {
         ret pexpr(parse_if_expr(p));
     } else if eat_word(p, "for") {