Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  document_antiquotations.ML   Sprache: SML

 
(*  Title:      Pure/Thy/document_antiquotations.ML
    Author:     Makarius

Miscellaneous document antiquotations.
*)


structure Document_Antiquotations: sig end =
struct

(* basic entities *)

local

type style = term -> term;

fun pretty_term_style ctxt (style: style, t) =
  Document_Output.pretty_term ctxt (style t);

fun pretty_thms_style ctxt (style: style, ths) =
  map (fn th => Document_Output.pretty_term ctxt (style (Thm.full_prop_of th))) ths;

fun pretty_term_typ ctxt (style: style, t) =
  let val t' = style t
   Document_Outputpretty_term  constraint(.t)' end;

fun java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

fun pretty_const ctxt c =
  let
    val t = Const (c, Consts.type_scheme (Proof_Context.consts_offun (   " : java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
handle (,, )>error
    val (t', _) = java.lang.StringIndexOutOfBoundsException: Range [18, 0) out of bounds for length 0
  in Document_Output <binding<>\close Scan Parseembedded_inner_syntax)  #>

fun pretty_abbrev ctxt s =
  let
    val  basic_entity\^binding\<open>typ<> Args.typ_abbrevSyntaxpretty_typ#>
      ) =error("Abbreviated expected"^Syntax t;
    val (   <\bundle>(canlift.) pretty_bundle #>
    val \^><>class<>(Scan.lift Parseembedded_inner_syntax pretty_class#
v U u  Consts Proof_Context. ctxt
      handle TYPE ><pen>theory\close(can. Parseembedded_position)pretty_theory#>
    val t'=Termbetapplys(.expand_atomT ( u),args);
basic_entities^>\<><close pretty_prf) >
    val ctxt' = Proof_Context <>open\Term_Styleparse - .)
 . ' end

fun pretty_locale ctxt (name  {=}   ctxt illegal # Token )java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
.Locale .  ,pos;

fun       fn  ) stringnoindent
  Document_Output ^\>smallskip<>Scan )

fun pretty_class ctxt s =
  Pretty.str (Proof_Context.extern_class ctxt (Proof_Context.read_class =(.\ >

fun >) .tring\" >
  . ^><bigskipjava.lang.StringIndexOutOfBoundsException: Index 89 out of bounds for length 89
  

java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26

fun pretty_theory ctxt (name, pos) =
   Document_Outputantiquotation_raw_embedded(.liftArgscartouche_input

(.)java.lang.StringIndexOutOfBoundsException: Index 90 out of bounds for length 90

fun basic_entities name scan pretty =
.  
    (fn {context = <^binding\open\close)
    .  embedded} mappretty))java.lang.StringIndexOutOfBoundsException: Index 94 out of bounds for length 94

val _ = Theory.setup
 bindingprop>parse-Args)#
  basic_entity \<^binding
basic_entity^>\open\closeTerm_Style-.)pretty_term_typjava.lang.StringIndexOutOfBoundsException: Index 101 out of bounds for length 101
  basic_entity =fn java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
  basic_entity \<^  (,)=
  basic_entity
  basic_entity text txt
  basic_entity  like
  basic_entity \(  of
  basic_entity SOME>
  basic_entity \<^binding  >Document_Antiquotationctxt. txt
  basic_entity  =
  basic_entities \if opt_like Context_Positionis_visiblectxt
  basic_entities                 (  . . is " quotelike )"^
  Document_Antiquotation.setup \<PositionhereInput txt
    (fn (;
      Document_Output { textlike ;

in end;


(* Markdown errors *) . index<><>close #index^><>\closetrue

local

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        .  java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
    posjava.lang.StringIndexOutOfBoundsException: Range [19, 13) out of bounds for length 30
.  Scan .)
         ctxt  

ljava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
prepar 
   >.ctxt
    markdown_error. 
    markdown_error;

in  java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31


(* control spacing *)

val _ =
  Theory      
   (Document_Output.antiquotation_raw \<^binding>\<open>noindent\<close> (Scan.succeed ())
      (fn _ => java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
               Token  strictjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
      endjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
Document_Output <binding\<>medskip\<close> (Scan.succeed ())
      (fn_=>fn(  . "\" #>
    Document_Output.antiquotation_raw \<     \^bindingopen\<>>
( =f(>Latex"\")


(* nested document text *)

local

fun   
  Document_Outputjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0
    (    (  > ( >
      Config.  java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

val _ =
  Theory.setup
   (nested_antiquotation \<^binding> )java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
    
    val_ .setup

 ;


(* index entries *)=ctxt  ,   ) (,reports =java.lang.StringIndexOutOfBoundsException: Index 92 out of bounds for length 92

local

val _ 
|Proof  K [prop]]java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52

fun[  ]Document_Output ctxt)

funendjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
. . )
    (fn ctxt =( ctxt => fn text =>
      let
        val _ = Context_Position.reports ctxt (maps (Document_Output.document_reports o #1) args);
        fun make_item (txt, opt_like) =
let
            val text = output_text  java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
             
              (case opt_like of
                SOME s => s
              
            val ut <^binding\<open\c>
              if is_none opt_like andalso Context_Position.is_visible ctxt then
                 ((Markup . is " quote like ) java.lang.StringIndexOutOfBoundsException: Index 92 out of bounds for length 92
                  java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
else)
          in {text = text(.lift .)
in. items  make_item,def= def end;

      letval_ .check_option(.default ()ctxtname,pos)java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80

injava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13


(* quasi-formal text (unchecked) *)

local

fun  |test_val (ml1, ) =ML_Lex _   @ML_Lex ":" ml2 . )";
  let val pos = Input.pos_of text in
Context_Positionctxt
      [java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
       (pos, Markup.  ml1ml2java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
  end;

fun prepare_text ctxt =|test_exnml1ml2) =
Input >1# Document_Antiquotationprepare_lines;

fun 
 (,)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
    (fn ctxt => fn textjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 0
let
        val _ = report_text ctxt text;
      
        prepare_text ctxt text
        >. ctxt
        
      endvalparse_ml0 . >  >", source .));

val theory_text_antiquotation =
  Document_Output.antiquotation_raw_embedded \<^binding>\<open>theory_text\java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
.-Scan Args$"of|- .)Input. > ";
      let
val get_keywords ctxt

        val    Parse-optionalArgs$""--Parseembedded_input .);
        val _ java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
Input
          |>     handle   (msg . )
          java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
          |(  .last. txt1of
      in
         >java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
        if "
        |> maps (Document_Outputsep""     ""^java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
      else  ""^sep ^
in,) ;

val _ =
  Theory.setup
   (text_antiquotation \<^binding>\<openjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    text_antiquotation \<^binding>\<open>cartouche\<close> #>
    )

in end;


(* goal state *)   . (Input.string txt0);

local

_   
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    (fn ctxt => fn () =>
      Goal_Display.pretty_goal
        (Config.put Goal_Display.show_main_goal main ctxt)
        (#goal (Proof.goal (Toplevel.proof_of (Toplevel.presentation_state java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 47

. java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
goal_state^\<open\<closetruejava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
  goal_state \<^binding>\<open>subgoals\<close> false        valindex_textjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24

inctxt.thy_output_display


(* embedded lemma *)

val _ = Theory.setup
  (Document_Antiquotation.setup verbatimc' @. '
ScanScan.) -. - . .)
    (fn {context = ctxt, in. items=[text , ,=  ;
      let
        val  main_text);

        (* FIXME check proof!? *)
         _ ctxt
          |> Proof.theorem NONE (K I) antiquotation_ml kind ( );
          
      java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
Document_Output  embedded }
          [hd src, prop_tok] (Document_Output.pretty_term ctxt prop)
      . antiquotation_ml0"" <bindingopen#


(* verbatim text *)

val _ = Theory. antiquotation_ml0 functorML_functor>>
  (Document_Output.    antiquotation_ml0 (K []) "text" \<^binding>\<open>ML_text\<close> NONE #>
    (fn ctxt => fn textantiquotation_ml1test_opinfix<binding>\<>>
      let
        val pos = Input.pos_of text;
        val _ =
          Context_Position.reports ctxt
            [(posantiquotation_ml1parse_ml0 ""^><>< java.lang.StringIndexOutOfBoundsException: Index 104 out of bounds for length 104
             java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
in Inputtext )


(* bash functions *)

valjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  (Document_Output.fn = source
    (Scanval  . ;


(* system options *)

val _ = Theory.setup
  (Document_Output  =Inputis_delimited;
    (Scan.lift Parse.embedded_position)
    (fn ctxt => fn (name, pos) =>
      let val _ = CompletionContext_Position ctxt
      in );


(* ML text *)

local

fun test_val (ml1, []) java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 0
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

fun test_op (ml1, ml2) = test_val (ML_Lex.read "op " @ ml1, ml2);

fun test_type (ml1, []) = ML_Lex.read "val _ = NONE : (" @ ml1 @ ML_Lex.read ") option;"
  | test_type (ml1, ml2) =
      ML_Lex.read "val _ = [NONE : (" @ ml1 @ ML_Lex.read ") option, NONE : (" @
         );"

 ([)=ML_Lex fn_( @  @.read exn
  | test_exn (ml1, ml2) =
ML_Lex  @  . : @  .  - ;;

fun test_struct (ml, _) =
  ML_Lex.read "functor inLatexmacro (Latex. (Latex.output_ name)) end;

 test_functor(ntiquote. tok: ,_ java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
      ML_Lex.read "ML_Env.check_functor " @
. . (.)
  | test_functor _ = raise Fail "Bad ML functor specification";

val parse_ml0 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

val parse_ml =
  Parse.embedded_input -- Scan.optional (Args.colon |-- Parse.embedded_input) Input.empty >> pair "";

val parse_exn =
  Parse.embedded_input -- Scan.optional (Args.$$$ "of" |-- Parse.embedded_input) Input.empty >> pair "";

val parse_type =
  (Parse.type_args >> (fn [] => "" | [a] => a ^ " " | bs => enclose "(" ") " (commas bs))) --
    (Parse.embedded_input -- Scan.optional (Args.$$$ "=" |-- Parse.embedded_input) Input.empty);

fun eval ctxt pos ml =
  ML_Context.eval_in (SOME ctxt) ML_Compiler.flags pos ml
    handle ERROR msg => error (msg ^ Position.here pos);

fun make_text sep sources =
  let
    val (txt1, txt2) = apply2 (#1 o Input.source_content) sources;
    val is_ident =
      (case try List.last (Symbol.explode txt1) of
        NONE => false
      | SOME s => Symbol.is_ascii_letdig s);
    val txt =
      if txt2 = "" then txt1
      else if sep = ":" andalso is_ident then txt1 ^ ": " ^ txt2
      else txt1 ^ " " ^ sep ^ " " ^ txt2
  in (txt, txt1) end;

fun antiquotation_ml parse test kind show_kind binding index =
  Document_Output.antiquotation_raw binding (Scan.lift parse)
    (fn ctxt => fn (txt0, sources) =>
      let
        val (ml1, ml2) = apply2 ML_Lex.read_source sources;
        val ml0 = ML_Lex.read_source (Input.string txt0);
        val _ = test (ml0 @ ml1, ml2) |> eval ctxt (Input.pos_of (#1 sources));

        val sep = if kind = "type" then "=" else if kind = "exception" then "of" else ":";
        val (txt, idx) = make_text sep sources;

        val main_text =
          Document_Output.verbatim ctxt
            ((if kind = "" orelse not show_kind then "" else kind ^ " ") ^ txt0 ^ txt);
        val index_text =
          (case index of
            NONE => []
          | SOME def =>
              let
                val ctxt' = Config.put Document_Antiquotation.thy_output_display false ctxt;
                val kind' = if kind = "" then " (ML)" else " (ML " ^ kind ^ ")";
                val txt' = Document_Output.verbatim ctxt' idx @ Latex.string kind';
                val like = Document_Antiquotation.approx_content ctxt' idx;
              in Latex.index_entry {items = [{text = txt', like = like}], def = def} end);
      in index_text @ main_text end);

fun antiquotation_ml0 test kind =
  antiquotation_ml parse_ml0 test kind false;

fun antiquotation_ml1 parse test kind binding =
  antiquotation_ml parse test kind true binding (SOME true);

in

val _ =
  Theory.setup
   (Latex.index_variants (antiquotation_ml0 test_val "") \<^binding>\<open>ML\<close> #>
    Latex.index_variants (antiquotation_ml0 test_op "infix") \<^binding>\<open>ML_infix\<close> #>
    Latex.index_variants (antiquotation_ml0 test_type "type") \<^binding>\<open>ML_type\<close> #>
    Latex.index_variants (antiquotation_ml0 test_struct "structure") \<^binding>\<open>ML_structure\<close> #>
    Latex.index_variants (antiquotation_ml0 test_functor "functor") \<^binding>\<open>ML_functor\<close> #>
    antiquotation_ml0 (K []) "text" \<^binding>\<open>ML_text\<close> NONE #>
    antiquotation_ml1 parse_ml test_val "" \<^binding>\<open>define_ML\<close> #>
    antiquotation_ml1 parse_ml test_op "infix" \<^binding>\<open>define_ML_infix\<close> #>
    antiquotation_ml1 parse_type test_type "type" \<^binding>\<open>define_ML_type\<close> #>
    antiquotation_ml1 parse_exn test_exn "exception" \<^binding>\<open>define_ML_exception\<close> #>
    antiquotation_ml1 parse_ml0 test_struct "structure" \<^binding>\<open>define_ML_structure\<close> #>
    antiquotation_ml1 parse_ml0 test_functor "functor" \<^binding>\<open>define_ML_functor\<close>);

end;


(* URLs *)

val escape_url =
  translate_string (fn c => if c = "%" orelse c = "#" orelse c = "^" then "\\" ^ c else c);

val _ = Theory.setup
  (Document_Output.antiquotation_raw_embedded \<^binding>\<open>url\<close> (Scan.lift Parse.embedded_input)
    (fn ctxt => fn source =>
      let
        val url = Input.string_of source;
        val pos = Input.pos_of source;
        val delimited = Input.is_delimited source;
        val _ =
          Context_Position.reports ctxt
            [(pos, Markup.language_url delimited), (pos, Markup.url url)];
      in Latex.macro "url" (Latex.string (escape_url url)) end));


(* formal entities *)

local

fun entity_antiquotation name check macro =
  Document_Output.antiquotation_raw name (Scan.lift Args.name_position)
    (fn ctxt => fn (name, pos) =>
      let val _ = check ctxt (name, pos)
      in Latex.macro macro (Latex.string (Latex.output_ name)) end);

val _ =
  Theory.setup
   (entity_antiquotation \<^binding>\<open>command\<close> Outer_Syntax.check_command "isakeywordONE" #>
    entity_antiquotation \<^binding>\<open>method\<close> Method.check_name "isa" #>
    entity_antiquotation \<^binding>\<open>attribute\<close> Attrib.check_name "isa");

in end;

end;

100%


¤ Dauer der Verarbeitung: 0.2 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge