# HG changeset patch # User wenzelm # Date 1409225112 -7200 # Node ID d6f29bf9b783067e5b82df402be393cbab9e0b05 # Parent a7a0af6434993e5fc4d99fe69ec2c89bbe3d2ef1 intern xthm only once; diff -r a7a0af643499 -r d6f29bf9b783 src/Pure/Isar/method.ML --- a/src/Pure/Isar/method.ML Thu Aug 28 07:34:23 2014 +0200 +++ b/src/Pure/Isar/method.ML Thu Aug 28 13:25:12 2014 +0200 @@ -462,38 +462,35 @@ local fun sect (modifier : modifier parser) = Scan.depend (fn context => - let - val ctxt = Context.proof_of context; - fun prep_att src = + Scan.ahead Parse.not_eof -- modifier -- Scan.repeat (Scan.unless modifier Parse.xthm) >> + (fn ((tok, {init, attribute, pos}), xthms) => let - val src' = Attrib.check_src ctxt src; - val _ = List.app (Token.assign NONE) (Token.args_of_src src'); - in src' end; - val parse_thm = - Parse.xthm >> (fn (a, bs) => (Proof_Context.get_fact ctxt a, map prep_att bs)); - in - Scan.ahead Parse.not_eof -- modifier -- Scan.repeat (Scan.unless modifier parse_thm) >> - (fn ((tok, {init, attribute, pos}), thms) => - let - val decl = - (case Token.get_value tok of - SOME (Token.Declaration decl) => decl - | _ => - let - val facts = - Attrib.partial_evaluation ctxt [((Binding.name "dummy", []), thms)] - |> map (fn (_, bs) => ((Binding.empty, [Attrib.internal (K attribute)]), bs)); - val _ = - Context_Position.report ctxt (Token.pos_of tok) - (Markup.entity Markup.method_modifierN "" - |> Markup.properties (Position.def_properties_of pos)); - fun decl phi = - Context.mapping I init #> - Attrib.generic_notes "" (Attrib.transform_facts phi facts) #> snd; - val _ = Token.assign (SOME (Token.Declaration decl)) tok; - in decl end); - in (Morphism.form decl context, decl) end) - end); + val decl = + (case Token.get_value tok of + SOME (Token.Declaration decl) => decl + | _ => + let + val ctxt = Context.proof_of context; + fun prep_att src = + let + val src' = Attrib.check_src ctxt src; + val _ = List.app (Token.assign NONE) (Token.args_of_src src'); + in src' end; + val thms = + map (fn (a, bs) => (Proof_Context.get_fact ctxt a, map prep_att bs)) xthms; + val facts = + Attrib.partial_evaluation ctxt [((Binding.name "dummy", []), thms)] + |> map (fn (_, bs) => ((Binding.empty, [Attrib.internal (K attribute)]), bs)); + val _ = + Context_Position.report ctxt (Token.pos_of tok) + (Markup.entity Markup.method_modifierN "" + |> Markup.properties (Position.def_properties_of pos)); + fun decl phi = + Context.mapping I init #> + Attrib.generic_notes "" (Attrib.transform_facts phi facts) #> snd; + val _ = Token.assign (SOME (Token.Declaration decl)) tok; + in decl end); + in (Morphism.form decl context, decl) end)); in