src/Pure/ML/ml_antiquote.ML
changeset 35396 041bb8d18916
parent 35361 4c7c849b70aa
child 35401 bfcbab8592ba
equal deleted inserted replaced
35395:ba804f4c82c6 35396:041bb8d18916
    71     "Theory.check_thy (ThyInfo.theory " ^ ML_Syntax.print_string name ^ ")")
    71     "Theory.check_thy (ThyInfo.theory " ^ ML_Syntax.print_string name ^ ")")
    72   || Scan.succeed "Theory.check_thy (ML_Context.the_global_context ())");
    72   || Scan.succeed "Theory.check_thy (ML_Context.the_global_context ())");
    73 
    73 
    74 val _ = value "context" (Scan.succeed "ML_Context.the_local_context ()");
    74 val _ = value "context" (Scan.succeed "ML_Context.the_local_context ()");
    75 
    75 
    76 val _ = inline "sort" (Args.context -- Scan.lift Args.name_source >> (fn (ctxt, s) =>
       
    77   ML_Syntax.atomic (ML_Syntax.print_sort (Syntax.read_sort ctxt s))));
       
    78 
       
    79 val _ = inline "typ" (Args.typ >> (ML_Syntax.atomic o ML_Syntax.print_typ));
    76 val _ = inline "typ" (Args.typ >> (ML_Syntax.atomic o ML_Syntax.print_typ));
    80 val _ = inline "term" (Args.term >> (ML_Syntax.atomic o ML_Syntax.print_term));
    77 val _ = inline "term" (Args.term >> (ML_Syntax.atomic o ML_Syntax.print_term));
    81 val _ = inline "prop" (Args.prop >> (ML_Syntax.atomic o ML_Syntax.print_term));
    78 val _ = inline "prop" (Args.prop >> (ML_Syntax.atomic o ML_Syntax.print_term));
    82 
    79 
    83 val _ = macro "let" (Args.context --
    80 val _ = macro "let" (Args.context --
    99   "Thm.cterm_of (ML_Context.the_global_context ()) " ^ ML_Syntax.atomic (ML_Syntax.print_term t)));
    96   "Thm.cterm_of (ML_Context.the_global_context ()) " ^ ML_Syntax.atomic (ML_Syntax.print_term t)));
   100 
    97 
   101 val _ = value "cpat"
    98 val _ = value "cpat"
   102   (Args.context -- Scan.lift Args.name_source >> uncurry ProofContext.read_term_pattern >> (fn t =>
    99   (Args.context -- Scan.lift Args.name_source >> uncurry ProofContext.read_term_pattern >> (fn t =>
   103     "Thm.cterm_of (ML_Context.the_global_context ()) " ^ ML_Syntax.atomic (ML_Syntax.print_term t)));
   100     "Thm.cterm_of (ML_Context.the_global_context ()) " ^ ML_Syntax.atomic (ML_Syntax.print_term t)));
       
   101 
       
   102 
       
   103 (* type classes *)
       
   104 
       
   105 fun class syn = Args.theory -- Scan.lift Args.name_source >> (fn (thy, s) =>
       
   106   Sign.read_class thy s
       
   107   |> syn ? Long_Name.base_name   (* FIXME authentic syntax *)
       
   108   |> ML_Syntax.print_string);
       
   109 
       
   110 val _ = inline "class" (class false);
       
   111 val _ = inline "class_syntax" (class true);
       
   112 
       
   113 val _ = inline "sort" (Args.context -- Scan.lift Args.name_source >> (fn (ctxt, s) =>
       
   114   ML_Syntax.atomic (ML_Syntax.print_sort (Syntax.read_sort ctxt s))));
   104 
   115 
   105 
   116 
   106 (* type constructors *)
   117 (* type constructors *)
   107 
   118 
   108 fun type_const kind check = Args.context -- Scan.lift Args.name_source >> (fn (ctxt, c) =>
   119 fun type_const kind check = Args.context -- Scan.lift Args.name_source >> (fn (ctxt, c) =>