| author | wenzelm |
| Sun, 21 May 2000 14:33:46 +0200 | |
| changeset 8896 | c80aba8c1d5e |
| parent 8886 | 111476895bf2 |
| child 8990 | 19956dd3809e |
| permissions | -rw-r--r-- |
| 6699 | 1 |
(* Title: Pure/Interface/proof_general.ML |
2 |
ID: $Id$ |
|
3 |
Author: Markus Wenzel, TU Muenchen |
|
4 |
||
| 7266 | 5 |
Configuration for Proof General of LFCS Edinburgh. |
| 6699 | 6 |
*) |
7 |
||
8 |
signature PROOF_GENERAL = |
|
9 |
sig |
|
10 |
val setup: (theory -> theory) list |
|
| 7954 | 11 |
val update_thy_only: string -> unit |
12 |
val try_update_thy_only: string -> unit |
|
13 |
val inform_file_processed: string -> unit |
|
14 |
val inform_file_retracted: string -> unit |
|
| 7579 | 15 |
val thms_containing: xstring list -> unit |
| 7193 | 16 |
val help: unit -> unit |
17 |
val show_context: unit -> theory |
|
18 |
val kill_goal: unit -> unit |
|
19 |
val repeat_undo: int -> unit |
|
| 7235 | 20 |
val isa_restart: unit -> unit |
| 6699 | 21 |
val init: bool -> unit |
|
7937
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
22 |
val write_keywords: unit -> unit |
| 6699 | 23 |
end; |
24 |
||
25 |
structure ProofGeneral: PROOF_GENERAL = |
|
26 |
struct |
|
27 |
||
28 |
(** compile-time theory setup **) |
|
29 |
||
30 |
(* token translations *) |
|
31 |
||
32 |
val proof_generalN = "ProofGeneral"; |
|
33 |
||
34 |
local |
|
35 |
||
36 |
val end_tag = oct_char "350"; |
|
37 |
val tclass_tag = oct_char "351"; |
|
38 |
val tfree_tag = oct_char "352"; |
|
39 |
val tvar_tag = oct_char "353"; |
|
40 |
val free_tag = oct_char "354"; |
|
41 |
val bound_tag = oct_char "355"; |
|
42 |
val var_tag = oct_char "356"; |
|
| 7597 | 43 |
val skolem_tag = oct_char "357"; |
| 6699 | 44 |
|
| 8331 | 45 |
fun tagit p x = (p ^ x ^ end_tag, real (Symbol.length (Symbol.explode x))); |
| 6699 | 46 |
|
| 8270 | 47 |
fun unless_skolem tag x = |
| 7597 | 48 |
(case try Syntax.dest_skolem x of |
| 8270 | 49 |
None => tagit tag x |
| 7597 | 50 |
| Some x' => tagit skolem_tag x'); |
51 |
||
| 6699 | 52 |
in |
53 |
||
54 |
val proof_general_trans = |
|
55 |
Syntax.tokentrans_mode proof_generalN |
|
56 |
[("class", tagit tclass_tag),
|
|
57 |
("tfree", tagit tfree_tag),
|
|
58 |
("tvar", tagit tvar_tag),
|
|
| 8270 | 59 |
("free", unless_skolem free_tag),
|
| 6699 | 60 |
("bound", tagit bound_tag),
|
| 8270 | 61 |
("var", unless_skolem var_tag)];
|
| 6699 | 62 |
|
63 |
end; |
|
64 |
||
65 |
||
66 |
(* setup *) |
|
67 |
||
68 |
val setup = [Theory.add_tokentrfuns proof_general_trans]; |
|
69 |
||
70 |
||
71 |
||
| 7193 | 72 |
(** run-time operations **) |
| 6699 | 73 |
|
| 8445 | 74 |
(* symbol output *) |
75 |
||
76 |
fun xsymbols_output s = |
|
77 |
if not (exists_string (equal "\\") s) then (s, real (size s)) |
|
78 |
else |
|
79 |
let val syms = Symbol.explode s |
|
80 |
in (implode (map (fn "\\" => "\\\\" | c => c) syms), real (Symbol.length syms)) end; |
|
81 |
||
82 |
fun setup_xsymbols_output () = Symbol.add_mode "xsymbols" xsymbols_output; |
|
83 |
||
84 |
||
| 6699 | 85 |
(* messages *) |
86 |
||
| 7193 | 87 |
val plain_output = std_output o suffix "\n"; |
| 7195 | 88 |
fun plain_writeln x = Library.setmp writeln_fn plain_output x; |
| 7193 | 89 |
|
90 |
fun decorate_lines bg en "" = plain_output o enclose bg en |
|
91 |
| decorate_lines bg en prfx = plain_output o enclose bg en o prefix_lines prfx; |
|
| 6699 | 92 |
|
93 |
fun setup_messages () = |
|
94 |
(writeln_fn := (decorate_lines (oct_char "360") (oct_char "361") ""); |
|
95 |
warning_fn := (decorate_lines (oct_char "362") (oct_char "363") "### "); |
|
96 |
error_fn := (decorate_lines (oct_char "364") (oct_char "365") "*** ")); |
|
97 |
||
98 |
||
|
7937
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
99 |
(* notification *) |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
100 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
101 |
fun tell_clear_goals () = writeln "Proof General, please clear the goals buffer."; |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
102 |
fun tell_clear_response () = writeln "Proof General, please clear the response buffer."; |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
103 |
fun tell_file msg path = writeln ("Proof General, " ^ msg ^ " " ^ quote (File.sysify_path path));
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
104 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
105 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
106 |
(* theory / proof state output *) |
| 6699 | 107 |
|
| 7193 | 108 |
fun print_current_goals n max th = plain_writeln (Goals.print_current_goals_default n max) th; |
109 |
||
| 7939 | 110 |
fun setup_state () = |
111 |
(current_goals_markers := |
|
| 6699 | 112 |
let |
113 |
val begin_state = oct_char "366"; |
|
114 |
val end_state= oct_char "367"; |
|
|
8495
4f5a3272c8ba
no begin_goal marker (interferes with "latex" etc. output; useless anyway?)
wenzelm
parents:
8452
diff
changeset
|
115 |
in (begin_state, end_state, "") end; |
| 8886 | 116 |
Toplevel.print_state_fn := (fn x => fn y => |
117 |
plain_writeln (fn () => Toplevel.print_state_default x y) ()); |
|
| 7939 | 118 |
Toplevel.prompt_state_fn := (suffix (oct_char "372") o Toplevel.prompt_state_default); |
119 |
Goals.print_current_goals_fn := print_current_goals); |
|
| 6699 | 120 |
|
121 |
||
| 7100 | 122 |
(* theory loader actions *) |
123 |
||
124 |
local |
|
125 |
||
|
7937
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
126 |
fun add_master_files name files = |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
127 |
let val masters = [ThyLoad.thy_path name, ThyLoad.ml_path name] |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
128 |
in masters @ gen_rems (op = o pairself Path.base) (files, masters) end; |
| 7100 | 129 |
|
| 7893 | 130 |
fun trace_action action name = |
|
7937
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
131 |
if action = ThyInfo.Update then |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
132 |
seq (tell_file "this file is loaded:") (ThyInfo.loaded_files name) |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
133 |
else if action = ThyInfo.Outdate orelse action = ThyInfo.Remove then |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
134 |
seq (tell_file "you can unlock the file") (add_master_files name (ThyInfo.loaded_files name)) |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
135 |
else (); |
| 7193 | 136 |
|
| 7100 | 137 |
in |
| 7893 | 138 |
fun setup_thy_loader () = ThyInfo.add_hook trace_action; |
| 7100 | 139 |
end; |
140 |
||
141 |
||
| 7954 | 142 |
(* prepare theory context *) |
|
7937
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
143 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
144 |
val thy_name = Path.pack o Path.drop_ext o Path.base o Path.unpack; |
| 7954 | 145 |
val update_thy_only = ThyInfo.update_thy_only; |
146 |
||
147 |
fun which_context () = |
|
148 |
(case Context.get_context () of |
|
149 |
Some thy => " Using current (dynamic!) one: " ^ |
|
| 7956 | 150 |
(case try PureThy.get_name thy of Some name => quote name | None => "<unnamed>") |
| 7954 | 151 |
| None => ""); |
152 |
||
153 |
fun try_update_thy_only file = |
|
154 |
ThyLoad.cond_with_path (Path.dir (Path.unpack file)) (fn () => |
|
155 |
let val name = thy_name file in |
|
156 |
if is_some (ThyLoad.check_file (ThyLoad.thy_path name)) then update_thy_only name |
|
157 |
else warning ("Unkown theory context of ML file." ^ which_context ())
|
|
158 |
end) (); |
|
159 |
||
160 |
||
161 |
(* get informed about files *) |
|
|
7937
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
162 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
163 |
(* FIXME improve, e.g. do something like pretend_use_thy *) |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
164 |
fun inform_file_processed file = |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
165 |
ThyInfo.if_known_thy ThyInfo.touch_child_thys (thy_name file); |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
166 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
167 |
fun inform_file_retracted file = |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
168 |
ThyInfo.if_known_thy ThyInfo.touch_child_thys (thy_name file); |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
169 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
170 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
171 |
(* misc commands for ProofGeneral/isa *) |
| 7193 | 172 |
|
| 7610 | 173 |
fun thms_containing cs = ThmDatabase.print_thms_containing (the_context ()) cs; |
| 7579 | 174 |
|
| 7193 | 175 |
val help = writeln o Session.welcome; |
176 |
val show_context = Context.the_context; |
|
177 |
||
|
7937
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
178 |
fun kill_goal () = (Goals.reset_goals (); tell_clear_goals ()); |
| 7193 | 179 |
|
| 7922 | 180 |
fun no_print_goals f = setmp print_current_goals_fn (fn _ => fn _ => fn _ => ()) f; |
181 |
||
| 7193 | 182 |
fun repeat_undo 0 = () |
| 7922 | 183 |
| repeat_undo 1 = undo () |
184 |
| repeat_undo n = (no_print_goals undo (); repeat_undo (n - 1)); |
|
| 7193 | 185 |
|
|
7937
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
186 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
187 |
(* re-init process (an approximation) *) |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
188 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
189 |
local |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
190 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
191 |
fun restart isar = |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
192 |
(ThyInfo.touch_all_thys (); |
| 7939 | 193 |
if isar then tell_clear_goals () else kill_goal (); |
|
7937
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
194 |
tell_clear_response (); |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
195 |
writeln (Session.welcome ())); |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
196 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
197 |
in |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
198 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
199 |
fun isa_restart () = restart false; |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
200 |
fun isar_restart () = (restart true; raise Toplevel.RESTART); |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
201 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
202 |
end; |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
203 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
204 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
205 |
(* outer syntax *) |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
206 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
207 |
local structure P = OuterParse and K = OuterSyntax.Keyword in |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
208 |
|
| 8647 | 209 |
val old_undoP = (* FIXME same name for compatibility with PG/Isabelle99 *) |
| 8452 | 210 |
OuterSyntax.improper_command "undo" "undo last command (no output)" K.control |
211 |
(Scan.succeed IsarCmd.undo); |
|
212 |
||
| 8647 | 213 |
val undoP = |
214 |
OuterSyntax.improper_command "ProofGeneral.undo" "undo last command (no output)" K.control |
|
215 |
(Scan.succeed IsarCmd.undo); |
|
216 |
||
| 7954 | 217 |
val context_thy_onlyP = |
218 |
OuterSyntax.improper_command "ProofGeneral.context_thy_only" "(internal)" K.control |
|
219 |
(P.name >> IsarThy.init_context update_thy_only); |
|
220 |
||
221 |
val try_context_thy_onlyP = |
|
222 |
OuterSyntax.improper_command "ProofGeneral.try_context_thy_only" "(internal)" K.control |
|
| 7960 | 223 |
(P.name >> (Toplevel.imperative (K ()) oo IsarThy.init_context try_update_thy_only)); |
| 7954 | 224 |
|
|
7937
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
225 |
val restartP = |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
226 |
OuterSyntax.improper_command "ProofGeneral.restart" "(internal)" K.control |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
227 |
(P.opt_unit >> K (Toplevel.imperative isar_restart)); |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
228 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
229 |
val kill_proofP = |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
230 |
OuterSyntax.improper_command "ProofGeneral.kill_proof" "(internal)" K.control |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
231 |
(Scan.succeed (IsarCmd.kill_proof_notify tell_clear_goals)); |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
232 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
233 |
val inform_file_processedP = |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
234 |
OuterSyntax.improper_command "ProofGeneral.inform_file_processed" "(internal)" K.control |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
235 |
(P.name >> (fn name => Toplevel.imperative (fn () => inform_file_processed name))); |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
236 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
237 |
val inform_file_retractedP = |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
238 |
OuterSyntax.improper_command "ProofGeneral.inform_file_retracted" "(internal)" K.control |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
239 |
(P.name >> (fn name => Toplevel.imperative (fn () => inform_file_retracted name))); |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
240 |
|
| 7954 | 241 |
fun init_outer_syntax () = OuterSyntax.add_parsers |
| 8647 | 242 |
[old_undoP, undoP, restartP, kill_proofP, context_thy_onlyP, try_context_thy_onlyP, |
| 7954 | 243 |
inform_file_processedP, inform_file_retractedP]; |
|
7937
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
244 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
245 |
end; |
| 7193 | 246 |
|
247 |
||
| 6699 | 248 |
(* init *) |
249 |
||
250 |
fun init isar = |
|
| 8668 | 251 |
(if isar then setmp warning_fn (K ()) init_outer_syntax () else (); |
| 8452 | 252 |
setup_xsymbols_output (); |
| 8445 | 253 |
setup_messages (); |
| 7939 | 254 |
setup_state (); |
| 7893 | 255 |
setup_thy_loader (); |
| 7330 | 256 |
print_mode := [proof_generalN]; |
| 6699 | 257 |
set quick_and_dirty; |
| 7939 | 258 |
ml_prompts ("> " ^ oct_char "372") ("- " ^ oct_char "373");
|
| 7193 | 259 |
if isar then Isar.sync_main () else isa_restart ()); |
| 6699 | 260 |
|
261 |
||
|
7937
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
262 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
263 |
(** generate keyword classification file **) |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
264 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
265 |
local |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
266 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
267 |
val regexp_meta = explode ".*+?[]^$"; |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
268 |
val regexp_quote = implode o map (fn c => if c mem regexp_meta then "\\\\" ^ c else c) o explode; |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
269 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
270 |
fun defconst name strs = |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
271 |
"\n(defconst isar-keywords-" ^ name ^ |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
272 |
"\n '(" ^ space_implode "\n " (map (quote o regexp_quote) strs) ^ "))\n";
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
273 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
274 |
fun make_elisp_commands commands kind = |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
275 |
defconst kind (mapfilter (fn (c, _, k, _) => if k = kind then Some c else None) commands); |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
276 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
277 |
fun make_elisp_syntax (keywords, commands) = |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
278 |
";;\n\ |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
279 |
\;; Keyword classification tables for Isabelle/Isar.\n\ |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
280 |
\;; This file generated by Isabelle -- DO NOT EDIT!\n\ |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
281 |
\;;\n\ |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
282 |
\;; $" ^ "Id$\n\ |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
283 |
\;;\n" ^ |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
284 |
defconst "minor" (filter Syntax.is_identifier keywords) ^ |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
285 |
implode (map (make_elisp_commands commands) OuterSyntax.Keyword.kinds) ^ |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
286 |
"\n(provide 'isar-keywords)\n"; |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
287 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
288 |
val keywords_file = "isar-keywords.el"; |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
289 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
290 |
in |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
291 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
292 |
fun write_keywords () = |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
293 |
(init_outer_syntax (); |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
294 |
File.write (Path.unpack keywords_file) |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
295 |
(make_elisp_syntax (OuterSyntax.dest_keywords (), OuterSyntax.dest_parsers ()))); |
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
296 |
|
| 6699 | 297 |
end; |
|
7937
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
298 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
299 |
|
|
82025fe607d3
added inform_file_processed, inform_file_retracted;
wenzelm
parents:
7922
diff
changeset
|
300 |
end; |