src/Pure/Tools/ghc.ML
changeset 69279 e6997512ef6c
parent 69216 1a52baa70aed
child 69381 4c9b4e2c5460
equal deleted inserted replaced
69278:30f6e8d2cd96 69279:e6997512ef6c
   112 fun the_result ctxt =
   112 fun the_result ctxt =
   113   (case Local_Data.get ctxt of
   113   (case Local_Data.get ctxt of
   114     SOME s => s
   114     SOME s => s
   115   | NONE => raise Fail "No result");
   115   | NONE => raise Fail "No result");
   116 
   116 
       
   117 fun path_antiq check =
       
   118   Args.context -- Scan.lift (Parse.position Parse.path) >> (fn (ctxt, (name, pos)) =>
       
   119     (check ctxt Path.current (name, pos) |> Path.implode |> print_string));
       
   120 
   117 val _ =
   121 val _ =
   118   Theory.setup
   122   Theory.setup
   119     (antiquotation \<^binding>\<open>cartouche\<close> (Scan.lift Args.cartouche_input)
   123     (antiquotation \<^binding>\<open>cartouche\<close> (Scan.lift Args.cartouche_input)
   120       (fn {context = ctxt, argument, ...} =>
   124       (fn {context = ctxt, argument, ...} =>
   121         ctxt |> Context.proof_map
   125         ctxt |> Context.proof_map
   122           (ML_Context.expression (Input.pos_of argument)
   126           (ML_Context.expression (Input.pos_of argument)
   123             (ML_Lex.read "Theory.local_setup (GHC.set_result (" @
   127             (ML_Lex.read "Theory.local_setup (GHC.set_result (" @
   124              ML_Lex.read_source argument @ ML_Lex.read "))"))
   128              ML_Lex.read_source argument @ ML_Lex.read "))"))
   125         |> the_result |> print_string));
   129         |> the_result |> print_string) #>
       
   130     antiquotation \<^binding>\<open>path\<close> (path_antiq Resources.check_path) #argument #>
       
   131     antiquotation \<^binding>\<open>file\<close> (path_antiq Resources.check_file) #argument #>
       
   132     antiquotation \<^binding>\<open>dir\<close> (path_antiq Resources.check_dir) #argument);
   126 
   133 
   127 end;
   134 end;