From c6f29bbbec5aa1947e5b9dc156c426c8f484db9a Mon Sep 17 00:00:00 2001 From: bjs Date: Sat, 18 May 2024 17:46:14 +0000 Subject: [PATCH] (isla-axiomatic/lib) expose some functions to be consumed by litmus-toml-translator --- isla-axiomatic/src/litmus.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/isla-axiomatic/src/litmus.rs b/isla-axiomatic/src/litmus.rs index 39c20f6..32e0934 100644 --- a/isla-axiomatic/src/litmus.rs +++ b/isla-axiomatic/src/litmus.rs @@ -51,11 +51,11 @@ use crate::page_table; use crate::sandbox::SandboxedCommand; pub mod exp; -mod exp_lexer; +pub mod exp_lexer; mod format; lalrpop_mod!( #[allow(clippy::all)] - exp_parser, + pub exp_parser, "/litmus/exp_parser.rs" ); @@ -498,7 +498,7 @@ pub fn assemble_instruction(instr: &str, isa: &ISAConfig) -> Result( +pub fn parse_constrained_region( toml_region: &Value, symbolic_addrs: &HashMap, ) -> Result, String> { @@ -544,7 +544,7 @@ fn parse_constrained_region( )) } -fn parse_constrained(toml: &Value, symbolic_addrs: &HashMap) -> Result>, String> { +pub fn parse_constrained(toml: &Value, symbolic_addrs: &HashMap) -> Result>, String> { if let Some(value) = toml.get("constrained") { let array = value.as_array().ok_or_else(|| "constrained section must be a TOML array".to_string())?; Ok(array.iter().map(|v| parse_constrained_region(v, symbolic_addrs)).collect::>()?) @@ -553,7 +553,7 @@ fn parse_constrained(toml: &Value, symbolic_addrs: &HashMap) } } -fn parse_locations(litmus_toml: &Value, symbolic_addrs: &HashMap) -> Result, String> { +pub fn parse_locations(litmus_toml: &Value, symbolic_addrs: &HashMap) -> Result, String> { let location_table = match litmus_toml.get("locations") { Some(value) => { value.as_table().ok_or_else(|| "[locations] must be a table of
= pairs".to_string())? @@ -578,7 +578,7 @@ fn parse_locations(litmus_toml: &Value, symbolic_addrs: &HashMap) - Ok(locations) } -fn parse_sizeof_types(litmus_toml: &Value) -> Result, String> { +pub fn parse_sizeof_types(litmus_toml: &Value) -> Result, String> { let sym_types_table = match litmus_toml.get("types") { Some(value) => { value.as_table().ok_or_else(|| "[types] must be a table of
= pairs".to_string())? @@ -602,7 +602,7 @@ fn parse_sizeof_types(litmus_toml: &Value) -> Result, Strin Ok(sym_sizeof) } -fn parse_init( +pub fn parse_init( reg: &str, value: &Value, symbolic_addrs: &HashMap, @@ -783,7 +783,7 @@ impl fmt::Display for PageSetupLocation { } } -fn format_error_page_table_setup(source: &str, error: lalrpop_util::ParseError) -> String +pub fn format_error_page_table_setup(source: &str, error: lalrpop_util::ParseError) -> String where T: fmt::Display, E: fmt::Display,