aboutsummaryrefslogtreecommitdiff
path: root/ide/ide_slave.ml
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2016-06-02 18:00:06 +0200
committerPierre-Marie Pédrot2016-06-02 18:00:30 +0200
commit71b64cc5ec5ab0d70d437ec4542c5903f43063cb (patch)
tree440fb8e51d1fe118d866d0c620a86724e3c6eae8 /ide/ide_slave.ml
parent2d2d86c165cac7b051da1c5079d614a76550a20c (diff)
parent318fc2c04df1e73cc8a178d4fc1ce8bf5543649b (diff)
Move XML serialization to ide/ folder.
Diffstat (limited to 'ide/ide_slave.ml')
-rw-r--r--ide/ide_slave.ml21
1 files changed, 13 insertions, 8 deletions
diff --git a/ide/ide_slave.ml b/ide/ide_slave.ml
index 59efc2d821..0e09d84095 100644
--- a/ide/ide_slave.ml
+++ b/ide/ide_slave.ml
@@ -393,6 +393,15 @@ let interp ((_raw, verbose), s) =
let quit = ref false
+(** Serializes the output of Stm.get_ast *)
+let print_ast id =
+ match Stm.get_ast id with
+ | Some (expr, loc) -> begin
+ try Texmacspp.tmpp expr loc
+ with e -> Xml_datatype.PCData ("ERROR " ^ Printexc.to_string e)
+ end
+ | None -> Xml_datatype.PCData "ERROR"
+
(** Grouping all call handlers together + error handling *)
let eval_call xml_oc log c =
@@ -423,7 +432,7 @@ let eval_call xml_oc log c =
Interface.interp = interruptible interp;
Interface.handle_exn = handle_exn;
Interface.stop_worker = Stm.stop_worker;
- Interface.print_ast = Stm.print_ast;
+ Interface.print_ast = print_ast;
Interface.annotate = interruptible annotate;
} in
Xmlprotocol.abstract_eval_call handler c
@@ -444,16 +453,12 @@ let print_xml =
let slave_logger xml_oc level message =
(* convert the message into XML *)
let msg = hov 0 message in
- let message = {
- Feedback.message_level = level;
- Feedback.message_content = (Richpp.repr (Richpp.richpp_of_pp msg));
- } in
- let () = pr_debug (Printf.sprintf "-> %S" (string_of_ppcmds msg)) in
- let xml = Feedback.of_message message in
+ let () = pr_debug (Printf.sprintf "-> %S" (string_of_ppcmds msg)) in
+ let xml = Xmlprotocol.of_message level (Richpp.richpp_of_pp message) in
print_xml xml_oc xml
let slave_feeder xml_oc msg =
- let xml = Feedback.of_feedback msg in
+ let xml = Xmlprotocol.of_feedback msg in
print_xml xml_oc xml
(** The main loop *)