more robust ML antiquotations -- allow original tokens without adjacent whitespace;
--- a/src/Pure/ML/ml_antiquote.ML Tue Dec 21 19:35:36 2010 +0100
+++ b/src/Pure/ML/ml_antiquote.ML Tue Dec 21 21:05:50 2010 +0100
@@ -48,7 +48,7 @@
let
val (a, background') = variant (translate_string (fn "." => "_" | c => c) name) background;
val env = kind ^ " " ^ a ^ " = " ^ s ^ ";\n";
- val body = "Isabelle." ^ a;
+ val body = " Isabelle." ^ a ^ " ";
in (K (env, body), background') end));
val value = declaration "val";
--- a/src/Pure/ML/ml_thms.ML Tue Dec 21 19:35:36 2010 +0100
+++ b/src/Pure/ML/ml_thms.ML Tue Dec 21 21:05:50 2010 +0100
@@ -39,7 +39,7 @@
val i = serial ();
val (a, background') = background
|> ML_Antiquote.variant kind ||> put_thms (i, ths);
- val ml = (thm_bind kind a i, "Isabelle." ^ a);
+ val ml = (thm_bind kind a i, " Isabelle." ^ a ^ " ");
in (K ml, background') end));
val _ = thm_antiq "thm" (Attrib.thm >> single);
@@ -69,7 +69,8 @@
val (a, background') = background
|> ML_Antiquote.variant "lemma" ||> put_thms (i, the_thms ctxt' i);
val ml =
- (thm_bind (if length (flat propss) = 1 then "thm" else "thms") a i, "Isabelle." ^ a);
+ (thm_bind (if length (flat propss) = 1 then "thm" else "thms") a i,
+ " Isabelle." ^ a ^ " ");
in (K ml, background') end));
end;
--- a/src/Tools/Code/code_runtime.ML Tue Dec 21 19:35:36 2010 +0100
+++ b/src/Tools/Code/code_runtime.ML Tue Dec 21 21:05:50 2010 +0100
@@ -228,16 +228,13 @@
fun register_const const = register_code [] [const];
-fun print_const const all_struct_name consts_map =
- (Long_Name.append all_struct_name o the o AList.lookup (op =) consts_map) const;
-
fun print_code is_first const ctxt =
let
val (_, (_, acc_code)) = Code_Antiq_Data.get ctxt;
val (ml_code, consts_map) = Lazy.force acc_code;
val ml_code = if is_first then ml_code else "";
- val all_struct_name = "Isabelle";
- in (ml_code, print_const const all_struct_name consts_map) end;
+ val body = " Isabelle." ^ the (AList.lookup (op =) consts_map const) ^ " ";
+ in (ml_code, body) end;
in