diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/comp/front/ast.rs | 1 | ||||
| -rw-r--r-- | src/comp/front/parser.rs | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs index 3b1a31b8..f90f8df6 100644 --- a/src/comp/front/ast.rs +++ b/src/comp/front/ast.rs @@ -153,6 +153,7 @@ tag ty_ { ty_box(@ty); ty_vec(@ty); ty_tup(vec[@ty]); + ty_rec(vec[tup(ident,@ty)]); ty_fn(vec[rec(mode mode, @ty ty)], @ty); // TODO: effect ty_path(path, option.t[def]); ty_mutable(@ty); diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs index 6b0c2cc8..f0014f6b 100644 --- a/src/comp/front/parser.rs +++ b/src/comp/front/parser.rs @@ -187,6 +187,23 @@ impure fn parse_ty(parser p) -> @ast.ty { t = ast.ty_tup(elems.node); } + case (token.REC) { + p.bump(); + impure fn parse_field(parser p) -> tup(ast.ident, @ast.ty) { + auto ty = parse_ty(p); + auto id = parse_ident(p); + ret tup(id,ty); + } + auto f = parse_field; // FIXME: trans_const_lval bug + auto elems = + parse_seq[tup(ast.ident, @ast.ty)](token.LPAREN, + token.RPAREN, + some(token.COMMA), + f, p); + hi = p.get_span(); + t = ast.ty_rec(elems.node); + } + case (token.MUTABLE) { p.bump(); auto t0 = parse_ty(p); |