added nested_command (with explicit position argument via properties);
authorwenzelm
Wed, 02 Jan 2008 23:00:52 +0100
changeset 25793 6c2adbf41c7c
parent 25792 c7125b591885
child 25794 11bec58fc289
added nested_command (with explicit position argument via properties);
src/Pure/Isar/isar_cmd.ML
--- a/src/Pure/Isar/isar_cmd.ML	Wed Jan 02 23:00:51 2008 +0100
+++ b/src/Pure/Isar/isar_cmd.ML	Wed Jan 02 23:00:52 2008 +0100
@@ -65,6 +65,7 @@
   val use_mltext_theory: string -> Toplevel.transition -> Toplevel.transition
   val use_mltext: bool -> string -> Toplevel.transition -> Toplevel.transition
   val use_commit: Toplevel.transition -> Toplevel.transition
+  val nested_command: Markup.property list -> string * Position.T -> Toplevel.transition
   val cd: Path.T -> Toplevel.transition -> Toplevel.transition
   val pwd: Toplevel.transition -> Toplevel.transition
   val use_thy: string -> Toplevel.transition -> Toplevel.transition
@@ -388,6 +389,16 @@
 val use_commit = Toplevel.imperative Secure.commit;
 
 
+(* nested commands *)
+
+fun nested_command props (str, pos) =
+  let val (pos', props') = Position.of_properties (props @ Position.properties_of pos) in
+    (case OuterSyntax.parse pos' str of
+      [transition] => Toplevel.properties props' transition
+    | _ => error "exactly one command expected")
+  end;
+
+
 (* current working directory *)
 
 fun cd path = Toplevel.imperative (fn () => (File.cd path));