Skip to content

Commit

Permalink
update trim and cross-check operands
Browse files Browse the repository at this point in the history
  • Loading branch information
Linda-Njau committed Jul 27, 2024
1 parent 300079a commit cdb1352
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/sail_json_backend/json.ml
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,18 @@ let extract_operands k regex components =
| hd :: tl ->
if Str.string_match regex hd 0 then (
let operand = Str.matched_group 1 hd in
let trimmed =
try
let comma_index = String.index operand ',' in
debug_print ("Operand before trimming: " ^ operand);
let trimmed_operand = String.sub operand 0 comma_index in
debug_print ("Final trimmed operand: " ^ trimmed_operand);
trimmed_operand
with Not_found -> operand
in
try
let comma_index = String.index operand ',' in
debug_print ("Operand before trimming: " ^ operand);
let trimmed = String.sub operand 0 comma_index in
debug_print ("Final trimmed operand: " ^ trimmed);
let inputl = Hashtbl.find inputs k in
if List.mem trimmed inputl then aux (trimmed :: acc) tl else aux acc tl
if List.mem operand inputl || List.mem trimmed inputl then aux (trimmed :: acc) tl else aux acc tl
with Not_found -> aux (operand :: acc) tl
)
else aux acc tl
Expand Down

0 comments on commit cdb1352

Please sign in to comment.