src/HOLCF/Tools/fixrec.ML
changeset 40096 4d1a8fa8cdfd
parent 40041 1f09b4c7b85e
child 40327 1dfdbd66093a
equal deleted inserted replaced
40095:5325a062ff53 40096:4d1a8fa8cdfd
   391 
   391 
   392 (*************************************************************************)
   392 (*************************************************************************)
   393 (******************************** Parsers ********************************)
   393 (******************************** Parsers ********************************)
   394 (*************************************************************************)
   394 (*************************************************************************)
   395 
   395 
       
   396 val opt_thm_name' : (bool * Attrib.binding) parser =
       
   397   Parse.$$$ "(" -- Parse.$$$ "unchecked" -- Parse.$$$ ")" >> K (true, Attrib.empty_binding)
       
   398     || Parse_Spec.opt_thm_name ":" >> pair false;
       
   399 
       
   400 val spec' : (bool * (Attrib.binding * string)) parser =
       
   401   opt_thm_name' -- Parse.prop >> (fn ((a, b), c) => (a, (b, c)));
       
   402 
   396 val alt_specs' : (bool * (Attrib.binding * string)) list parser =
   403 val alt_specs' : (bool * (Attrib.binding * string)) list parser =
   397   Parse.enum1 "|"
   404   let val unexpected = Scan.ahead (Parse.name || Parse.$$$ "[" || Parse.$$$ "(");
   398     (Parse.opt_keyword "unchecked" -- Parse_Spec.spec --|
   405   in Parse.enum1 "|" (spec' --| Scan.option (unexpected -- Parse.!!! (Parse.$$$ "|"))) end;
   399       Scan.option (Scan.ahead (Parse.name || Parse.$$$ "[") -- Parse.!!! (Parse.$$$ "|")));
       
   400 
   406 
   401 val _ =
   407 val _ =
   402   Outer_Syntax.local_theory "fixrec" "define recursive functions (HOLCF)" Keyword.thy_decl
   408   Outer_Syntax.local_theory "fixrec" "define recursive functions (HOLCF)" Keyword.thy_decl
   403     (Parse.fixes -- (Parse.where_ |-- Parse.!!! alt_specs')
   409     (Parse.fixes -- (Parse.where_ |-- Parse.!!! alt_specs')
   404       >> (fn (fixes, specs) => add_fixrec_cmd fixes specs));
   410       >> (fn (fixes, specs) => add_fixrec_cmd fixes specs));