aboutsummaryrefslogtreecommitdiff
path: root/src/boot/fe
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-06-24 10:34:47 -0700
committerGraydon Hoare <[email protected]>2010-06-24 10:34:47 -0700
commit25eb1fd3c9d997e460dff3e03d87e398e616c726 (patch)
treefb8919376fe8a1f180f69bf4704bb71668881aab /src/boot/fe
parentMerge timer loop functions, fix win32 build broken by logger change. (diff)
downloadrust-25eb1fd3c9d997e460dff3e03d87e398e616c726.tar.xz
rust-25eb1fd3c9d997e460dff3e03d87e398e616c726.zip
Add fmt module, move out some common format helpers, add instruction-selection tracing and make selection use queues rather than list refs.
Diffstat (limited to 'src/boot/fe')
-rw-r--r--src/boot/fe/ast.ml26
-rw-r--r--src/boot/fe/pexp.ml2
2 files changed, 2 insertions, 26 deletions
diff --git a/src/boot/fe/ast.ml b/src/boot/fe/ast.ml
index 438d9de9..09037510 100644
--- a/src/boot/fe/ast.ml
+++ b/src/boot/fe/ast.ml
@@ -7,6 +7,7 @@
*)
open Common;;
+open Fmt;;
(*
* Slot names are given by a dot-separated path within the current
@@ -464,8 +465,6 @@ let sane_name (n:name) : bool =
(* FIXME (issue #19): finish all parts with ?foo? as their output. *)
-let fmt = Format.fprintf;;
-
let fmt_ident (ff:Format.formatter) (i:ident) : unit =
fmt ff "%s" i
@@ -700,13 +699,6 @@ and fmt_carg (ff:Format.formatter) (ca:carg) : unit =
CARG_path cp -> fmt_carg_path ff cp
| CARG_lit lit -> fmt_lit ff lit
-and fmt_obox ff = Format.pp_open_box ff 4
-and fmt_obox_3 ff = Format.pp_open_box ff 3
-and fmt_cbox ff = Format.pp_close_box ff ()
-and fmt_obr ff = fmt ff "{"
-and fmt_cbr ff = fmt ff "@\n}"
-and fmt_cbb ff = (fmt_cbox ff; fmt_cbr ff)
-
and fmt_stmts (ff:Format.formatter) (ss:stmt array) : unit =
Array.iter (fmt_stmt ff) ss;
@@ -1316,22 +1308,6 @@ and fmt_crate (ff:Format.formatter) (c:crate) : unit =
fmt_mod_view ff view;
fmt_mod_items ff items
-
-let fmt_to_str (f:Format.formatter -> 'a -> unit) (v:'a) : string =
- let buf = Buffer.create 16 in
- let bf = Format.formatter_of_buffer buf in
- begin
- f bf v;
- Format.pp_print_flush bf ();
- Buffer.contents buf
- end
-
-let sprintf_fmt
- (f:Format.formatter -> 'a -> unit)
- : (unit -> 'a -> string) =
- (fun _ -> fmt_to_str f)
-
-
let sprintf_expr = sprintf_fmt fmt_expr;;
let sprintf_name = sprintf_fmt fmt_name;;
let sprintf_lval = sprintf_fmt fmt_lval;;
diff --git a/src/boot/fe/pexp.ml b/src/boot/fe/pexp.ml
index 49eeeb5b..13d6d2b5 100644
--- a/src/boot/fe/pexp.ml
+++ b/src/boot/fe/pexp.ml
@@ -975,7 +975,7 @@ let expand_pexp_custom
(args:token array)
(body:string option)
: pexp' =
- let nstr = Ast.fmt_to_str Ast.fmt_name name in
+ let nstr = Fmt.fmt_to_str Ast.fmt_name name in
match (nstr, (Array.length args), body) with
("shell", 0, Some cmd) ->