allow multiple entries of and_list (on both sides);
authorwenzelm
Sun, 25 Feb 2018 19:16:32 +0100
changeset 67722 012f1e8a1209
parent 67721 5348bea4accd
child 67723 d11c5af083a5
allow multiple entries of and_list (on both sides);
src/Doc/Isar_Ref/Spec.thy
src/Pure/Thy/thy_header.ML
src/Pure/Thy/thy_header.scala
--- a/src/Doc/Isar_Ref/Spec.thy	Sun Feb 25 15:44:46 2018 +0100
+++ b/src/Doc/Isar_Ref/Spec.thy	Sun Feb 25 19:16:32 2018 +0100
@@ -66,7 +66,7 @@
     ;
     keyword_decls: (@{syntax string} +) ('::' @{syntax name} @{syntax tags})?
     ;
-    abbrevs: @'abbrevs' ((text '=' text) + @'and')
+    abbrevs: @'abbrevs' (((text+) '=' (text+)) + @'and')
     ;
     @@{command thy_deps} (thy_bounds thy_bounds?)?
     ;
--- a/src/Pure/Thy/thy_header.ML	Sun Feb 25 15:44:46 2018 +0100
+++ b/src/Pure/Thy/thy_header.ML	Sun Feb 25 19:16:32 2018 +0100
@@ -144,7 +144,10 @@
   Scan.optional (Parse.$$$ "::" |-- Parse.!!! keyword_spec) Keyword.no_spec
   >> (fn (names, spec) => map (rpair spec) names);
 
-val abbrevs = Parse.and_list1 (Parse.text -- (Parse.$$$ "=" |-- Parse.!!! Parse.text));
+val abbrevs =
+  Parse.and_list1
+    (Scan.repeat1 Parse.text -- (Parse.$$$ "=" |-- Parse.!!! (Scan.repeat1 Parse.text))
+      >> uncurry (map_product pair)) >> flat;
 
 val keyword_decls = Parse.and_list1 keyword_decl >> flat;
 
--- a/src/Pure/Thy/thy_header.scala	Sun Feb 25 15:44:46 2018 +0100
+++ b/src/Pure/Thy/thy_header.scala	Sun Feb 25 19:16:32 2018 +0100
@@ -138,7 +138,8 @@
       { case xs ~ yss => (xs :: yss).flatten }
 
     val abbrevs =
-      rep1sep(text ~ ($$$("=") ~! text) ^^ { case a ~ (_ ~ b) => (a, b) }, $$$("and"))
+      rep1sep(rep1(text) ~ ($$$("=") ~! rep1(text)), $$$("and")) ^^
+        { case res => for ((as ~ (_ ~ bs)) <- res; a <- as; b <- bs) yield (a, b) }
 
     val args =
       position(theory_name) ~