author | haftmann |
Tue, 06 Nov 2007 13:12:56 +0100 | |
changeset 25313 | 98a145c9a22f |
parent 24916 | dc56dd1b3cda |
child 25337 | 93da87a1d2b3 |
permissions | -rw-r--r-- |
24219 | 1 |
(* Title: Tools/code/code_name.ML |
2 |
ID: $Id$ |
|
3 |
Author: Florian Haftmann, TU Muenchen |
|
4 |
||
5 |
Naming policies for code generation: prefixing any name by corresponding |
|
6 |
theory name, conversion to alphanumeric representation. |
|
25313 | 7 |
Mappings are incrementally cached. Assumes non-concurrent processing |
8 |
inside a single theory. |
|
24219 | 9 |
*) |
10 |
||
11 |
signature CODE_NAME = |
|
12 |
sig |
|
13 |
val purify_var: string -> string |
|
14 |
val purify_tvar: string -> string |
|
15 |
val check_modulename: string -> string |
|
16 |
type var_ctxt; |
|
17 |
val make_vars: string list -> var_ctxt; |
|
18 |
val intro_vars: string list -> var_ctxt -> var_ctxt; |
|
19 |
val lookup_var: var_ctxt -> string -> string; |
|
20 |
||
21 |
val class: theory -> class -> class |
|
22 |
val class_rev: theory -> class -> class option |
|
23 |
val classrel: theory -> class * class -> string |
|
24 |
val classrel_rev: theory -> string -> (class * class) option |
|
24423
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
25 |
val tyco: theory -> string -> string |
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
26 |
val tyco_rev: theory -> string -> string option |
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
27 |
val instance: theory -> class * string -> string |
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
28 |
val instance_rev: theory -> string -> (class * string) option |
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
29 |
val const: theory -> string -> string |
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
30 |
val const_rev: theory -> string -> string option |
24916 | 31 |
val value_name: string |
24219 | 32 |
val labelled_name: theory -> string -> string |
33 |
||
34 |
val setup: theory -> theory |
|
35 |
end; |
|
36 |
||
37 |
structure CodeName: CODE_NAME = |
|
38 |
struct |
|
39 |
||
40 |
(** purification **) |
|
41 |
||
42 |
fun purify_name upper_else_lower = |
|
43 |
let |
|
44 |
fun is_valid s = Symbol.is_ascii_letter s orelse Symbol.is_ascii_digit s orelse s = "'"; |
|
45 |
val is_junk = not o is_valid andf Symbol.is_regular; |
|
46 |
val junk = Scan.many is_junk; |
|
47 |
val scan_valids = Symbol.scanner "Malformed input" |
|
48 |
((junk |-- |
|
49 |
(Scan.optional (Scan.one Symbol.is_ascii_letter) "x" ^^ (Scan.many is_valid >> implode) |
|
50 |
--| junk)) |
|
51 |
-- Scan.repeat ((Scan.many1 is_valid >> implode) --| junk) >> op ::); |
|
52 |
fun upper_lower cs = if upper_else_lower then nth_map 0 Symbol.to_ascii_upper cs |
|
53 |
else (if forall Symbol.is_ascii_upper cs |
|
54 |
then map else nth_map 0) Symbol.to_ascii_lower cs; |
|
55 |
in |
|
56 |
explode |
|
57 |
#> scan_valids |
|
58 |
#> space_implode "_" |
|
59 |
#> explode |
|
60 |
#> upper_lower |
|
61 |
#> implode |
|
62 |
end; |
|
63 |
||
64 |
fun purify_var "" = "x" |
|
65 |
| purify_var v = purify_name false v; |
|
66 |
||
67 |
fun purify_tvar "" = "'a" |
|
68 |
| purify_tvar v = |
|
69 |
(unprefix "'" #> explode #> filter Symbol.is_ascii_letter #> cons "'" #> implode) v; |
|
70 |
||
71 |
fun check_modulename mn = |
|
72 |
let |
|
73 |
val mns = NameSpace.explode mn; |
|
74 |
val mns' = map (purify_name true) mns; |
|
75 |
in |
|
76 |
if mns' = mns then mn else error ("Invalid module name: " ^ quote mn ^ "\n" |
|
77 |
^ "perhaps try " ^ quote (NameSpace.implode mns')) |
|
78 |
end; |
|
79 |
||
80 |
||
81 |
(** variable name contexts **) |
|
82 |
||
83 |
type var_ctxt = string Symtab.table * Name.context; |
|
84 |
||
85 |
fun make_vars names = (fold (fn name => Symtab.update_new (name, name)) names Symtab.empty, |
|
86 |
Name.make_context names); |
|
87 |
||
88 |
fun intro_vars names (namemap, namectxt) = |
|
89 |
let |
|
90 |
val (names', namectxt') = Name.variants names namectxt; |
|
91 |
val namemap' = fold2 (curry Symtab.update) names names' namemap; |
|
92 |
in (namemap', namectxt') end; |
|
93 |
||
94 |
fun lookup_var (namemap, _) name = case Symtab.lookup namemap name |
|
95 |
of SOME name' => name' |
|
96 |
| NONE => error ("Invalid name in context: " ^ quote name); |
|
97 |
||
98 |
||
99 |
||
100 |
(** global names (identifiers) **) |
|
101 |
||
102 |
(* identifier categories *) |
|
103 |
||
24811 | 104 |
val suffix_class = "class"; |
24840 | 105 |
val suffix_classrel = "classrel" |
24811 | 106 |
val suffix_tyco = "tyco"; |
107 |
val suffix_instance = "inst"; |
|
108 |
val suffix_const = "const"; |
|
24219 | 109 |
|
110 |
fun string_of_classrel (class, superclass) = class ^ " < " ^ superclass; |
|
111 |
fun string_of_instance (class, tyco) = tyco ^ " :: " ^ class; |
|
112 |
||
24811 | 113 |
fun add_suffix nsp name = |
24219 | 114 |
NameSpace.append name nsp; |
115 |
||
24811 | 116 |
fun dest_suffix nsp name = |
24219 | 117 |
if NameSpace.base name = nsp |
118 |
then SOME (NameSpace.qualifier name) |
|
119 |
else NONE; |
|
120 |
||
121 |
local |
|
122 |
||
123 |
val name_mapping = [ |
|
24811 | 124 |
(suffix_class, "class"), |
125 |
(suffix_classrel, "subclass relation"), |
|
126 |
(suffix_tyco, "type constructor"), |
|
127 |
(suffix_instance, "instance"), |
|
128 |
(suffix_const, "constant") |
|
24219 | 129 |
] |
130 |
||
131 |
in |
|
132 |
||
133 |
val category_of = the o AList.lookup (op =) name_mapping o NameSpace.base; |
|
134 |
||
135 |
end; |
|
136 |
||
137 |
||
138 |
(* theory name lookup *) |
|
139 |
||
140 |
fun thyname_of thy f errmsg x = |
|
141 |
let |
|
142 |
fun thy_of thy = |
|
143 |
if f thy x then case get_first thy_of (Theory.parents_of thy) |
|
144 |
of NONE => SOME thy |
|
145 |
| thy => thy |
|
146 |
else NONE; |
|
147 |
in case thy_of thy |
|
148 |
of SOME thy => Context.theory_name thy |
|
149 |
| NONE => error (errmsg x) end; |
|
150 |
||
151 |
fun thyname_of_class thy = |
|
152 |
thyname_of thy (fn thy => member (op =) (Sign.all_classes thy)) |
|
153 |
(fn class => "thyname_of_class: no such class: " ^ quote class); |
|
154 |
||
155 |
fun thyname_of_tyco thy = |
|
156 |
thyname_of thy Sign.declared_tyname |
|
157 |
(fn tyco => "thyname_of_tyco: no such type constructor: " ^ quote tyco); |
|
158 |
||
159 |
fun thyname_of_instance thy = |
|
160 |
let |
|
161 |
fun test_instance thy (class, tyco) = |
|
162 |
can (Sorts.mg_domain (Sign.classes_of thy) tyco) [class] |
|
163 |
in thyname_of thy test_instance |
|
164 |
(fn (class, tyco) => "thyname_of_instance: no such instance: " |
|
165 |
^ (quote o string_of_instance) (class, tyco)) |
|
166 |
end; |
|
167 |
||
168 |
fun thyname_of_const thy = |
|
169 |
thyname_of thy Sign.declared_const |
|
170 |
(fn c => "thyname_of_const: no such constant: " ^ quote c); |
|
171 |
||
172 |
||
173 |
(* naming policies *) |
|
174 |
||
175 |
val purify_prefix = |
|
176 |
explode |
|
177 |
(*should disappear as soon as hierarchical theory name spaces are available*) |
|
178 |
#> Symbol.scanner "Malformed name" |
|
179 |
(Scan.repeat ($$ "_" |-- $$ "_" >> (fn _ => ".") || Scan.one Symbol.is_regular)) |
|
180 |
#> implode |
|
181 |
#> NameSpace.explode |
|
182 |
#> map (purify_name true); |
|
183 |
||
24423
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
184 |
fun purify_base "op &" = "and" |
24219 | 185 |
| purify_base "op |" = "or" |
186 |
| purify_base "op -->" = "implies" |
|
187 |
| purify_base "{}" = "empty" |
|
188 |
| purify_base "op :" = "member" |
|
189 |
| purify_base "op Int" = "intersect" |
|
190 |
| purify_base "op Un" = "union" |
|
191 |
| purify_base "*" = "product" |
|
192 |
| purify_base "+" = "sum" |
|
24423
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
193 |
| purify_base s = if String.isPrefix "op =" s |
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
194 |
then "eq" ^ purify_name false s |
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
195 |
else purify_name false s; |
24219 | 196 |
|
197 |
fun default_policy thy get_basename get_thyname name = |
|
198 |
let |
|
199 |
val prefix = (purify_prefix o get_thyname thy) name; |
|
200 |
val base = (purify_base o get_basename) name; |
|
201 |
in NameSpace.implode (prefix @ [base]) end; |
|
202 |
||
203 |
fun class_policy thy = default_policy thy NameSpace.base thyname_of_class; |
|
204 |
fun classrel_policy thy = default_policy thy (fn (class1, class2) => |
|
24811 | 205 |
NameSpace.base class2 ^ "_" ^ NameSpace.base class1) (fn thy => thyname_of_class thy o fst); |
24219 | 206 |
(*order fits nicely with composed projections*) |
207 |
fun tyco_policy thy = default_policy thy NameSpace.base thyname_of_tyco; |
|
208 |
fun instance_policy thy = default_policy thy (fn (class, tyco) => |
|
209 |
NameSpace.base class ^ "_" ^ NameSpace.base tyco) thyname_of_instance; |
|
210 |
||
24423
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
211 |
fun force_thyname thy c = case Code.get_datatype_of_constr thy c |
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
212 |
of SOME dtco => SOME (thyname_of_tyco thy dtco) |
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
213 |
| NONE => (case AxClass.class_of_param thy c |
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
214 |
of SOME class => SOME (thyname_of_class thy class) |
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
215 |
| NONE => (case Class.param_const thy c |
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
216 |
of SOME (c, tyco) => SOME (thyname_of_instance thy |
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
217 |
((the o AxClass.class_of_param thy) c, tyco)) |
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
218 |
| NONE => NONE)); |
24219 | 219 |
|
24423
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
220 |
fun const_policy thy c = |
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
221 |
case force_thyname thy c |
24219 | 222 |
of NONE => default_policy thy NameSpace.base thyname_of_const c |
223 |
| SOME thyname => let |
|
224 |
val prefix = purify_prefix thyname; |
|
24423
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
225 |
val base = (purify_base o NameSpace.base) c; |
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
226 |
in NameSpace.implode (prefix @ [base]) end; |
24219 | 227 |
|
228 |
||
229 |
(* theory and code data *) |
|
230 |
||
231 |
type tyco = string; |
|
232 |
type const = string; |
|
233 |
||
234 |
structure StringPairTab = |
|
235 |
TableFun( |
|
236 |
type key = string * string; |
|
237 |
val ord = prod_ord fast_string_ord fast_string_ord; |
|
238 |
); |
|
239 |
||
240 |
datatype names = Names of { |
|
241 |
class: class Symtab.table * class Symtab.table, |
|
242 |
classrel: string StringPairTab.table * (class * class) Symtab.table, |
|
243 |
tyco: tyco Symtab.table * tyco Symtab.table, |
|
244 |
instance: string StringPairTab.table * (class * tyco) Symtab.table |
|
245 |
} |
|
246 |
||
247 |
val empty_names = Names { |
|
248 |
class = (Symtab.empty, Symtab.empty), |
|
249 |
classrel = (StringPairTab.empty, Symtab.empty), |
|
250 |
tyco = (Symtab.empty, Symtab.empty), |
|
251 |
instance = (StringPairTab.empty, Symtab.empty) |
|
252 |
}; |
|
253 |
||
254 |
local |
|
255 |
fun mk_names (class, classrel, tyco, instance) = |
|
256 |
Names { class = class, classrel = classrel, tyco = tyco, instance = instance }; |
|
257 |
fun map_names f (Names { class, classrel, tyco, instance }) = |
|
258 |
mk_names (f (class, classrel, tyco, instance)); |
|
259 |
in |
|
260 |
fun merge_names (Names { class = (class1, classrev1), |
|
261 |
classrel = (classrel1, classrelrev1), tyco = (tyco1, tycorev1), |
|
262 |
instance = (instance1, instancerev1) }, |
|
263 |
Names { class = (class2, classrev2), |
|
264 |
classrel = (classrel2, classrelrev2), tyco = (tyco2, tycorev2), |
|
265 |
instance = (instance2, instancerev2) }) = |
|
266 |
mk_names ((Symtab.merge (op =) (class1, class2), Symtab.merge (op =) (classrev1, classrev2)), |
|
267 |
(StringPairTab.merge (op =) (classrel1, classrel2), Symtab.merge (op =) (classrelrev1, classrelrev2)), |
|
268 |
(Symtab.merge (op =) (tyco1, tyco2), Symtab.merge (op =) (tycorev1, tycorev2)), |
|
269 |
(StringPairTab.merge (op =) (instance1, instance2), Symtab.merge (op =) (instancerev1, instancerev2))); |
|
270 |
fun map_class f = map_names |
|
271 |
(fn (class, classrel, tyco, inst) => (f class, classrel, tyco, inst)); |
|
272 |
fun map_classrel f = map_names |
|
273 |
(fn (class, classrel, tyco, inst) => (class, f classrel, tyco, inst)); |
|
274 |
fun map_tyco f = map_names |
|
275 |
(fn (class, classrel, tyco, inst) => (class, classrel, f tyco, inst)); |
|
276 |
fun map_instance f = map_names |
|
277 |
(fn (class, classrel, tyco, inst) => (class, classrel, tyco, f inst)); |
|
278 |
end; (*local*) |
|
279 |
||
280 |
structure CodeName = TheoryDataFun |
|
281 |
( |
|
282 |
type T = names ref; |
|
283 |
val empty = ref empty_names; |
|
284 |
fun copy (ref names) = ref names; |
|
285 |
val extend = copy; |
|
286 |
fun merge _ (ref names1, ref names2) = ref (merge_names (names1, names2)); |
|
287 |
); |
|
288 |
||
289 |
structure ConstName = CodeDataFun |
|
290 |
( |
|
24423
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
291 |
type T = const Symtab.table * string Symtab.table; |
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
292 |
val empty = (Symtab.empty, Symtab.empty); |
24219 | 293 |
fun merge _ ((const1, constrev1), (const2, constrev2)) : T = |
24423
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
294 |
(Symtab.merge (op =) (const1, const2), |
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
295 |
Symtab.merge (op =) (constrev1, constrev2)); |
24219 | 296 |
fun purge _ NONE _ = empty |
24423
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
297 |
| purge _ (SOME cs) (const, constrev) = (fold Symtab.delete_safe cs const, |
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
298 |
fold Symtab.delete_safe (map_filter (Symtab.lookup const) cs) constrev); |
24219 | 299 |
); |
300 |
||
301 |
val setup = CodeName.init; |
|
302 |
||
303 |
||
304 |
(* forward lookup with cache update *) |
|
305 |
||
306 |
fun get thy get_tabs get upd_names upd policy x = |
|
307 |
let |
|
308 |
val names_ref = CodeName.get thy; |
|
309 |
val (Names names) = ! names_ref; |
|
310 |
val tabs = get_tabs names; |
|
311 |
fun declare name = |
|
312 |
let |
|
313 |
val names' = upd_names (K (upd (x, name) (fst tabs), |
|
314 |
Symtab.update_new (name, x) (snd tabs))) (Names names) |
|
315 |
in (names_ref := names'; name) end; |
|
316 |
in case get (fst tabs) x |
|
317 |
of SOME name => name |
|
318 |
| NONE => |
|
319 |
x |
|
320 |
|> policy thy |
|
321 |
|> Name.variant (Symtab.keys (snd tabs)) |
|
322 |
|> declare |
|
323 |
end; |
|
324 |
||
325 |
fun get_const thy const = |
|
326 |
let |
|
327 |
val tabs = ConstName.get thy; |
|
328 |
fun declare name = |
|
329 |
let |
|
24423
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
330 |
val names' = (Symtab.update (const, name) (fst tabs), |
24219 | 331 |
Symtab.update_new (name, const) (snd tabs)) |
332 |
in (ConstName.change thy (K names'); name) end; |
|
24423
ae9cd0e92423
overloaded definitions accompanied by explicit constants
haftmann
parents:
24219
diff
changeset
|
333 |
in case Symtab.lookup (fst tabs) const |
24219 | 334 |
of SOME name => name |
335 |
| NONE => |
|
336 |
const |
|
337 |
|> const_policy thy |
|
338 |
|> Name.variant (Symtab.keys (snd tabs)) |
|
339 |
|> declare |
|
340 |
end; |
|
341 |
||
342 |
||
343 |
(* backward lookup *) |
|
344 |
||
345 |
fun rev thy get_tabs name = |
|
346 |
let |
|
347 |
val names_ref = CodeName.get thy |
|
348 |
val (Names names) = ! names_ref; |
|
349 |
val tab = (snd o get_tabs) names; |
|
350 |
in case Symtab.lookup tab name |
|
351 |
of SOME x => x |
|
352 |
| NONE => error ("No such " ^ category_of name ^ ": " ^ quote name) |
|
353 |
end; |
|
354 |
||
355 |
fun rev_const thy name = |
|
356 |
let |
|
357 |
val tab = snd (ConstName.get thy); |
|
358 |
in case Symtab.lookup tab name |
|
359 |
of SOME const => const |
|
360 |
| NONE => error ("No such " ^ category_of name ^ ": " ^ quote name) |
|
361 |
end; |
|
362 |
||
363 |
||
364 |
(* external interfaces *) |
|
365 |
||
366 |
fun class thy = |
|
367 |
get thy #class Symtab.lookup map_class Symtab.update class_policy |
|
24811 | 368 |
#> add_suffix suffix_class; |
24219 | 369 |
fun classrel thy = |
370 |
get thy #classrel StringPairTab.lookup map_classrel StringPairTab.update classrel_policy |
|
24811 | 371 |
#> add_suffix suffix_classrel; |
24219 | 372 |
fun tyco thy = |
373 |
get thy #tyco Symtab.lookup map_tyco Symtab.update tyco_policy |
|
24811 | 374 |
#> add_suffix suffix_tyco; |
24219 | 375 |
fun instance thy = |
376 |
get thy #instance StringPairTab.lookup map_instance StringPairTab.update instance_policy |
|
24811 | 377 |
#> add_suffix suffix_instance; |
24219 | 378 |
fun const thy = |
379 |
get_const thy |
|
24811 | 380 |
#> add_suffix suffix_const; |
24219 | 381 |
|
382 |
fun class_rev thy = |
|
24811 | 383 |
dest_suffix suffix_class |
24219 | 384 |
#> Option.map (rev thy #class); |
385 |
fun classrel_rev thy = |
|
24811 | 386 |
dest_suffix suffix_classrel |
24219 | 387 |
#> Option.map (rev thy #classrel); |
388 |
fun tyco_rev thy = |
|
24811 | 389 |
dest_suffix suffix_tyco |
24219 | 390 |
#> Option.map (rev thy #tyco); |
391 |
fun instance_rev thy = |
|
24811 | 392 |
dest_suffix suffix_instance |
24219 | 393 |
#> Option.map (rev thy #instance); |
394 |
fun const_rev thy = |
|
24811 | 395 |
dest_suffix suffix_const |
24219 | 396 |
#> Option.map (rev_const thy); |
397 |
||
398 |
local |
|
399 |
||
400 |
val f_mapping = [ |
|
24811 | 401 |
(suffix_class, class_rev), |
402 |
(suffix_classrel, Option.map string_of_classrel oo classrel_rev), |
|
403 |
(suffix_tyco, tyco_rev), |
|
404 |
(suffix_instance, Option.map string_of_instance oo instance_rev), |
|
405 |
(suffix_const, fn thy => Option.map (CodeUnit.string_of_const thy) o const_rev thy) |
|
24219 | 406 |
]; |
407 |
||
408 |
in |
|
409 |
||
24916 | 410 |
val value_name = "Isabelle_Eval.EVAL.EVAL" |
411 |
||
412 |
fun labelled_name thy suffix_name = if suffix_name = value_name then "<term>" else |
|
24219 | 413 |
let |
24811 | 414 |
val category = category_of suffix_name; |
415 |
val name = NameSpace.qualifier suffix_name; |
|
416 |
val suffix = NameSpace.base suffix_name |
|
417 |
in case (the o AList.lookup (op =) f_mapping) suffix thy suffix_name |
|
24219 | 418 |
of SOME thing => category ^ " " ^ quote thing |
419 |
| NONE => error ("Unknown name: " ^ quote name) |
|
420 |
end; |
|
421 |
||
422 |
end; |
|
423 |
||
424 |
end; |