diff --git a/src/sail_json_backend/json.ml b/src/sail_json_backend/json.ml index f2cf8c076..659a62ed5 100644 --- a/src/sail_json_backend/json.ml +++ b/src/sail_json_backend/json.ml @@ -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