equal
deleted
inserted
replaced
20 (c) special init message holds "pid" and "session" property. |
20 (c) special init message holds "pid" and "session" property. |
21 *) |
21 *) |
22 |
22 |
23 signature ISABELLE_PROCESS = |
23 signature ISABELLE_PROCESS = |
24 sig |
24 sig |
25 val output_markup: Markup.T -> output * output |
25 val yxmlN: string |
26 val full_markupN: string |
26 val full_markupN: string |
27 val test_markupN: string |
27 val test_markupN: string |
28 val isabelle_processN: string |
28 val isabelle_processN: string |
29 val init: unit -> unit |
29 val init: unit -> unit |
30 end; |
30 end; |
32 structure IsabelleProcess: ISABELLE_PROCESS = |
32 structure IsabelleProcess: ISABELLE_PROCESS = |
33 struct |
33 struct |
34 |
34 |
35 (* explicit markup *) |
35 (* explicit markup *) |
36 |
36 |
37 fun output_markup (name, props) = |
37 val yxmlN = "YXML"; |
38 (enclose "<" ">" (space_implode " " (name :: map XML.attribute props)), |
|
39 enclose "</" ">" name); |
|
40 |
|
41 val full_markupN = "full_markup"; |
38 val full_markupN = "full_markup"; |
42 val test_markupN = "test_markup"; |
39 val test_markupN = "test_markup"; |
43 |
40 |
44 val _ = Markup.add_mode test_markupN output_markup; |
41 val _ = Markup.add_mode test_markupN XML.output_markup; |
45 |
42 |
46 |
43 |
47 (* symbol output *) |
44 (* symbol output *) |
48 |
45 |
49 val isabelle_processN = "isabelle_process"; |
46 val isabelle_processN = "isabelle_process"; |
84 |
81 |
85 in |
82 in |
86 |
83 |
87 val _ = Markup.add_mode isabelle_processN (fn (name, props) => |
84 val _ = Markup.add_mode isabelle_processN (fn (name, props) => |
88 if print_mode_active full_markupN orelse name = Markup.positionN |
85 if print_mode_active full_markupN orelse name = Markup.positionN |
89 then output_markup (name, props) else ("", "")); |
86 then XML.output_markup (name, props) else ("", "")); |
90 |
87 |
91 fun message ch txt0 = |
88 fun message ch txt0 = |
92 let |
89 let |
93 val txt1 = XML.element "message" [] [txt0]; |
90 val txt1 = XML.element "message" [] [txt0]; |
94 val (txt, pos) = |
91 val (txt, pos) = |
95 (case try XML.tree_of_string txt1 of |
92 (case try XML.parse txt1 of |
96 NONE => (txt1, Position.none) |
93 NONE => (txt1, Position.none) |
97 | SOME xml => |
94 | SOME xml => |
98 (if print_mode_active full_markupN then XML.header ^ txt1 else XML.plain_content xml, |
95 (if print_mode_active full_markupN then XML.header ^ txt1 else XML.plain_content xml, |
99 the_default Position.none (get_pos xml))) |
96 the_default Position.none (get_pos xml))) |
100 |>> translate_string (fn c => if c = Symbol.STX then Symbol.DEL else c); |
97 |>> translate_string (fn c => if c = Symbol.STX then Symbol.DEL else c); |
128 (* token translations *) |
125 (* token translations *) |
129 |
126 |
130 local |
127 local |
131 |
128 |
132 fun markup kind x = |
129 fun markup kind x = |
133 ((output_markup (kind, []) |-> enclose) (Output.output x), Symbol.length (Symbol.explode x)); |
130 ((XML.output_markup (kind, []) |-> enclose) (Output.output x), Symbol.length (Symbol.explode x)); |
134 |
131 |
135 fun free_or_skolem x = |
132 fun free_or_skolem x = |
136 (case try Name.dest_skolem x of |
133 (case try Name.dest_skolem x of |
137 NONE => markup Markup.freeN x |
134 NONE => markup Markup.freeN x |
138 | SOME x' => markup Markup.skolemN x'); |
135 | SOME x' => markup Markup.skolemN x'); |