Make most top-level modules in KCL private (#4478)

* Make ast module private

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Make most other modules private

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Expand API to support CLI, Python bindings, and LSP crate

Signed-off-by: Nick Cameron <nrc@ncameron.org>

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2024-11-20 15:19:25 +13:00
committed by GitHub
parent 1a9926be8a
commit d8ce5ad8bd
50 changed files with 568 additions and 646 deletions

View File

@ -1,6 +1,6 @@
use kcl_lib::{
settings::types::UnitLength,
test_server::{execute_and_snapshot, execute_and_snapshot_no_auth},
UnitLength,
};
/// The minimum permissible difference between asserted twenty-twenty images.

View File

@ -1,20 +1,17 @@
use anyhow::Result;
use kcl_lib::{
ast::{
modify::modify_ast_for_sketch,
types::{ModuleId, Node, Program},
},
executor::{ExecutorContext, IdGenerator, KclValue, PlaneType, SourceRange},
exec::{KclValue, PlaneType},
modify_ast_for_sketch, ExecState, ExecutorContext, ModuleId, Program, SourceRange,
};
use kittycad_modeling_cmds::{each_cmd as mcmd, length_unit::LengthUnit, shared::Point3d, ModelingCmd};
use pretty_assertions::assert_eq;
/// Setup the engine and parse code for an ast.
async fn setup(code: &str, name: &str) -> Result<(ExecutorContext, Node<Program>, ModuleId, uuid::Uuid)> {
let module_id = ModuleId::default();
let program = kcl_lib::parser::parse(code, module_id)?;
let ctx = kcl_lib::executor::ExecutorContext::new_with_default_client(Default::default()).await?;
let exec_state = ctx.run(&program, None, IdGenerator::default(), None).await?;
async fn setup(code: &str, name: &str) -> Result<(ExecutorContext, Program, ModuleId, uuid::Uuid)> {
let program = Program::parse(code)?;
let ctx = kcl_lib::ExecutorContext::new_with_default_client(Default::default()).await?;
let mut exec_state = ExecState::default();
ctx.run(&program, &mut exec_state).await?;
// We need to get the sketch ID.
// Get the sketch ID from memory.
@ -56,7 +53,7 @@ async fn setup(code: &str, name: &str) -> Result<(ExecutorContext, Node<Program>
)
.await?;
Ok((ctx, program, module_id, sketch_id))
Ok((ctx, program, ModuleId::default(), sketch_id))
}
#[tokio::test(flavor = "multi_thread")]