Permalink
Browse files

rustc: Parse crust functions

  • Loading branch information...
1 parent 6943b38 commit 305cbf9b8ed24a23212cd99fc3eedfcd9b2b40af @brson brson committed Feb 10, 2012
Showing with 9 additions and 1 deletion.
  1. +4 −1 src/comp/syntax/parse/parser.rs
  2. +5 −0 src/test/run-pass/crust-1.rs
View
5 src/comp/syntax/parse/parser.rs
@@ -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
@@ -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") {
View
5 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.