src/Pure/Isar/outer_syntax.ML
changeset 59935 343905de27b1
parent 59932 74872a13f628
child 59939 7d46aa03696e
equal deleted inserted replaced
59934:b65c4370f831 59935:343905de27b1
     6 
     6 
     7 signature OUTER_SYNTAX =
     7 signature OUTER_SYNTAX =
     8 sig
     8 sig
     9   val help: theory -> string list -> unit
     9   val help: theory -> string list -> unit
    10   val print_commands: theory -> unit
    10   val print_commands: theory -> unit
    11   type command_spec = string * Position.T
    11   type command_keyword = string * Position.T
    12   val command: command_spec -> string ->
    12   val command: command_keyword -> string ->
    13     (Toplevel.transition -> Toplevel.transition) parser -> unit
    13     (Toplevel.transition -> Toplevel.transition) parser -> unit
    14   val local_theory': command_spec -> string ->
    14   val local_theory': command_keyword -> string ->
    15     (bool -> local_theory -> local_theory) parser -> unit
    15     (bool -> local_theory -> local_theory) parser -> unit
    16   val local_theory: command_spec -> string ->
    16   val local_theory: command_keyword -> string ->
    17     (local_theory -> local_theory) parser -> unit
    17     (local_theory -> local_theory) parser -> unit
    18   val local_theory_to_proof': command_spec -> string ->
    18   val local_theory_to_proof': command_keyword -> string ->
    19     (bool -> local_theory -> Proof.state) parser -> unit
    19     (bool -> local_theory -> Proof.state) parser -> unit
    20   val local_theory_to_proof: command_spec -> string ->
    20   val local_theory_to_proof: command_keyword -> string ->
    21     (local_theory -> Proof.state) parser -> unit
    21     (local_theory -> Proof.state) parser -> unit
    22   val parse: theory -> Position.T -> string -> Toplevel.transition list
    22   val parse: theory -> Position.T -> string -> Toplevel.transition list
    23   val parse_tokens: theory -> Token.T list -> Toplevel.transition list
    23   val parse_tokens: theory -> Token.T list -> Toplevel.transition list
    24   val parse_spans: Token.T list -> Command_Span.span list
    24   val parse_spans: Token.T list -> Command_Span.span list
    25   val side_comments: Token.T list -> Token.T list
    25   val side_comments: Token.T list -> Token.T list
   132   in NONE end));
   132   in NONE end));
   133 
   133 
   134 
   134 
   135 (* implicit theory setup *)
   135 (* implicit theory setup *)
   136 
   136 
   137 type command_spec = string * Position.T;
   137 type command_keyword = string * Position.T;
   138 
   138 
   139 fun raw_command (name, pos) comment command_parser =
   139 fun raw_command (name, pos) comment command_parser =
   140   let val setup = add_command name (new_command comment command_parser pos)
   140   let val setup = add_command name (new_command comment command_parser pos)
   141   in Context.>> (Context.mapping setup (Local_Theory.background_theory setup)) end;
   141   in Context.>> (Context.mapping setup (Local_Theory.background_theory setup)) end;
   142 
   142 
   143 fun command (name, pos) comment parse =
   143 fun command (name, pos) comment parse =
   144   raw_command (name, pos) comment (Parser parse);
   144   raw_command (name, pos) comment (Parser parse);
   145 
   145 
   146 fun local_theory_command trans command_spec comment parse =
   146 fun local_theory_command trans command_keyword comment parse =
   147   raw_command command_spec comment
   147   raw_command command_keyword comment
   148     (Private_Parser (fn private =>
   148     (Private_Parser (fn private =>
   149       Parse.opt_target -- parse >> (fn (target, f) => trans private target f)));
   149       Parse.opt_target -- parse >> (fn (target, f) => trans private target f)));
   150 
   150 
   151 val local_theory' = local_theory_command Toplevel.local_theory';
   151 val local_theory' = local_theory_command Toplevel.local_theory';
   152 val local_theory = local_theory_command Toplevel.local_theory;
   152 val local_theory = local_theory_command Toplevel.local_theory;