Skip to content

Commit bb20cff

Browse files
committed
remove some TODOs
1 parent cf5630f commit bb20cff

File tree

2 files changed

+29
-16
lines changed

2 files changed

+29
-16
lines changed

core/KaSa_rep/export/export.ml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2128,7 +2128,6 @@ functor
21282128
)
21292129
21302130
let enable_or_disable_rule bool working_set_index state =
2131-
(* TODO check if the rule is in the working set *)
21322131
let error = Remanent_state.get_errors state in
21332132
let error, state, changed =
21342133
toggle_working_set_boolean_parameter_in_compilation error bool state
@@ -2141,19 +2140,19 @@ functor
21412140
let error, dynamic, static =
21422141
Reachability.enable_or_disable_rule static dynamic error c_compil
21432142
in
2144-
(* TODO modify dead rules and dead agents *)
2143+
let error, dynamic, state =
2144+
Reachability.export static dynamic error state
2145+
in
21452146
let state =
21462147
Remanent_state.set_reachability_result (static, dynamic) state
21472148
in
21482149
Remanent_state.set_errors error state
2149-
(* TODO maybe necessary to take this from dynamic
2150-
Remanent_state.set_bdu_handler bdu_handler state *)
21512150
| None -> Remanent_state.set_errors error state
21522151
) else
21532152
Remanent_state.set_errors error state
21542153
21552154
let ws_id_from_rule_name _rule_name =
2156-
(*TODO find rule by string*)
2155+
(*TODO find rule by string and check if it is in the working set*)
21572156
Ckappa_sig.working_set_index_of_int 0
21582157
21592158
let enable_rule name =

core/KaSa_rep/main/KaSaIncremental.ml

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,40 @@ type parsed_instruction =
22
| Add of string
33
| Enable_index of bool * int
44
| Enable of bool * string
5-
| Parsing_error
5+
| Parsing_error of string
66

77
let parse_input s =
8+
let parse_enable_label s bool =
9+
match s with
10+
| "" -> Parsing_error "Empty rule name"
11+
| s ->
12+
let fst = String.sub s 0 1 in
13+
if fst = "'" then
14+
if String.sub s (String.length s - 1) 1 = "'" then
15+
Enable (bool, String.sub s 1 (String.length s - 2))
16+
else
17+
Parsing_error "Label quotation marks were not closed"
18+
else (
19+
match int_of_string_opt s with
20+
| None ->
21+
Parsing_error
22+
("Invalid index: " ^ s
23+
^ ". Please put a label inside of quotation marks, e.g. 'label'.")
24+
| Some i -> Enable_index (true, i)
25+
)
26+
in
827
(* ---- ADD ---- *)
928
if String.starts_with ~prefix:"add" s then (
1029
let s = String.trim (String.sub s 3 (String.length s - 3)) in
1130
Add s
1231
) else if String.starts_with ~prefix:"enable" s then (
1332
let s = String.trim (String.sub s 6 (String.length s - 6)) in
14-
match int_of_string_opt s with
15-
| None -> Parsing_error
16-
| Some i -> Enable_index (true, i)
33+
parse_enable_label s true
1734
) else if String.starts_with ~prefix:"disable" s then (
1835
let s = String.trim (String.sub s 7 (String.length s - 7)) in
19-
match int_of_string_opt s with
20-
| None -> Parsing_error
21-
| Some i -> Enable_index (false, i)
36+
parse_enable_label s false
2237
) else
23-
Parsing_error
24-
(*TODO enable 'label' *)
38+
Parsing_error ("Unknown command: " ^ s)
2539

2640
let main () =
2741
let start_time = Sys.time () in
@@ -101,8 +115,8 @@ let main () =
101115
print_endline ("Enabling rule at index " ^ string_of_int i ^ "...")
102116
in
103117
Export_to_KaSa.enable_rule_index i state
104-
| _ ->
105-
print_endline "??";
118+
| Parsing_error s ->
119+
print_endline ("ERROR: Parsing error:" ^ s);
106120
state
107121
in
108122
let error = Export_to_KaSa.get_errors state in

0 commit comments

Comments
 (0)