提交 19d0fa10 编写于 作者: G Graydon Hoare

Improve name nodes to ast, teach to parse qualified names, put out flaming tinderbox.

上级 44e4b2d6
......@@ -8,6 +8,19 @@
type ident = str;
type name = rec(ident ident, vec[ty] types);
type path = vec[name];
type crate_id = int;
type slot_id = int;
type item_id = int;
tag referent {
ref_slot(crate_id, slot_id);
ref_item(crate_id, item_id);
}
type crate = rec(_mod module);
type block = vec[@stmt];
......@@ -62,7 +75,7 @@
expr_binary(binop, @expr, @expr);
expr_unary(unop, @expr);
expr_lit(@lit);
expr_ident(ident);
expr_name(name, option[referent]);
expr_field(@expr, ident);
expr_index(@expr, @expr);
expr_cast(@expr, ty);
......@@ -88,6 +101,7 @@
ty_char;
ty_str;
ty_box(@ty);
ty_path(path, option[referent]);
}
tag mode {
......@@ -106,6 +120,7 @@
tag item {
item_fn(@_fn);
item_mod(@_mod);
item_ty(@ty);
}
......
......@@ -153,7 +153,24 @@ fn get_span() -> common.span {
fail;
}
io fn parse_name(parser p, ast.ident id) -> ast.name {
p.bump();
let vec[ast.ty] tys = vec();
alt (p.peek()) {
case (token.LBRACKET) {
auto pf = parse_ty;
tys = parse_seq[ast.ty](token.LBRACKET,
token.RBRACKET,
some(token.COMMA),
pf, p);
}
case (_) {
}
}
ret rec(ident=id, types=tys);
}
io fn parse_bottom_expr(parser p) -> @ast.expr {
alt (p.peek()) {
......@@ -203,8 +220,7 @@ fn get_span() -> common.span {
}
case (token.IDENT(?i)) {
p.bump();
ret @ast.expr_ident(i);
ret @ast.expr_name(parse_name(p, i), none[ast.referent]);
}
case (_) {
......
......@@ -1006,7 +1006,8 @@ fn FCmp(RealPredicate Op, ValueRef LHS, ValueRef RHS) -> ValueRef {
/* Miscellaneous instructions */
fn Phi(TypeRef Ty, vec[ValueRef] vals, vec[BasicBlockRef] bbs) -> ValueRef {
fn Phi(TypeRef Ty, vec[ValueRef] vals,
vec[BasicBlockRef] bbs) -> ValueRef {
auto phi = llvm.LLVMBuildPhi(B, Ty, _str.buf(""));
check (_vec.len[ValueRef](vals) == _vec.len[BasicBlockRef](bbs));
llvm.LLVMAddIncoming(phi,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册