aboutsummaryrefslogtreecommitdiff
path: root/src/comp/front/ast.rs
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-10-04 17:25:52 -0700
committerGraydon Hoare <[email protected]>2010-10-04 17:25:52 -0700
commit19d0fa107aeb79e7d2e1e4222fad4be8addf679d (patch)
tree6fee0ba2f8b477af142a2ca5a0d228e29ef56573 /src/comp/front/ast.rs
parentTeach rustc about phi nodes, block relationships. Translate if- and block-exp... (diff)
downloadrust-19d0fa107aeb79e7d2e1e4222fad4be8addf679d.tar.xz
rust-19d0fa107aeb79e7d2e1e4222fad4be8addf679d.zip
Improve name nodes to ast, teach to parse qualified names, put out flaming tinderbox.
Diffstat (limited to 'src/comp/front/ast.rs')
-rw-r--r--src/comp/front/ast.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs
index 48ba9187..e115087e 100644
--- a/src/comp/front/ast.rs
+++ b/src/comp/front/ast.rs
@@ -8,6 +8,19 @@ import util.common.none;
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 @@ tag expr {
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 @@ tag ty {
ty_char;
ty_str;
ty_box(@ty);
+ ty_path(path, option[referent]);
}
tag mode {
@@ -106,6 +120,7 @@ type _mod = hashmap[ident,item];
tag item {
item_fn(@_fn);
item_mod(@_mod);
+ item_ty(@ty);
}