src/Pure/Thy/thy_output.ML
author wenzelm
Sat Mar 09 23:57:07 2019 +0100 (2 months ago ago)
changeset 70067 0cb8753bdb50
parent 70064 f8293bf510a0
child 70068 b9985133805d
permissions -rw-r--r--
clarified signature;
     1 (*  Title:      Pure/Thy/thy_output.ML
     2     Author:     Makarius
     3 
     4 Theory document output.
     5 *)
     6 
     7 signature THY_OUTPUT =
     8 sig
     9   val output_document: Proof.context -> {markdown: bool} -> Input.source -> Latex.text list
    10   val check_comments: Proof.context -> Symbol_Pos.T list -> unit
    11   val output_token: Proof.context -> Token.T -> Latex.text list
    12   val output_source: Proof.context -> string -> Latex.text list
    13   type segment = {span: Command_Span.span, command: Toplevel.transition, state: Toplevel.state}
    14   val present_thy: Options.T -> theory -> segment list -> Latex.text list
    15   val pretty_term: Proof.context -> term -> Pretty.T
    16   val pretty_thm: Proof.context -> thm -> Pretty.T
    17   val lines: Latex.text list -> Latex.text list
    18   val items: Latex.text list -> Latex.text list
    19   val isabelle: Proof.context -> Latex.text list -> Latex.text
    20   val isabelle_typewriter: Proof.context -> Latex.text list -> Latex.text
    21   val typewriter: Proof.context -> string -> Latex.text
    22   val verbatim: Proof.context -> string -> Latex.text
    23   val source: Proof.context -> Token.src -> Latex.text
    24   val pretty: Proof.context -> Pretty.T -> Latex.text
    25   val pretty_source: Proof.context -> Token.src -> Pretty.T -> Latex.text
    26   val pretty_items: Proof.context -> Pretty.T list -> Latex.text
    27   val pretty_items_source: Proof.context -> Token.src -> Pretty.T list -> Latex.text
    28   val antiquotation_pretty:
    29     binding -> 'a context_parser -> (Proof.context -> 'a -> Pretty.T) -> theory -> theory
    30   val antiquotation_pretty_embedded:
    31     binding -> 'a context_parser -> (Proof.context -> 'a -> Pretty.T) -> theory -> theory
    32   val antiquotation_pretty_source:
    33     binding -> 'a context_parser -> (Proof.context -> 'a -> Pretty.T) -> theory -> theory
    34   val antiquotation_pretty_source_embedded:
    35     binding -> 'a context_parser -> (Proof.context -> 'a -> Pretty.T) -> theory -> theory
    36   val antiquotation_raw:
    37     binding -> 'a context_parser -> (Proof.context -> 'a -> Latex.text) -> theory -> theory
    38   val antiquotation_raw_embedded:
    39     binding -> 'a context_parser -> (Proof.context -> 'a -> Latex.text) -> theory -> theory
    40   val antiquotation_verbatim:
    41     binding -> 'a context_parser -> (Proof.context -> 'a -> string) -> theory -> theory
    42   val antiquotation_verbatim_embedded:
    43     binding -> 'a context_parser -> (Proof.context -> 'a -> string) -> theory -> theory
    44 end;
    45 
    46 structure Thy_Output: THY_OUTPUT =
    47 struct
    48 
    49 (* output document source *)
    50 
    51 val output_symbols = single o Latex.symbols_output;
    52 
    53 fun output_comment ctxt (kind, syms) =
    54   (case kind of
    55     Comment.Comment =>
    56       Input.cartouche_content syms
    57       |> output_document (ctxt |> Config.put Document_Antiquotation.thy_output_display false)
    58           {markdown = false}
    59       |> Latex.enclose_body "%\n\\isamarkupcmt{" "%\n}"
    60   | Comment.Cancel =>
    61       Symbol_Pos.cartouche_content syms
    62       |> output_symbols
    63       |> Latex.enclose_body "%\n\\isamarkupcancel{" "}"
    64   | Comment.Latex =>
    65       [Latex.symbols (Symbol_Pos.cartouche_content syms)])
    66 and output_comment_document ctxt (comment, syms) =
    67   (case comment of
    68     SOME kind => output_comment ctxt (kind, syms)
    69   | NONE => [Latex.symbols syms])
    70 and output_document_text ctxt syms =
    71   Comment.read_body syms |> maps (output_comment_document ctxt)
    72 and output_document ctxt {markdown} source =
    73   let
    74     val pos = Input.pos_of source;
    75     val syms = Input.source_explode source;
    76 
    77     val output_antiquotes =
    78       maps (Document_Antiquotation.evaluate (output_document_text ctxt) ctxt);
    79 
    80     fun output_line line =
    81       (if Markdown.line_is_item line then [Latex.string "\\item "] else []) @
    82         output_antiquotes (Markdown.line_content line);
    83 
    84     fun output_block (Markdown.Par lines) =
    85           Latex.block (separate (Latex.string "\n") (map (Latex.block o output_line) lines))
    86       | output_block (Markdown.List {kind, body, ...}) =
    87           Latex.environment_block (Markdown.print_kind kind) (output_blocks body)
    88     and output_blocks blocks = separate (Latex.string "\n\n") (map output_block blocks);
    89   in
    90     if Toplevel.is_skipped_proof (Toplevel.presentation_state ctxt) then []
    91     else if markdown andalso exists (Markdown.is_control o Symbol_Pos.symbol) syms
    92     then
    93       let
    94         val ants = Antiquote.parse_comments pos syms;
    95         val reports = Antiquote.antiq_reports ants;
    96         val blocks = Markdown.read_antiquotes ants;
    97         val _ = Context_Position.reports ctxt (reports @ Markdown.reports blocks);
    98       in output_blocks blocks end
    99     else
   100       let
   101         val ants = Antiquote.parse_comments pos (trim (Symbol.is_blank o Symbol_Pos.symbol) syms);
   102         val reports = Antiquote.antiq_reports ants;
   103         val _ = Context_Position.reports ctxt (reports @ Markdown.text_reports ants);
   104       in output_antiquotes ants end
   105   end;
   106 
   107 
   108 (* output tokens with formal comments *)
   109 
   110 local
   111 
   112 val output_symbols_antiq =
   113   (fn Antiquote.Text syms => output_symbols syms
   114     | Antiquote.Control {name = (name, _), body, ...} =>
   115         Latex.string (Latex.output_symbols [Symbol.encode (Symbol.Control name)]) ::
   116           output_symbols body
   117     | Antiquote.Antiq {body, ...} =>
   118         Latex.enclose_body "%\n\\isaantiq\n" "{}%\n\\endisaantiq\n" (output_symbols body));
   119 
   120 fun output_comment_symbols ctxt {antiq} (comment, syms) =
   121   (case (comment, antiq) of
   122     (NONE, false) => output_symbols syms
   123   | (NONE, true) =>
   124       Antiquote.parse_comments (#1 (Symbol_Pos.range syms)) syms
   125       |> maps output_symbols_antiq
   126   | (SOME comment, _) => output_comment ctxt (comment, syms));
   127 
   128 fun output_body ctxt antiq bg en syms =
   129   Comment.read_body syms
   130   |> maps (output_comment_symbols ctxt {antiq = antiq})
   131   |> Latex.enclose_body bg en;
   132 
   133 in
   134 
   135 fun output_token ctxt tok =
   136   let
   137     fun output antiq bg en =
   138       output_body ctxt antiq bg en (Input.source_explode (Token.input_of tok));
   139   in
   140     (case Token.kind_of tok of
   141       Token.Comment NONE => []
   142     | Token.Command => output false "\\isacommand{" "}"
   143     | Token.Keyword =>
   144         if Symbol.is_ascii_identifier (Token.content_of tok)
   145         then output false "\\isakeyword{" "}"
   146         else output false "" ""
   147     | Token.String => output false "{\\isachardoublequoteopen}" "{\\isachardoublequoteclose}"
   148     | Token.Alt_String => output false "{\\isacharbackquoteopen}" "{\\isacharbackquoteclose}"
   149     | Token.Verbatim => output true "{\\isacharverbatimopen}" "{\\isacharverbatimclose}"
   150     | Token.Cartouche => output false "{\\isacartoucheopen}" "{\\isacartoucheclose}"
   151     | _ => output false "" "")
   152   end handle ERROR msg => error (msg ^ Position.here (Token.pos_of tok));
   153 
   154 fun output_source ctxt s =
   155   output_body ctxt false "" "" (Symbol_Pos.explode (s, Position.none));
   156 
   157 fun check_comments ctxt =
   158   Comment.read_body #> List.app (fn (comment, syms) =>
   159     let
   160       val pos = #1 (Symbol_Pos.range syms);
   161       val _ =
   162         comment |> Option.app (fn kind =>
   163           Context_Position.reports ctxt (map (pair pos) (Markup.cartouche :: Comment.markups kind)));
   164       val _ = output_comment_symbols ctxt {antiq = false} (comment, syms);
   165     in if comment = SOME Comment.Comment then check_comments ctxt syms else () end);
   166 
   167 end;
   168 
   169 
   170 
   171 (** present theory source **)
   172 
   173 (* presentation tokens *)
   174 
   175 datatype token =
   176     Ignore_Token
   177   | Basic_Token of Token.T
   178   | Markup_Token of string * Input.source
   179   | Markup_Env_Token of string * Input.source
   180   | Raw_Token of Input.source;
   181 
   182 fun basic_token pred (Basic_Token tok) = pred tok
   183   | basic_token _ _ = false;
   184 
   185 val white_token = basic_token Document_Source.is_white;
   186 val white_comment_token = basic_token Document_Source.is_white_comment;
   187 val blank_token = basic_token Token.is_blank;
   188 val newline_token = basic_token Token.is_newline;
   189 
   190 fun present_token ctxt tok =
   191   (case tok of
   192     Ignore_Token => []
   193   | Basic_Token tok => output_token ctxt tok
   194   | Markup_Token (cmd, source) =>
   195       Latex.enclose_body ("%\n\\isamarkup" ^ cmd ^ "{") "%\n}\n"
   196         (output_document ctxt {markdown = false} source)
   197   | Markup_Env_Token (cmd, source) =>
   198       [Latex.environment_block ("isamarkup" ^ cmd) (output_document ctxt {markdown = true} source)]
   199   | Raw_Token source =>
   200       Latex.string "%\n" :: output_document ctxt {markdown = true} source @ [Latex.string "\n"]);
   201 
   202 
   203 (* command spans *)
   204 
   205 type command = string * Position.T * string list;   (*name, position, tags*)
   206 type source = (token * (string * int)) list;        (*token, markup flag, meta-comment depth*)
   207 
   208 datatype span = Span of command * (source * source * source * source) * bool;
   209 
   210 fun make_span cmd src =
   211   let
   212     fun chop_newline (tok :: toks) =
   213           if newline_token (fst tok) then ([tok], toks, true)
   214           else ([], tok :: toks, false)
   215       | chop_newline [] = ([], [], false);
   216     val (((src_prefix, src_main), src_suffix1), (src_suffix2, src_appendix, newline)) =
   217       src
   218       |> chop_prefix (white_token o fst)
   219       ||>> chop_suffix (white_token o fst)
   220       ||>> chop_prefix (white_comment_token o fst)
   221       ||> chop_newline;
   222   in Span (cmd, (src_prefix, src_main, src_suffix1 @ src_suffix2, src_appendix), newline) end;
   223 
   224 
   225 (* present spans *)
   226 
   227 local
   228 
   229 fun err_bad_nesting pos =
   230   error ("Bad nesting of commands in presentation" ^ pos);
   231 
   232 fun edge which f (x: string option, y) =
   233   if x = y then I
   234   else (case which (x, y) of NONE => I | SOME txt => cons (Latex.string (f txt)));
   235 
   236 val begin_tag = edge #2 Latex.begin_tag;
   237 val end_tag = edge #1 Latex.end_tag;
   238 fun open_delim delim e = edge #2 Latex.begin_delim e #> delim #> edge #2 Latex.end_delim e;
   239 fun close_delim delim e = edge #1 Latex.begin_delim e #> delim #> edge #1 Latex.end_delim e;
   240 
   241 fun read_tag s =
   242   (case space_explode "%" s of
   243     ["", b] => (SOME b, NONE)
   244   | [a, b] => (NONE, SOME (a, b))
   245   | _ => error ("Bad document_tags specification: " ^ quote s));
   246 
   247 in
   248 
   249 fun make_command_tag options keywords =
   250   let
   251     val document_tags =
   252       map read_tag (space_explode "," (Options.string options \<^system_option>\<open>document_tags\<close>));
   253     val document_tags_default = map_filter #1 document_tags;
   254     val document_tags_command = map_filter #2 document_tags;
   255   in
   256     fn {cmd_name, cmd_tags, tag, active_tag} => fn state => fn state' =>
   257       let
   258         val tag' = try hd (fold (update (op =)) cmd_tags (the_list tag));
   259 
   260         val keyword_tags =
   261           if cmd_name = "end" andalso Toplevel.is_end_theory state' then ["theory"]
   262           else Keyword.command_tags keywords cmd_name;
   263         val command_tags =
   264           the_list (AList.lookup (op =) document_tags_command cmd_name) @
   265           keyword_tags @ document_tags_default;
   266 
   267         val active_tag' =
   268           if is_some tag' then tag'
   269           else
   270             (case command_tags of
   271               default_tag :: _ => SOME default_tag
   272             | [] =>
   273                 if Keyword.is_vacuous keywords cmd_name andalso Toplevel.is_proof state
   274                 then active_tag
   275                 else NONE);
   276       in {tag' = tag', active_tag' = active_tag'} end
   277   end;
   278 
   279 fun present_span thy command_tag span state state'
   280     (tag_stack, active_tag, newline, latex, present_cont) =
   281   let
   282     val ctxt' =
   283       Toplevel.presentation_context state'
   284         handle Toplevel.UNDEF => Proof_Context.get_global thy Context.PureN;
   285     val present = fold (fn (tok, (flag, 0)) =>
   286         fold cons (present_token ctxt' tok)
   287         #> cons (Latex.string flag)
   288       | _ => I);
   289 
   290     val Span ((cmd_name, cmd_pos, cmd_tags), srcs, span_newline) = span;
   291 
   292     val (tag, tags) = tag_stack;
   293     val {tag', active_tag'} =
   294       command_tag {cmd_name = cmd_name, cmd_tags = cmd_tags, tag = tag, active_tag = active_tag}
   295         state state';
   296     val edge = (active_tag, active_tag');
   297 
   298     val nesting = Toplevel.level state' - Toplevel.level state;
   299 
   300     val newline' =
   301       if is_none active_tag' then span_newline else newline;
   302 
   303     val tag_stack' =
   304       if nesting = 0 andalso not (Toplevel.is_proof state) then tag_stack
   305       else if nesting >= 0 then (tag', replicate nesting tag @ tags)
   306       else
   307         (case drop (~ nesting - 1) tags of
   308           tg :: tgs => (tg, tgs)
   309         | [] => err_bad_nesting (Position.here cmd_pos));
   310 
   311     val latex' =
   312       latex
   313       |> end_tag edge
   314       |> close_delim (fst present_cont) edge
   315       |> snd present_cont
   316       |> open_delim (present (#1 srcs)) edge
   317       |> begin_tag edge
   318       |> present (#2 srcs);
   319     val present_cont' =
   320       if newline then (present (#3 srcs), present (#4 srcs))
   321       else (I, present (#3 srcs) #> present (#4 srcs));
   322   in (tag_stack', active_tag', newline', latex', present_cont') end;
   323 
   324 fun present_trailer ((_, tags), active_tag, _, latex, present_cont) =
   325   if not (null tags) then err_bad_nesting " at end of theory"
   326   else
   327     latex
   328     |> end_tag (active_tag, NONE)
   329     |> close_delim (fst present_cont) (active_tag, NONE)
   330     |> snd present_cont;
   331 
   332 end;
   333 
   334 
   335 (* present_thy *)
   336 
   337 local
   338 
   339 val markup_true = "\\isamarkuptrue%\n";
   340 val markup_false = "\\isamarkupfalse%\n";
   341 
   342 val opt_newline = Scan.option (Scan.one Token.is_newline);
   343 
   344 val ignore =
   345   Scan.depend (fn d => opt_newline |-- Scan.one Token.is_begin_ignore
   346     >> pair (d + 1)) ||
   347   Scan.depend (fn d => Scan.one Token.is_end_ignore --|
   348     (if d = 0 then Scan.fail_with (K (fn () => "Bad nesting of meta-comments")) else opt_newline)
   349     >> pair (d - 1));
   350 
   351 val locale =
   352   Scan.option ((Parse.$$$ "(" -- Document_Source.improper -- Parse.$$$ "in") |--
   353     Parse.!!!
   354       (Document_Source.improper |-- Parse.name --| (Document_Source.improper -- Parse.$$$ ")")));
   355 
   356 in
   357 
   358 type segment = {span: Command_Span.span, command: Toplevel.transition, state: Toplevel.state};
   359 
   360 fun present_thy options thy (segments: segment list) =
   361   let
   362     val keywords = Thy_Header.get_keywords thy;
   363 
   364 
   365     (* tokens *)
   366 
   367     val ignored = Scan.state --| ignore
   368       >> (fn d => (NONE, (Ignore_Token, ("", d))));
   369 
   370     fun markup pred mk flag = Scan.peek (fn d =>
   371       Document_Source.improper |--
   372         Parse.position (Scan.one (fn tok =>
   373           Token.is_command tok andalso pred keywords (Token.content_of tok))) --
   374       Scan.repeat Document_Source.tag --
   375       Parse.!!!! ((Document_Source.improper -- locale -- Document_Source.improper) |--
   376         Parse.document_source --| Document_Source.improper_end)
   377           >> (fn (((tok, pos'), tags), source) =>
   378             let val name = Token.content_of tok
   379             in (SOME (name, pos', tags), (mk (name, source), (flag, d))) end));
   380 
   381     val command = Scan.peek (fn d =>
   382       Scan.optional (Scan.one Token.is_command_modifier ::: Document_Source.improper) [] --
   383       Scan.one Token.is_command -- Document_Source.tags
   384       >> (fn ((cmd_mod, cmd), tags) =>
   385         map (fn tok => (NONE, (Basic_Token tok, ("", d)))) cmd_mod @
   386           [(SOME (Token.content_of cmd, Token.pos_of cmd, tags),
   387             (Basic_Token cmd, (markup_false, d)))]));
   388 
   389     val cmt = Scan.peek (fn d =>
   390       Scan.one Document_Source.is_black_comment >> (fn tok => (NONE, (Basic_Token tok, ("", d)))));
   391 
   392     val other = Scan.peek (fn d =>
   393        Parse.not_eof >> (fn tok => (NONE, (Basic_Token tok, ("", d)))));
   394 
   395     val tokens =
   396       (ignored ||
   397         markup Keyword.is_document_heading Markup_Token markup_true ||
   398         markup Keyword.is_document_body Markup_Env_Token markup_true ||
   399         markup Keyword.is_document_raw (Raw_Token o #2) "") >> single ||
   400       command ||
   401       (cmt || other) >> single;
   402 
   403 
   404     (* spans *)
   405 
   406     val is_eof = fn (_, (Basic_Token x, _)) => Token.is_eof x | _ => false;
   407     val stopper = Scan.stopper (K (NONE, (Basic_Token Token.eof, ("", 0)))) is_eof;
   408 
   409     val cmd = Scan.one (is_some o fst);
   410     val non_cmd = Scan.one (is_none o fst andf not o is_eof) >> #2;
   411 
   412     val white_comments = Scan.many (white_comment_token o fst o snd);
   413     val blank = Scan.one (blank_token o fst o snd);
   414     val newline = Scan.one (newline_token o fst o snd);
   415     val before_cmd =
   416       Scan.option (newline -- white_comments) --
   417       Scan.option (newline -- white_comments) --
   418       Scan.option (blank -- white_comments) -- cmd;
   419 
   420     val span =
   421       Scan.repeat non_cmd -- cmd --
   422         Scan.repeat (Scan.unless before_cmd non_cmd) --
   423         Scan.option (newline >> (single o snd))
   424       >> (fn (((toks1, (cmd, tok2)), toks3), tok4) =>
   425           make_span (the cmd) (toks1 @ (tok2 :: (toks3 @ the_default [] tok4))));
   426 
   427     val spans = segments
   428       |> maps (Command_Span.content o #span)
   429       |> drop_suffix Token.is_space
   430       |> Source.of_list
   431       |> Source.source' 0 Token.stopper (Scan.error (Scan.bulk tokens >> flat))
   432       |> Source.source stopper (Scan.error (Scan.bulk span))
   433       |> Source.exhaust;
   434 
   435     val command_results =
   436       segments |> map_filter (fn {command, state, ...} =>
   437         if Toplevel.is_ignored command then NONE else SOME (command, state));
   438 
   439 
   440     (* present commands *)
   441 
   442     val command_tag = make_command_tag options keywords;
   443 
   444     fun present_command tr span st st' =
   445       Toplevel.setmp_thread_position tr (present_span thy command_tag span st st');
   446 
   447     fun present _ [] = I
   448       | present st ((span, (tr, st')) :: rest) = present_command tr span st st' #> present st' rest;
   449   in
   450     if length command_results = length spans then
   451       ((NONE, []), NONE, true, [], (I, I))
   452       |> present (Toplevel.init_toplevel ()) (spans ~~ command_results)
   453       |> present_trailer
   454       |> rev
   455     else error "Messed-up outer syntax for presentation"
   456   end;
   457 
   458 end;
   459 
   460 
   461 
   462 (** standard output operations **)
   463 
   464 (* pretty printing *)
   465 
   466 fun pretty_term ctxt t =
   467   Syntax.pretty_term (Variable.auto_fixes t ctxt) t;
   468 
   469 fun pretty_thm ctxt = pretty_term ctxt o Thm.full_prop_of;
   470 
   471 
   472 (* default output *)
   473 
   474 val lines = separate (Latex.string "\\isanewline%\n");
   475 val items = separate (Latex.string "\\isasep\\isanewline%\n");
   476 
   477 fun isabelle ctxt body =
   478   if Config.get ctxt Document_Antiquotation.thy_output_display
   479   then Latex.environment_block "isabelle" body
   480   else Latex.block (Latex.enclose_body "\\isa{" "}" body);
   481 
   482 fun isabelle_typewriter ctxt body =
   483   if Config.get ctxt Document_Antiquotation.thy_output_display
   484   then Latex.environment_block "isabellett" body
   485   else Latex.block (Latex.enclose_body "\\isatt{" "}" body);
   486 
   487 fun typewriter ctxt s =
   488   isabelle_typewriter ctxt [Latex.string (Latex.output_ascii s)];
   489 
   490 fun verbatim ctxt =
   491   if Config.get ctxt Document_Antiquotation.thy_output_display
   492   then Document_Antiquotation.indent_lines ctxt #> typewriter ctxt
   493   else split_lines #> map (typewriter ctxt) #> lines #> Latex.block;
   494 
   495 fun source ctxt =
   496   Token.args_of_src
   497   #> map (Token.unparse #> Document_Antiquotation.prepare_lines ctxt)
   498   #> space_implode " "
   499   #> output_source ctxt
   500   #> isabelle ctxt;
   501 
   502 fun pretty ctxt =
   503   Document_Antiquotation.output ctxt #> Latex.string #> single #> isabelle ctxt;
   504 
   505 fun pretty_source ctxt src prt =
   506   if Config.get ctxt Document_Antiquotation.thy_output_source
   507   then source ctxt src else pretty ctxt prt;
   508 
   509 fun pretty_items ctxt =
   510   map (Document_Antiquotation.output ctxt #> Latex.string) #> items #> isabelle ctxt;
   511 
   512 fun pretty_items_source ctxt src prts =
   513   if Config.get ctxt Document_Antiquotation.thy_output_source
   514   then source ctxt src else pretty_items ctxt prts;
   515 
   516 
   517 (* antiquotation variants *)
   518 
   519 local
   520 
   521 fun gen_setup name embedded =
   522   if embedded
   523   then Document_Antiquotation.setup_embedded name
   524   else Document_Antiquotation.setup name;
   525 
   526 fun gen_antiquotation_pretty name embedded scan f =
   527   gen_setup name embedded scan (fn {context = ctxt, argument = x, ...} => pretty ctxt (f ctxt x));
   528 
   529 fun gen_antiquotation_pretty_source name embedded scan f =
   530   gen_setup name embedded scan
   531     (fn {context = ctxt, source = src, argument = x} => pretty_source ctxt src (f ctxt x));
   532 
   533 fun gen_antiquotation_raw name embedded scan f =
   534   gen_setup name embedded scan (fn {context = ctxt, argument = x, ...} => f ctxt x);
   535 
   536 fun gen_antiquotation_verbatim name embedded scan f =
   537   gen_antiquotation_raw name embedded scan (fn ctxt => verbatim ctxt o f ctxt);
   538 
   539 in
   540 
   541 fun antiquotation_pretty name = gen_antiquotation_pretty name false;
   542 fun antiquotation_pretty_embedded name = gen_antiquotation_pretty name true;
   543 
   544 fun antiquotation_pretty_source name = gen_antiquotation_pretty_source name false;
   545 fun antiquotation_pretty_source_embedded name = gen_antiquotation_pretty_source name true;
   546 
   547 fun antiquotation_raw name = gen_antiquotation_raw name false;
   548 fun antiquotation_raw_embedded name = gen_antiquotation_raw name true;
   549 
   550 fun antiquotation_verbatim name = gen_antiquotation_verbatim name false;
   551 fun antiquotation_verbatim_embedded name = gen_antiquotation_verbatim name true;
   552 
   553 end;
   554 
   555 end;