src/Pure/Thy/term_style.ML
changeset 33184 de8cc01e8d9e
parent 32891 d403b99287ff
child 33522 737589bb9bb8
equal deleted inserted replaced
33176:d6936fd7cda8 33184:de8cc01e8d9e
    52 val parse = Args.context :|-- (fn ctxt => Scan.lift 
    52 val parse = Args.context :|-- (fn ctxt => Scan.lift 
    53   (Args.parens (parse_single ctxt ::: Scan.repeat (Args.$$$ "," |-- parse_single ctxt))
    53   (Args.parens (parse_single ctxt ::: Scan.repeat (Args.$$$ "," |-- parse_single ctxt))
    54       >> fold I
    54       >> fold I
    55   || Scan.succeed I));
    55   || Scan.succeed I));
    56 
    56 
    57 val parse_bare = Args.context :|-- (fn ctxt => Scan.lift Args.liberal_name
    57 val parse_bare = Args.context :|-- (fn ctxt => (Output.legacy_feature "Old-style antiquotation style.";
       
    58   Scan.lift Args.liberal_name
    58   >> (fn name => fst (Args.context_syntax "style"
    59   >> (fn name => fst (Args.context_syntax "style"
    59        (Scan.lift (the_style (ProofContext.theory_of ctxt) name))
    60        (Scan.lift (the_style (ProofContext.theory_of ctxt) name))
    60           (Args.src (("style", []), Position.none)) ctxt |>> (fn f => f ctxt))));
    61           (Args.src (("style", []), Position.none)) ctxt |>> (fn f => f ctxt)))));
    61 
    62 
    62 
    63 
    63 (* predefined styles *)
    64 (* predefined styles *)
    64 
    65 
    65 fun style_lhs_rhs proj = Scan.succeed (fn ctxt => fn t =>
    66 fun style_lhs_rhs proj = Scan.succeed (fn ctxt => fn t =>
    82   end);
    83   end);
    83 
    84 
    84 fun style_parm_premise i = Scan.succeed (fn ctxt => fn t =>
    85 fun style_parm_premise i = Scan.succeed (fn ctxt => fn t =>
    85   let
    86   let
    86     val i_str = string_of_int i;
    87     val i_str = string_of_int i;
       
    88     val _ = Output.legacy_feature (quote ("prem" ^ i_str)
       
    89       ^ " term style encountered; use explicit argument syntax "
       
    90       ^ quote ("prem " ^ i_str) ^ " instead.");
    87     val prems = Logic.strip_imp_prems t;
    91     val prems = Logic.strip_imp_prems t;
    88   in
    92   in
    89     if i <= length prems then nth prems (i - 1)
    93     if i <= length prems then nth prems (i - 1)
    90     else error ("Not enough premises for prem" ^ string_of_int i ^
    94     else error ("Not enough premises for prem" ^ i_str ^
    91       " in propositon: " ^ Syntax.string_of_term ctxt t)
    95       " in propositon: " ^ Syntax.string_of_term ctxt t)
    92   end);
    96   end);
    93 
    97 
    94 val _ = Context.>> (Context.map_theory
    98 val _ = Context.>> (Context.map_theory
    95  (setup "lhs" (style_lhs_rhs fst) #>
    99  (setup "lhs" (style_lhs_rhs fst) #>