203 |
203 |
204 fun dest_parsers () = |
204 fun dest_parsers () = |
205 map (fn (name, (((cmt, kind), (int_only, _)), _)) => (name, cmt, kind, int_only)) |
205 map (fn (name, (((cmt, kind), (int_only, _)), _)) => (name, cmt, kind, int_only)) |
206 (Symtab.dest (get_parsers ())); |
206 (Symtab.dest (get_parsers ())); |
207 |
207 |
208 fun print_outer_syntax () = |
208 fun help_outer_syntax () = |
209 let |
209 let |
210 fun pretty_cmd (name, comment, _, _) = |
210 fun pretty_cmd (name, comment, _, _) = |
211 Pretty.block [Pretty.str (name ^ ":"), Pretty.brk 2, Pretty.str comment]; |
211 Pretty.block [Pretty.str (name ^ ":"), Pretty.brk 2, Pretty.str comment]; |
212 val (int_cmds, cmds) = partition #4 (dest_parsers ()); |
212 val (int_cmds, cmds) = partition #4 (dest_parsers ()); |
213 in |
213 in |
214 Pretty.writeln (Pretty.strs ("syntax keywords:" :: map quote (dest_keywords ()))); |
214 [Pretty.strs ("syntax keywords:" :: map quote (dest_keywords ())), |
215 Pretty.writeln (Pretty.big_list "proper commands:" (map pretty_cmd cmds)); |
215 Pretty.big_list "proper commands:" (map pretty_cmd cmds), |
216 Pretty.writeln (Pretty.big_list "improper commands (interactive-only):" |
216 Pretty.big_list "improper commands (interactive-only):" (map pretty_cmd int_cmds)] |
217 (map pretty_cmd int_cmds)) |
|
218 end; |
217 end; |
|
218 |
|
219 val print_outer_syntax = Pretty.writeln o Pretty.chunks o help_outer_syntax; |
219 |
220 |
220 val print_help = |
221 val print_help = |
221 Toplevel.keep (fn state => |
222 Toplevel.keep (fn state => |
222 let val opt_thy = try Toplevel.theory_of state in |
223 let val opt_thy = try Toplevel.theory_of state in |
223 print_outer_syntax (); |
224 help_outer_syntax () @ |
224 Method.help_methods opt_thy; |
225 Method.help_methods opt_thy @ |
225 Attrib.help_attributes opt_thy |
226 Attrib.help_attributes opt_thy |
|
227 |> Pretty.chunks |> Pretty.writeln |
226 end); |
228 end); |
227 |
229 |
228 |
230 |
229 |
231 |
230 (** read theory **) |
232 (** read theory **) |