11 end |
11 end |
12 |
12 |
13 structure SPARK_Commands: SPARK_COMMANDS = |
13 structure SPARK_Commands: SPARK_COMMANDS = |
14 struct |
14 struct |
15 |
15 |
16 (* FIXME proper Thy_Load.use_file, also for fdl_path and rls_path (!?) *) |
16 fun spark_open header (prfx, files) thy = |
17 fun spark_open (vc_name, prfx) thy = |
17 let |
|
18 val ([{src_path, text = vc_text, pos = vc_pos, ...}, |
|
19 {text = fdl_text, pos = fdl_pos, ...}, |
|
20 {text = rls_text, pos = rls_pos, ...}], thy') = files thy; |
|
21 val base = fst (Path.split_ext (File.full_path (Thy_Load.master_directory thy') src_path)); |
|
22 in |
|
23 SPARK_VCs.set_vcs |
|
24 (snd (Fdl_Parser.parse_declarations fdl_pos fdl_text)) |
|
25 (Fdl_Parser.parse_rules rls_pos rls_text) |
|
26 (snd (Fdl_Parser.parse_vcs header vc_pos vc_text)) |
|
27 base prfx thy' |
|
28 end; |
|
29 |
|
30 (* FIXME *) |
|
31 fun spark_open_old (vc_name, prfx) thy = |
18 let |
32 let |
19 val ((vc_path, vc_id), vc_text) = Thy_Load.load_file thy (Path.explode vc_name); |
33 val ((vc_path, vc_id), vc_text) = Thy_Load.load_file thy (Path.explode vc_name); |
20 val (base, header) = |
34 val (base, header) = |
21 (case Path.split_ext vc_path of |
35 (case Path.split_ext vc_path of |
22 (base, "vcg") => (base, Fdl_Lexer.vcg_header >> K ()) |
36 (base, "vcg") => (base, Fdl_Lexer.vcg_header >> K ()) |
105 end); |
119 end); |
106 |
120 |
107 val _ = |
121 val _ = |
108 Outer_Syntax.command @{command_spec "spark_open"} |
122 Outer_Syntax.command @{command_spec "spark_open"} |
109 "open a new SPARK environment and load a SPARK-generated .vcg or .siv file" |
123 "open a new SPARK environment and load a SPARK-generated .vcg or .siv file" |
110 (Parse.name -- Parse.parname >> (Toplevel.theory o spark_open)); |
124 (Parse.name -- Parse.parname >> (Toplevel.theory o spark_open_old)); |
|
125 |
|
126 val _ = |
|
127 Outer_Syntax.command @{command_spec "spark_open_vcg"} |
|
128 "open a new SPARK environment and load a SPARK-generated .vcg file" |
|
129 (Parse.parname -- Thy_Load.provide_parse_files "spark_open_vcg" |
|
130 >> (Toplevel.theory o spark_open Fdl_Lexer.vcg_header)); |
|
131 |
|
132 val _ = |
|
133 Outer_Syntax.command @{command_spec "spark_open_siv"} |
|
134 "open a new SPARK environment and load a SPARK-generated .siv file" |
|
135 (Parse.parname -- Thy_Load.provide_parse_files "spark_open_siv" |
|
136 >> (Toplevel.theory o spark_open Fdl_Lexer.siv_header)); |
111 |
137 |
112 val pfun_type = Scan.option |
138 val pfun_type = Scan.option |
113 (Args.parens (Parse.list1 Parse.name) --| Args.colon -- Parse.name); |
139 (Args.parens (Parse.list1 Parse.name) --| Args.colon -- Parse.name); |
114 |
140 |
115 val _ = |
141 val _ = |