Add a pretty-printer

Adds a -pp option to the compiler which will cause it to simply
pretty-print the given file.
This commit is contained in:
Marijn Haverbeke
2011-03-04 07:22:43 +01:00
committed by Graydon Hoare
parent 8047957b99
commit 0624f9db4a
9 changed files with 1013 additions and 25 deletions

View File

@@ -983,6 +983,7 @@ impure fn parse_prefix_expr(parser p) -> @ast.expr {
type op_spec = rec(token.token tok, ast.binop op, int prec);
// FIXME make this a const, don't store it in parser state
fn prec_table() -> vec[op_spec] {
ret vec(rec(tok=token.BINOP(token.STAR), op=ast.mul, prec=11),
rec(tok=token.BINOP(token.SLASH), op=ast.div, prec=11),