equal
deleted
inserted
replaced
11 val quotes: bool ref |
11 val quotes: bool ref |
12 val indent: int ref |
12 val indent: int ref |
13 val source: bool ref |
13 val source: bool ref |
14 val add_commands: (string * (Args.src -> Toplevel.node option -> string)) list -> unit |
14 val add_commands: (string * (Args.src -> Toplevel.node option -> string)) list -> unit |
15 val add_options: (string * (string -> (unit -> string) -> unit -> string)) list -> unit |
15 val add_options: (string * (string -> (unit -> string) -> unit -> string)) list -> unit |
|
16 val defined_command: string -> bool |
|
17 val defined_option: string -> bool |
16 val print_antiquotations: unit -> unit |
18 val print_antiquotations: unit -> unit |
17 val boolean: string -> bool |
19 val boolean: string -> bool |
18 val integer: string -> int |
20 val integer: string -> int |
19 val args: (Context.generic * Args.T list -> 'a * (Context.generic * Args.T list)) -> |
21 val args: (Context.generic * Args.T list -> 'a * (Context.generic * Args.T list)) -> |
20 (Args.src -> Proof.context -> 'a -> string) -> Args.src -> Toplevel.node option -> string |
22 (Args.src -> Proof.context -> 'a -> string) -> Args.src -> Toplevel.node option -> string |
63 |
65 |
64 in |
66 in |
65 |
67 |
66 fun add_commands xs = CRITICAL (fn () => change global_commands (fold (add_item "command") xs)); |
68 fun add_commands xs = CRITICAL (fn () => change global_commands (fold (add_item "command") xs)); |
67 fun add_options xs = CRITICAL (fn () => change global_options (fold (add_item "option") xs)); |
69 fun add_options xs = CRITICAL (fn () => change global_options (fold (add_item "option") xs)); |
|
70 |
|
71 fun defined_command name = Symtab.defined (! global_commands) name; |
|
72 fun defined_option name = Symtab.defined (! global_options) name; |
68 |
73 |
69 fun command src = |
74 fun command src = |
70 let val ((name, _), pos) = Args.dest_src src in |
75 let val ((name, _), pos) = Args.dest_src src in |
71 (case Symtab.lookup (! global_commands) name of |
76 (case Symtab.lookup (! global_commands) name of |
72 NONE => error ("Unknown text antiquotation command: " ^ quote name ^ Position.str_of pos) |
77 NONE => error ("Unknown text antiquotation command: " ^ quote name ^ Position.str_of pos) |