src/Pure/ML/ml_context.ML
changeset 59917 9830c944670f
parent 59127 723b11f8ffbf
child 61471 9d4c08af61b8
equal deleted inserted replaced
59916:f673ce6b1e2b 59917:9830c944670f
    17   val variant: string -> Proof.context -> string * Proof.context
    17   val variant: string -> Proof.context -> string * Proof.context
    18   type decl = Proof.context -> string * string
    18   type decl = Proof.context -> string * string
    19   val value_decl: string -> string -> Proof.context -> decl * Proof.context
    19   val value_decl: string -> string -> Proof.context -> decl * Proof.context
    20   val add_antiquotation: binding -> (Token.src -> Proof.context -> decl * Proof.context) ->
    20   val add_antiquotation: binding -> (Token.src -> Proof.context -> decl * Proof.context) ->
    21     theory -> theory
    21     theory -> theory
    22   val print_antiquotations: Proof.context -> unit
    22   val print_antiquotations: bool -> Proof.context -> unit
    23   val eval: ML_Compiler.flags -> Position.T -> ML_Lex.token Antiquote.antiquote list -> unit
    23   val eval: ML_Compiler.flags -> Position.T -> ML_Lex.token Antiquote.antiquote list -> unit
    24   val eval_file: ML_Compiler.flags -> Path.T -> unit
    24   val eval_file: ML_Compiler.flags -> Path.T -> unit
    25   val eval_source: ML_Compiler.flags -> Input.source -> unit
    25   val eval_source: ML_Compiler.flags -> Input.source -> unit
    26   val eval_in: Proof.context option -> ML_Compiler.flags -> Position.T ->
    26   val eval_in: Proof.context option -> ML_Compiler.flags -> Position.T ->
    27     ML_Lex.token Antiquote.antiquote list -> unit
    27     ML_Lex.token Antiquote.antiquote list -> unit
   100   #1 o Name_Space.check (Context.Proof ctxt) (get_antiquotations ctxt);
   100   #1 o Name_Space.check (Context.Proof ctxt) (get_antiquotations ctxt);
   101 
   101 
   102 fun add_antiquotation name f thy = thy
   102 fun add_antiquotation name f thy = thy
   103   |> Antiquotations.map (Name_Space.define (Context.Theory thy) true (name, f) #> snd);
   103   |> Antiquotations.map (Name_Space.define (Context.Theory thy) true (name, f) #> snd);
   104 
   104 
   105 fun print_antiquotations ctxt =
   105 fun print_antiquotations verbose ctxt =
   106   Pretty.big_list "ML antiquotations:"
   106   Pretty.big_list "ML antiquotations:"
   107     (map (Pretty.mark_str o #1) (Name_Space.markup_table ctxt (get_antiquotations ctxt)))
   107     (map (Pretty.mark_str o #1) (Name_Space.markup_table verbose ctxt (get_antiquotations ctxt)))
   108   |> Pretty.writeln;
   108   |> Pretty.writeln;
   109 
   109 
   110 fun apply_antiquotation src ctxt =
   110 fun apply_antiquotation src ctxt =
   111   let val (src', f) = Token.check_src ctxt (get_antiquotations ctxt) src
   111   let val (src', f) = Token.check_src ctxt (get_antiquotations ctxt) src
   112   in f src' ctxt end;
   112   in f src' ctxt end;