src/HOL/Boogie/Tools/boogie_commands.ML
changeset 35125 acace7e30357
parent 34181 003333ffa543
child 35323 259931828ecc
equal deleted inserted replaced
35124:33976519c888 35125:acace7e30357
    12 structure Boogie_Commands: BOOGIE_COMMANDS =
    12 structure Boogie_Commands: BOOGIE_COMMANDS =
    13 struct
    13 struct
    14 
    14 
    15 (* commands *)
    15 (* commands *)
    16 
    16 
    17 fun boogie_open (quiet, base_name) thy =
    17 fun boogie_open ((quiet, base_name), offsets) thy =
    18   let
    18   let
    19     val path = Path.explode (base_name ^ ".b2i")
    19     val path = Path.explode (base_name ^ ".b2i")
    20     val _ = File.exists path orelse
    20     val _ = File.exists path orelse
    21       error ("Unable to find file " ^ quote (Path.implode path))
    21       error ("Unable to find file " ^ quote (Path.implode path))
    22     val _ = Boogie_VCs.is_closed thy orelse
    22     val _ = Boogie_VCs.is_closed thy orelse
    23       error ("Found the beginning of a new Boogie environment, " ^
    23       error ("Found the beginning of a new Boogie environment, " ^
    24         "but another Boogie environment is still open.")
    24         "but another Boogie environment is still open.")
    25   in Boogie_Loader.load_b2i (not quiet) path thy end
    25   in Boogie_Loader.load_b2i (not quiet) offsets path thy end
    26 
    26 
    27 
    27 
    28 datatype vc_opts =
    28 datatype vc_opts =
    29   VC_Complete |
    29   VC_Complete |
    30   VC_Take of int list * (bool * string list) option |
    30   VC_Take of int list * (bool * string list) option |
   223 
   223 
   224 fun scan_val n f = Args.$$$ n -- Args.colon |-- f
   224 fun scan_val n f = Args.$$$ n -- Args.colon |-- f
   225 fun scan_arg f = Args.parens f
   225 fun scan_arg f = Args.parens f
   226 fun scan_opt n = Scan.optional (scan_arg (Args.$$$ n >> K true)) false
   226 fun scan_opt n = Scan.optional (scan_arg (Args.$$$ n >> K true)) false
   227 
   227 
       
   228 val vc_offsets = Scan.optional (Args.bracks (OuterParse.list1
       
   229   (OuterParse.string --| Args.colon -- OuterParse.nat))) []
       
   230 
   228 val _ =
   231 val _ =
   229   OuterSyntax.command "boogie_open"
   232   OuterSyntax.command "boogie_open"
   230     "Open a new Boogie environment and load a Boogie-generated .b2i file."
   233     "Open a new Boogie environment and load a Boogie-generated .b2i file."
   231     OuterKeyword.thy_decl
   234     OuterKeyword.thy_decl
   232     (scan_opt "quiet" -- OuterParse.name >> (Toplevel.theory o boogie_open))
   235     (scan_opt "quiet" -- OuterParse.name -- vc_offsets >> 
       
   236       (Toplevel.theory o boogie_open))
   233 
   237 
   234 
   238 
   235 val vc_name = OuterParse.name
   239 val vc_name = OuterParse.name
   236 
   240 
   237 val vc_labels = Scan.repeat1 OuterParse.name
   241 val vc_labels = Scan.repeat1 OuterParse.name