| author | wenzelm |
| Tue, 23 Nov 2021 21:02:13 +0100 | |
| changeset 74836 | a97ec0954c50 |
| parent 74835 | 26c3a9c92e11 |
| child 74838 | 4c8d9479f916 |
| permissions | -rw-r--r-- |
| 48879 | 1 |
(* Title: Pure/pure_syn.ML |
2 |
Author: Makarius |
|
3 |
||
| 60096 | 4 |
Outer syntax for bootstrapping: commands that are accessible outside a |
5 |
regular theory context. |
|
| 48879 | 6 |
*) |
7 |
||
| 60095 | 8 |
signature PURE_SYN = |
9 |
sig |
|
10 |
val bootstrap_thy: theory |
|
11 |
end; |
|
12 |
||
13 |
structure Pure_Syn: PURE_SYN = |
|
| 48879 | 14 |
struct |
15 |
||
|
74835
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
16 |
fun markup_pos markup pos body = [XML.Elem (markup |> Position.markup pos, body)]; |
|
58999
ed09ae4ea2d8
uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents:
58928
diff
changeset
|
17 |
|
|
74835
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
18 |
fun document_heading (name, pos) = |
|
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
19 |
Outer_Syntax.command (name, pos) (name ^ " heading") |
|
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
20 |
(Parse.opt_target -- Parse.document_source --| Scan.option (Parse.$$$ ";") >> |
|
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
21 |
Document_Output.document_output |
|
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
22 |
{markdown = false, markup = markup_pos (Markup.latex_heading name)});
|
| 58918 | 23 |
|
|
74835
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
24 |
fun document_body ((name, pos), description) = |
|
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
25 |
Outer_Syntax.command (name, pos) description |
|
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
26 |
(Parse.opt_target -- Parse.document_source >> |
|
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
27 |
Document_Output.document_output |
|
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
28 |
{markdown = true, markup = markup_pos (Markup.latex_body name)});
|
|
58999
ed09ae4ea2d8
uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents:
58928
diff
changeset
|
29 |
|
|
ed09ae4ea2d8
uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents:
58928
diff
changeset
|
30 |
val _ = |
|
74835
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
31 |
List.app document_heading |
|
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
32 |
[("chapter", \<^here>),
|
|
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
33 |
("section", \<^here>),
|
|
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
34 |
("subsection", \<^here>),
|
|
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
35 |
("subsubsection", \<^here>),
|
|
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
36 |
("paragraph", \<^here>),
|
|
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
37 |
("subparagraph", \<^here>)];
|
| 61463 | 38 |
|
39 |
val _ = |
|
|
74835
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
40 |
List.app document_body |
|
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
41 |
[(("text", \<^here>), "formal comment (primary style)"),
|
|
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
42 |
(("txt", \<^here>), "formal comment (secondary style)")];
|
|
58999
ed09ae4ea2d8
uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents:
58928
diff
changeset
|
43 |
|
|
ed09ae4ea2d8
uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
wenzelm
parents:
58928
diff
changeset
|
44 |
val _ = |
| 64556 | 45 |
Outer_Syntax.command ("text_raw", \<^here>) "LaTeX text (without surrounding environment)"
|
|
74835
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
46 |
(Parse.opt_target -- Parse.document_source >> |
|
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
47 |
Document_Output.document_output |
|
26c3a9c92e11
more general document output: enclosing markup is defined in user-space;
wenzelm
parents:
74832
diff
changeset
|
48 |
{markdown = true, markup = fn _ => Latex.enclose_text "%\n" "\n"});
|
|
58928
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58918
diff
changeset
|
49 |
|
|
23d0ffd48006
plain value Keywords.keywords, which might be used outside theory for bootstrap purposes;
wenzelm
parents:
58918
diff
changeset
|
50 |
val _ = |
| 64556 | 51 |
Outer_Syntax.command ("theory", \<^here>) "begin theory"
|
| 58852 | 52 |
(Thy_Header.args >> |
53 |
(fn _ => Toplevel.init_theory (fn () => error "Missing theory initialization"))); |
|
| 48879 | 54 |
|
| 60095 | 55 |
|
| 62876 | 56 |
val bootstrap_thy = Context.the_global_context (); |
| 60095 | 57 |
|
58 |
val _ = Theory.setup (Config.put_global Outer_Syntax.bootstrap false); |
|
59 |
||
| 48879 | 60 |
end; |