clarified concrete syntax;
authorwenzelm
Fri, 23 Aug 2024 22:45:18 +0200
changeset 80752 2c9b5288eb84
parent 80751 c7f7e58509af
child 80753 66893c47500d
clarified concrete syntax;
src/Pure/Isar/isar_cmd.ML
src/Pure/Pure.thy
--- a/src/Pure/Isar/isar_cmd.ML	Fri Aug 23 21:32:09 2024 +0200
+++ b/src/Pure/Isar/isar_cmd.ML	Fri Aug 23 22:45:18 2024 +0200
@@ -15,8 +15,10 @@
   val print_ast_translation: Input.source -> theory -> theory
   val translations: (xstring * string) Syntax.trrule list -> theory -> theory
   val no_translations: (xstring * string) Syntax.trrule list -> theory -> theory
-  val syntax_consts: ((string * Position.T) * (xstring * Position.T) list) list -> theory -> theory
-  val syntax_types: ((string * Position.T) * (xstring * Position.T) list) list -> theory -> theory
+  val syntax_consts: ((string * Position.T) list * (xstring * Position.T) list) list ->
+    theory -> theory
+  val syntax_types: ((string * Position.T) list * (xstring * Position.T) list) list ->
+    theory -> theory
   val oracle: bstring * Position.range -> Input.source -> theory -> theory
   val declaration: {syntax: bool, pervasive: bool} -> Input.source -> local_theory -> local_theory
   val qed: Method.text_range option -> Toplevel.transition -> Toplevel.transition
@@ -117,13 +119,20 @@
 fun syntax_deps_cmd f args thy =
   let
     val ctxt = Proof_Context.init_global thy;
+
+    val check_lhs = Proof_Context.check_syntax_const ctxt;
     fun check_rhs (b: xstring, pos: Position.T) =
       let
-        val (c, reports) = f ctxt (b, pos);
+        val (c: string, reports) = f ctxt (b, pos);
         val _ = Context_Position.reports ctxt reports;
       in c end;
-    fun check_arg (a, bs) = (Proof_Context.check_syntax_const ctxt a, map check_rhs bs);
-  in Sign.syntax_deps (map check_arg args) thy end;
+
+    fun check (raw_lhs, raw_rhs) =
+      let
+        val lhs = map check_lhs raw_lhs;
+        val rhs = map check_rhs raw_rhs;
+      in map (fn l => (l, rhs)) lhs end;
+  in Sign.syntax_deps (maps check args) thy end;
 
 fun check_const ctxt (s, pos) =
   Proof_Context.check_const {proper = false, strict = true} ctxt (s, [pos])
--- a/src/Pure/Pure.thy	Fri Aug 23 21:32:09 2024 +0200
+++ b/src/Pure/Pure.thy	Fri Aug 23 22:45:18 2024 +0200
@@ -404,7 +404,7 @@
 
 val syntax_consts =
   Parse.and_list1
-    ((Parse.name_position --| (\<^keyword>\<open>\<rightleftharpoons>\<close> || \<^keyword>\<open>==\<close>)) --
+    ((Scan.repeat1 Parse.name_position --| (\<^keyword>\<open>\<rightleftharpoons>\<close> || \<^keyword>\<open>==\<close>)) --
       Parse.!!! (Scan.repeat1 Parse.name_position));
 
 val _ =