clarified signature;
authorwenzelm
Mon, 20 Sep 2021 20:43:38 +0200
changeset 74331 b9a3d2fb53e0
parent 74330 d882abae3379
child 74332 78c1699c7672
clarified signature;
src/Pure/Isar/proof_context.ML
src/Pure/ML/ml_antiquotations1.ML
--- a/src/Pure/Isar/proof_context.ML	Mon Sep 20 20:22:32 2021 +0200
+++ b/src/Pure/Isar/proof_context.ML	Mon Sep 20 20:43:38 2021 +0200
@@ -155,6 +155,7 @@
   val apply_case: Rule_Cases.T -> Proof.context -> (string * term list) list * Proof.context
   val check_case: Proof.context -> bool ->
     string * Position.T -> binding option list -> Rule_Cases.T
+  val check_syntax_const: Proof.context -> string * Position.T -> string
   val type_notation: bool -> Syntax.mode -> (typ * mixfix) list -> Proof.context -> Proof.context
   val notation: bool -> Syntax.mode -> (term * mixfix) list -> Proof.context -> Proof.context
   val generic_type_notation: bool -> Syntax.mode -> (typ * mixfix) list -> morphism ->
@@ -1123,6 +1124,13 @@
 end;
 
 
+(* syntax *)
+
+fun check_syntax_const ctxt (c, pos) =
+  if is_some (Syntax.lookup_const (syn_of ctxt) c) then c
+  else error ("Unknown syntax const: " ^ quote c ^ Position.here pos);
+
+
 (* notation *)
 
 local
--- a/src/Pure/ML/ml_antiquotations1.ML	Mon Sep 20 20:22:32 2021 +0200
+++ b/src/Pure/ML/ml_antiquotations1.ML	Mon Sep 20 20:43:38 2021 +0200
@@ -171,10 +171,8 @@
     (const_name (fn (_, c) => Lexicon.mark_const c)) #>
 
   ML_Antiquotation.inline_embedded \<^binding>\<open>syntax_const\<close>
-    (Args.context -- Scan.lift Args.embedded_position >> (fn (ctxt, (c, pos)) =>
-      if is_some (Syntax.lookup_const (Proof_Context.syn_of ctxt) c)
-      then ML_Syntax.print_string c
-      else error ("Unknown syntax const: " ^ quote c ^ Position.here pos))) #>
+    (Args.context -- Scan.lift Args.embedded_position >> (fn (ctxt, arg) =>
+      ML_Syntax.print_string (Proof_Context.check_syntax_const ctxt arg))) #>
 
   ML_Antiquotation.inline_embedded \<^binding>\<open>const\<close>
     (Args.context -- Scan.lift (Parse.position Args.embedded_inner_syntax) -- Scan.optional