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

This commit is contained in:
Graydon Hoare 2010-10-04 17:25:52 -07:00
parent 44e4b2d63a
commit 19d0fa107a
3 changed files with 36 additions and 4 deletions

View file

@ -153,7 +153,24 @@ io fn parse_lit(parser p) -> @ast.lit {
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 @@ io fn parse_bottom_expr(parser p) -> @ast.expr {
}
case (token.IDENT(?i)) {
p.bump();
ret @ast.expr_ident(i);
ret @ast.expr_name(parse_name(p, i), none[ast.referent]);
}
case (_) {