mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
Add support for
native mod foo = "bar" ...
This commit is contained in:
parent
57bb9d809b
commit
8122e0c542
@ -1630,9 +1630,20 @@ impure fn parse_native_mod_items(parser p,
|
||||
impure fn parse_item_native_mod(parser p) -> @ast.item {
|
||||
auto lo = p.get_span();
|
||||
expect(p, token.NATIVE);
|
||||
auto native_name = parse_str_lit(p);
|
||||
auto has_eq;
|
||||
auto native_name = "";
|
||||
if (p.peek() == token.MOD) {
|
||||
has_eq = true;
|
||||
} else {
|
||||
native_name = parse_str_lit(p);
|
||||
has_eq = false;
|
||||
}
|
||||
expect(p, token.MOD);
|
||||
auto id = parse_ident(p);
|
||||
if (has_eq) {
|
||||
expect(p, token.EQ);
|
||||
native_name = parse_str_lit(p);
|
||||
}
|
||||
expect(p, token.LBRACE);
|
||||
auto m = parse_native_mod_items(p, native_name);
|
||||
auto hi = p.get_span();
|
||||
|
@ -3,5 +3,9 @@ native "rust" mod rustrt {
|
||||
fn vec_buf[T](vec[T] v, uint offset) -> vbuf;
|
||||
}
|
||||
|
||||
native mod libc = "libc.dylib" {
|
||||
fn write(int fd, rustrt.vbuf buf, uint count) -> int;
|
||||
}
|
||||
|
||||
fn main(vec[str] args) {
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user