From 58b8e88356187b8631f24fa787c0dfefcb6a1970 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 6 Oct 2011 15:29:54 -0700 Subject: expand purity to include unsafe --- src/comp/syntax/parse/parser.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/comp/syntax/parse') diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index c359cc843cc..5a4c5d78772 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -165,6 +165,7 @@ fn bad_expr_word_table() -> hashmap { words.insert("fn", ()); words.insert("lambda", ()); words.insert("pure", ()); + words.insert("unsafe", ()); words.insert("iter", ()); words.insert("block", ()); words.insert("import", ()); @@ -2153,6 +2154,10 @@ fn parse_item(p: parser, attrs: [ast::attribute]) -> option::t<@ast::item> { let proto = parse_fn_proto(p); ret some(parse_item_fn_or_iter(p, ast::pure_fn, proto, attrs, ast::il_normal)); + } else if eat_word(p, "unsafe") { + expect_word(p, "fn"); + ret some(parse_item_fn_or_iter(p, ast::unsafe_fn, ast::proto_fn, + attrs, ast::il_normal)); } else if eat_word(p, "iter") { ret some(parse_item_fn_or_iter(p, ast::impure_fn, ast::proto_iter, attrs, ast::il_normal)); -- cgit 1.4.1-3-g733a5