use sim_kernel::{Cx, Result, Symbol};
use sim_lib_standard_core::{
LanguageProfile, OrganUse, ProfileRegistry, fidelity_badge, install_language_profile,
};
use crate::{
lua_conformance_test_symbol, lua_control_fidelity_symbol, lua_full_runtime_fidelity_symbol,
lua_lowering_symbol, lua_mutation_fidelity_symbol, lua_profile_symbol, lua_reader_symbol,
};
pub fn lua_core_profile() -> LanguageProfile {
let profile = lua_profile_symbol();
let test = lua_conformance_test_symbol();
LanguageProfile::new(profile.clone())
.with_reader(lua_reader_symbol())
.with_lowering(lua_lowering_symbol())
.with_eval_policy(Symbol::qualified("eval", "lua-core"))
.with_organ(OrganUse::new(sim_lib_control::control_organ_symbol()))
.with_organ(OrganUse::new(sim_lib_mutation::mutation_organ_symbol()))
.requiring(sim_lib_mutation::standard_mutate_capability())
.with_unsupported_form(Symbol::qualified("lua", "full-vm-debug-hooks"))
.with_conformance_test(test.clone())
.with_fidelity_badge(fidelity_badge(
&profile,
lua_control_fidelity_symbol(),
1,
&test,
))
.with_fidelity_badge(fidelity_badge(
&profile,
lua_mutation_fidelity_symbol(),
1,
&test,
))
.with_fidelity_badge(fidelity_badge(
&profile,
lua_full_runtime_fidelity_symbol(),
0,
&test,
))
}
pub fn install_lua_core_profile(
cx: &mut Cx,
registry: &mut ProfileRegistry,
) -> Result<LanguageProfile> {
install_language_profile(
cx,
registry,
lua_core_profile(),
&[
sim_lib_control::publish_control_organ_claims_for_lib,
sim_lib_mutation::publish_mutation_organ_claims_for_lib,
],
)
}