Skip to content

Commit

Permalink
Update json_of_name to prioritize mnemonic over AST key
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Linda-Njau committed Aug 16, 2024
1 parent 9361db7 commit 1974f5a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sail_json_backend/json.ml
Original file line number Diff line number Diff line change
Expand Up @@ -673,8 +673,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 ^ "\""
Expand Down

0 comments on commit 1974f5a

Please sign in to comment.