src/Pure/pure_syn.ML
author wenzelm
Tue, 23 Nov 2021 12:29:09 +0100
changeset 74832 c299abcf7081
parent 74831 32490add64b4
child 74835 26c3a9c92e11
permissions -rw-r--r--
clarified modules;

(*  Title:      Pure/pure_syn.ML
    Author:     Makarius

Outer syntax for bootstrapping: commands that are accessible outside a
regular theory context.
*)

signature PURE_SYN =
sig
  val bootstrap_thy: theory
end;

structure Pure_Syn: PURE_SYN =
struct

val semi = Scan.option (Parse.$$$ ";");

val _ =
  Outer_Syntax.command ("chapter", \<^here>) "chapter heading"
    (Parse.opt_target -- Parse.document_source --| semi >> Document_Output.document_output);

val _ =
  Outer_Syntax.command ("section", \<^here>) "section heading"
    (Parse.opt_target -- Parse.document_source --| semi >> Document_Output.document_output);

val _ =
  Outer_Syntax.command ("subsection", \<^here>) "subsection heading"
    (Parse.opt_target -- Parse.document_source --| semi >> Document_Output.document_output);

val _ =
  Outer_Syntax.command ("subsubsection", \<^here>) "subsubsection heading"
    (Parse.opt_target -- Parse.document_source --| semi >> Document_Output.document_output);

val _ =
  Outer_Syntax.command ("paragraph", \<^here>) "paragraph heading"
    (Parse.opt_target -- Parse.document_source --| semi >> Document_Output.document_output);

val _ =
  Outer_Syntax.command ("subparagraph", \<^here>) "subparagraph heading"
    (Parse.opt_target -- Parse.document_source --| semi >> Document_Output.document_output);

val _ =
  Outer_Syntax.command ("text", \<^here>) "formal comment (primary style)"
    (Parse.opt_target -- Parse.document_source >> Document_Output.document_output_markdown);

val _ =
  Outer_Syntax.command ("txt", \<^here>) "formal comment (secondary style)"
    (Parse.opt_target -- Parse.document_source >> Document_Output.document_output_markdown);

val _ =
  Outer_Syntax.command ("text_raw", \<^here>) "LaTeX text (without surrounding environment)"
    (Parse.opt_target -- Parse.document_source >> Document_Output.document_output_markdown);

val _ =
  Outer_Syntax.command ("theory", \<^here>) "begin theory"
    (Thy_Header.args >>
      (fn _ => Toplevel.init_theory (fn () => error "Missing theory initialization")));


val bootstrap_thy = Context.the_global_context ();

val _ = Theory.setup (Config.put_global Outer_Syntax.bootstrap false);

end;