From f4cb6d53b5746a3a16e15b42a9c8c35f024450b8 Mon Sep 17 00:00:00 2001 From: Linda-Njau <111066204+Linda-Njau@users.noreply.github.com> Date: Wed, 21 Aug 2024 16:25:45 +0300 Subject: [PATCH] Update json_of_name to prioritize mnemonic over AST key (#39) This change ensures that when both AST and mnemonic are annoted for an instruction, the parser will prioritize the mnemonic as the key to retrieve the name from the Hashtbl. If the mnemonic is missing, the parser will fall back to using the AST as the default key. --- src/sail_json_backend/json.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sail_json_backend/json.ml b/src/sail_json_backend/json.ml index 760980758..531ee184f 100644 --- a/src/sail_json_backend/json.ml +++ b/src/sail_json_backend/json.ml @@ -671,8 +671,8 @@ let json_of_function k = let json_of_name k mnemonic = let name = - match Hashtbl.find_opt names k with - | None -> begin match Hashtbl.find_opt names mnemonic with None -> "TBD" | Some s -> String.escaped s end + match Hashtbl.find_opt names mnemonic with + | None -> begin match Hashtbl.find_opt names k with None -> "TBD" | Some s -> String.escaped s end | Some s -> String.escaped s in "\"" ^ name ^ "\""