src/Pure/ML/ml_antiquote.ML
changeset 42290 b1f544c84040
parent 41486 82c1e348bc18
child 42298 d622145603ee
equal deleted inserted replaced
42289:dafae095d733 42290:b1f544c84040
   103 
   103 
   104 (* type classes *)
   104 (* type classes *)
   105 
   105 
   106 fun class syn = Args.context -- Scan.lift Args.name_source >> (fn (ctxt, s) =>
   106 fun class syn = Args.context -- Scan.lift Args.name_source >> (fn (ctxt, s) =>
   107   ProofContext.read_class ctxt s
   107   ProofContext.read_class ctxt s
   108   |> syn ? Syntax.mark_class
   108   |> syn ? Lexicon.mark_class
   109   |> ML_Syntax.print_string);
   109   |> ML_Syntax.print_string);
   110 
   110 
   111 val _ = inline "class" (class false);
   111 val _ = inline "class" (class false);
   112 val _ = inline "class_syntax" (class true);
   112 val _ = inline "class_syntax" (class true);
   113 
   113 
   129     in ML_Syntax.print_string res end);
   129     in ML_Syntax.print_string res end);
   130 
   130 
   131 val _ = inline "type_name" (type_name "logical type" (fn (c, Type.LogicalType _) => c));
   131 val _ = inline "type_name" (type_name "logical type" (fn (c, Type.LogicalType _) => c));
   132 val _ = inline "type_abbrev" (type_name "type abbreviation" (fn (c, Type.Abbreviation _) => c));
   132 val _ = inline "type_abbrev" (type_name "type abbreviation" (fn (c, Type.Abbreviation _) => c));
   133 val _ = inline "nonterminal" (type_name "nonterminal" (fn (c, Type.Nonterminal) => c));
   133 val _ = inline "nonterminal" (type_name "nonterminal" (fn (c, Type.Nonterminal) => c));
   134 val _ = inline "type_syntax" (type_name "type" (fn (c, _) => Syntax.mark_type c));
   134 val _ = inline "type_syntax" (type_name "type" (fn (c, _) => Lexicon.mark_type c));
   135 
   135 
   136 
   136 
   137 (* constants *)
   137 (* constants *)
   138 
   138 
   139 fun const_name check = Args.context -- Scan.lift (Parse.position Args.name_source)
   139 fun const_name check = Args.context -- Scan.lift (Parse.position Args.name_source)
   144         handle TYPE (msg, _, _) => error (msg ^ Position.str_of pos);
   144         handle TYPE (msg, _, _) => error (msg ^ Position.str_of pos);
   145     in ML_Syntax.print_string res end);
   145     in ML_Syntax.print_string res end);
   146 
   146 
   147 val _ = inline "const_name" (const_name (fn (consts, c) => (Consts.the_type consts c; c)));
   147 val _ = inline "const_name" (const_name (fn (consts, c) => (Consts.the_type consts c; c)));
   148 val _ = inline "const_abbrev" (const_name (fn (consts, c) => (Consts.the_abbreviation consts c; c)));
   148 val _ = inline "const_abbrev" (const_name (fn (consts, c) => (Consts.the_abbreviation consts c; c)));
   149 val _ = inline "const_syntax" (const_name (fn (_, c) => Syntax.mark_const c));
   149 val _ = inline "const_syntax" (const_name (fn (_, c) => Lexicon.mark_const c));
   150 
   150 
   151 
   151 
   152 val _ = inline "syntax_const"
   152 val _ = inline "syntax_const"
   153   (Args.context -- Scan.lift (Parse.position Args.name) >> (fn (ctxt, (c, pos)) =>
   153   (Args.context -- Scan.lift (Parse.position Args.name) >> (fn (ctxt, (c, pos)) =>
   154     if Syntax.is_const (ProofContext.syn_of ctxt) c then ML_Syntax.print_string c
   154     if Syntax.is_const (ProofContext.syn_of ctxt) c then ML_Syntax.print_string c