diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2011-10-06 15:29:54 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-10-12 14:26:47 -0700 |
| commit | 58b8e88356187b8631f24fa787c0dfefcb6a1970 (patch) | |
| tree | c836a3c308a1495a22a834ede10a4ba0cc006dfc /src/comp/syntax/parse | |
| parent | 9476692b525024ab81dfc7104f63c85af68d6eb6 (diff) | |
| download | rust-58b8e88356187b8631f24fa787c0dfefcb6a1970.tar.gz rust-58b8e88356187b8631f24fa787c0dfefcb6a1970.zip | |
expand purity to include unsafe
Diffstat (limited to 'src/comp/syntax/parse')
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 5 |
1 files changed, 5 insertions, 0 deletions
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<str, ()> { 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)); |
