aboutsummaryrefslogtreecommitdiff
path: root/src/comp/front/parser.rs
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2011-03-07 11:48:43 -0800
committerGraydon Hoare <[email protected]>2011-03-07 11:48:43 -0800
commit90f299e710c49d689d5bc815e32db375cca00394 (patch)
treed2ee1e9784a2e2a9ff5184d2d1f75327ba315d22 /src/comp/front/parser.rs
parentStage the last compile fix to put out fire. Thanks git. (diff)
downloadrust-90f299e710c49d689d5bc815e32db375cca00394.tar.xz
rust-90f299e710c49d689d5bc815e32db375cca00394.zip
Permit view items in native modules.
Diffstat (limited to 'src/comp/front/parser.rs')
-rw-r--r--src/comp/front/parser.rs22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs
index 8141595b..6f3111c7 100644
--- a/src/comp/front/parser.rs
+++ b/src/comp/front/parser.rs
@@ -1846,8 +1846,11 @@ impure fn parse_native_item(parser p) -> @ast.native_item {
impure fn parse_native_mod_items(parser p,
str native_name,
ast.native_abi abi) -> ast.native_mod {
- auto index = new_str_hash[@ast.native_item]();
+ auto index = new_str_hash[ast.native_mod_index_entry]();
let vec[@ast.native_item] items = vec();
+
+ auto view_items = parse_native_view(p, index);
+
while (p.peek() != token.RBRACE) {
auto item = parse_native_item(p);
items += vec(item);
@@ -1856,7 +1859,9 @@ impure fn parse_native_mod_items(parser p,
ast.index_native_item(index, item);
}
ret rec(native_name=native_name, abi=abi,
- items=items, index=index);
+ view_items=view_items,
+ items=items,
+ index=index);
}
fn default_native_name(session.session sess, str id) -> str {
@@ -2230,6 +2235,19 @@ impure fn parse_view(parser p, ast.mod_index index) -> vec[@ast.view_item] {
ret items;
}
+impure fn parse_native_view(parser p, ast.native_mod_index index)
+ -> vec[@ast.view_item] {
+ let vec[@ast.view_item] items = vec();
+ while (is_view_item(p.peek())) {
+ auto item = parse_view_item(p);
+ items += vec(item);
+
+ ast.index_native_view_item(index, item);
+ }
+ ret items;
+}
+
+
impure fn parse_crate_from_source_file(parser p) -> @ast.crate {
auto lo = p.get_span();
auto hi = lo;