diff --git a/src/comp/front/pretty.rs b/src/comp/front/pretty.rs deleted file mode 100644 index 2fd58126cee9f..0000000000000 --- a/src/comp/front/pretty.rs +++ /dev/null @@ -1,87 +0,0 @@ -import std._int; -import std._str; -import std._uint; -import std._vec; - -export print_expr; - -// FIXME this is superseded by ../pretty/pprust.rs. can it be dropped? - -fn unknown() -> str { - ret ""; -} - -fn print_expr(@ast.expr expr) -> str { - alt (expr.node) { - case (ast.expr_lit(?lit, _)) { - ret print_lit(lit); - } - case (ast.expr_binary(?op, ?lhs, ?rhs, _)) { - ret print_expr_binary(op, lhs, rhs); - } - case (ast.expr_call(?path, ?args, _)) { - ret print_expr_call(path, args); - } - case (ast.expr_path(?path, _, _)) { - ret print_path(path); - } - case (_) { - ret unknown(); - } - } -} - -fn print_lit(@ast.lit lit) -> str { - alt (lit.node) { - case (ast.lit_str(?s)) { - ret "\"" + s + "\""; - } - case (ast.lit_int(?i)) { - ret _int.to_str(i, 10u); - } - case (ast.lit_uint(?u)) { - ret _uint.to_str(u, 10u); - } - case (_) { - ret unknown(); - } - } -} - -fn print_expr_binary(ast.binop op, @ast.expr lhs, @ast.expr rhs) -> str { - alt (op) { - case (ast.add) { - auto l = print_expr(lhs); - auto r = print_expr(rhs); - ret l + " + " + r; - } - } -} - -fn print_expr_call(@ast.expr path_expr, vec[@ast.expr] args) -> str { - auto s = print_expr(path_expr); - - s += "("; - fn print_expr_ref(&@ast.expr e) -> str { ret print_expr(e); } - auto mapfn = print_expr_ref; - auto argstrs = _vec.map[@ast.expr, str](mapfn, args); - s += _str.connect(argstrs, ", "); - s += ")"; - - ret s; -} - -fn print_path(ast.path path) -> str { - ret _str.connect(path.node.idents, "."); -} - -// -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// compile-command: "make -k -C ../.. 2>&1 | sed -e 's/\\/x\\//x:\\//g'"; -// End: -// diff --git a/src/comp/pretty/pprust.rs b/src/comp/pretty/pprust.rs index d10f5e7cdaa23..c54786fd5cfea 100644 --- a/src/comp/pretty/pprust.rs +++ b/src/comp/pretty/pprust.rs @@ -384,6 +384,7 @@ impure fn print_expr(ps s, @ast.expr expr) { wrd1(s, "else"); print_block(s, blk); } + case (_) { /* fall through */ } } } case (ast.expr_while(?test,?block,_)) { @@ -511,8 +512,17 @@ impure fn print_expr(ps s, @ast.expr expr) { wrd1(s, "check"); print_expr(s, expr); } + case (ast.expr_ext(?path, ?args, ?body, _, _)) { + wrd(s, "#"); + print_path(s, path); + if (_vec.len[@ast.expr](args) > 0u) { + popen(s); + commasep[@ast.expr](s, args, pe); + pclose(s); + } + // TODO: extension 'body' + } case (_) {wrd(s, "X");} - // TODO expr_ext(path, vec[@expr], option.t[@expr], @expr, ann); } end(s); } diff --git a/src/comp/rustc.rc b/src/comp/rustc.rc index e483340949ee4..7e1d8fd9152af 100644 --- a/src/comp/rustc.rc +++ b/src/comp/rustc.rc @@ -8,7 +8,6 @@ mod front { mod extfmt; mod lexer; mod parser; - mod pretty; mod token; mod eval; }