Bind pattern slots with ?, drop parens from 0-ary tag constructors, translate 0-ary constructors as constants. Rustc loses ~300kb.

This commit is contained in:
Graydon Hoare 2010-09-20 23:56:43 -07:00
parent acdec30149
commit c5f4789d5b
30 changed files with 499 additions and 445 deletions

View file

@ -64,7 +64,7 @@ state fn expect(parser p, token.token t) {
state fn parse_ident(parser p) -> ast.ident {
alt (p.peek()) {
case (token.IDENT(i)) { ret i; }
case (token.IDENT(?i)) { ret i; }
case (_) {
p.err("expecting ident");
fail;
@ -77,10 +77,10 @@ state fn parse_item(parser p) -> tup(ast.ident, ast.item) {
case (token.FN()) {
p.bump();
auto id = parse_ident(p);
expect(p, token.LPAREN());
expect(p, token.LPAREN);
let vec[rec(ast.slot slot, ast.ident ident)] inputs = vec();
let vec[@ast.stmt] body = vec();
auto output = rec(ty = ast.ty_nil(), mode = ast.val() );
auto output = rec(ty = ast.ty_nil, mode = ast.val );
let ast._fn f = rec(inputs = inputs,
output = output,
body = body);