Skip to content

Commit

Permalink
rustc: Parse crust functions
Browse files Browse the repository at this point in the history
  • Loading branch information
brson committed Feb 14, 2012
1 parent 6943b38 commit 305cbf9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/comp/syntax/parse/parser.rs
Expand Up @@ -150,7 +150,7 @@ fn bad_expr_word_table() -> hashmap<str, ()> {
"export", "fail", "fn", "for", "if", "iface", "impl",
"import", "let", "log", "mod", "mutable", "native", "pure",
"resource", "ret", "trait", "type", "unchecked", "unsafe",
"while"] {
"while, crust"] {
words.insert(word, ());
}
words
Expand Down Expand Up @@ -2276,6 +2276,9 @@ fn parse_item(p: parser, attrs: [ast::attribute]) -> option<@ast::item> {
p.bump();
expect_word(p, "fn");
ret some(parse_item_fn(p, ast::unsafe_fn, attrs));
} else if eat_word(p, "crust") {
expect_word(p, "fn");
ret some(parse_item_fn(p, ast::crust_fn, attrs));
} else if eat_word(p, "mod") {
ret some(parse_item_mod(p, attrs));
} else if eat_word(p, "native") {
Expand Down
5 changes: 5 additions & 0 deletions src/test/run-pass/crust-1.rs
@@ -0,0 +1,5 @@
crust fn f() {
}

fn main() {
}

0 comments on commit 305cbf9

Please sign in to comment.