equal
deleted
inserted
replaced
108 |
108 |
109 fun gen_add_constdefs consts defs args thy = |
109 fun gen_add_constdefs consts defs args thy = |
110 thy |
110 thy |
111 |> consts (map fst args) |
111 |> consts (map fst args) |
112 |> defs (false, map (fn ((c, _, mx), s) => |
112 |> defs (false, map (fn ((c, _, mx), s) => |
113 (((Thm.def_name (Syntax.const_name c mx), s), []), Comment.none)) args); |
113 ((Thm.def_name (Syntax.const_name c mx), s), [])) args); |
114 |
114 |
115 fun add_constdefs args = gen_add_constdefs add_consts IsarThy.add_defs args; |
115 fun add_constdefs args = gen_add_constdefs add_consts IsarThy.add_defs args; |
116 fun add_constdefs_i args = gen_add_constdefs add_consts_i IsarThy.add_defs_i args; |
116 fun add_constdefs_i args = gen_add_constdefs add_consts_i IsarThy.add_defs_i args; |
117 |
117 |
118 |
118 |
120 |
120 |
121 local structure P = OuterParse and K = OuterSyntax.Keyword in |
121 local structure P = OuterParse and K = OuterSyntax.Keyword in |
122 |
122 |
123 val constsP = |
123 val constsP = |
124 OuterSyntax.command "consts" "declare constants (HOLCF)" K.thy_decl |
124 OuterSyntax.command "consts" "declare constants (HOLCF)" K.thy_decl |
125 (Scan.repeat1 (P.const --| P.marg_comment) >> (Toplevel.theory o add_consts)); |
125 (Scan.repeat1 P.const >> (Toplevel.theory o add_consts)); |
126 |
126 |
127 val constdefsP = |
127 val constdefsP = |
128 OuterSyntax.command "constdefs" "declare and define constants (HOLCF)" K.thy_decl |
128 OuterSyntax.command "constdefs" "declare and define constants (HOLCF)" K.thy_decl |
129 (Scan.repeat1 ((P.const --| P.marg_comment) -- (P.term --| P.marg_comment)) |
129 (Scan.repeat1 (P.const -- P.term) >> (Toplevel.theory o add_constdefs)); |
130 >> (Toplevel.theory o add_constdefs)); |
|
131 |
130 |
132 |
131 |
133 val _ = OuterSyntax.add_parsers [constsP, constdefsP]; |
132 val _ = OuterSyntax.add_parsers [constsP, constdefsP]; |
134 |
133 |
135 end; |
134 end; |