Move tests into simulation (#4487)

Replace wasm-lib integration tests with KCL simulation tests.
This commit is contained in:
Adam Chalmers
2024-11-18 16:20:32 -06:00
committed by GitHub
parent 79e06b3a00
commit 34f019305b
207 changed files with 360969 additions and 233 deletions

View File

@ -1589,6 +1589,8 @@ dependencies = [
"console",
"lazy_static",
"linked-hash-map",
"pest",
"pest_derive",
"regex",
"serde",
"similar",

View File

@ -13,15 +13,7 @@ redo-kcl-stdlib-docs:
EXPECTORATE=overwrite {{cnr}} -p kcl-lib docs::gen_std_tests::test_generate_stdlib
# Create a new KCL deterministic simulation test case.
new-sim-test test_name kcl_program render_to_png="true":
# Each test file gets its own directory. This will contain the KCL program, and its
# snapshotted artifacts (e.g. serialized tokens, serialized ASTs, program memory,
# PNG snapshots, etc).
mkdir kcl/tests/{{test_name}}
echo "{{kcl_program}}" > kcl/tests/{{test_name}}/input.kcl
# Add the various tests for this new test case.
cat kcl/tests/simtest.tmpl | sed "s/TEST_NAME_HERE/{{test_name}}/" | sed "s/RENDER_TO_PNG/{{render_to_png}}/" >> kcl/src/simulation_tests.rs
# Run all the tests for the first time, in the right order.
new-sim-test test_name render_to_png="true":
{{cita}} -p kcl-lib -- tests::{{test_name}}::tokenize
{{cita}} -p kcl-lib -- tests::{{test_name}}::parse
{{cita}} -p kcl-lib -- tests::{{test_name}}::unparse

View File

@ -86,7 +86,7 @@ expectorate = "1.1.0"
handlebars = "6.2.0"
iai = "0.1"
image = { version = "0.25.5", default-features = false, features = ["png"] }
insta = { version = "1.41.1", features = ["json", "filters"] }
insta = { version = "1.41.1", features = ["json", "filters", "redactions"] }
itertools = "0.13.0"
pretty_assertions = "1.4.1"
tokio = { version = "1.40.0", features = ["rt-multi-thread", "macros", "time"] }

View File

@ -39,5 +39,5 @@ const KITT_PROGRAM: &str = include_str!("../../tests/executor/inputs/kittycad_sv
const PIPES_PROGRAM: &str = include_str!("../../tests/executor/inputs/pipes_on_pipes.kcl");
const CUBE_PROGRAM: &str = include_str!("../../tests/executor/inputs/cube.kcl");
const MATH_PROGRAM: &str = include_str!("../../tests/executor/inputs/math.kcl");
const MIKE_STRESS_TEST_PROGRAM: &str = include_str!("../../tests/executor/inputs/mike_stress_test.kcl");
const MIKE_STRESS_TEST_PROGRAM: &str = include_str!("../tests/mike_stress_test/input.kcl");
const LSYSTEM_KOCH_SNOWFLAKE_PROGRAM: &str = include_str!("../../tests/executor/inputs/lsystem.kcl");

View File

@ -28,5 +28,5 @@ const KITT_PROGRAM: &str = include_str!("../../tests/executor/inputs/kittycad_sv
const PIPES_PROGRAM: &str = include_str!("../../tests/executor/inputs/pipes_on_pipes.kcl");
const CUBE_PROGRAM: &str = include_str!("../../tests/executor/inputs/cube.kcl");
const MATH_PROGRAM: &str = include_str!("../../tests/executor/inputs/math.kcl");
const MIKE_STRESS_TEST_PROGRAM: &str = include_str!("../../tests/executor/inputs/mike_stress_test.kcl");
const MIKE_STRESS_TEST_PROGRAM: &str = include_str!("../tests/mike_stress_test/input.kcl");
const LSYSTEM_PROGRAM: &str = include_str!("../../tests/executor/inputs/lsystem.kcl");

View File

@ -62,6 +62,6 @@ const KITT_PROGRAM: &str = include_str!("../../tests/executor/inputs/kittycad_sv
const PIPES_PROGRAM: &str = include_str!("../../tests/executor/inputs/pipes_on_pipes.kcl");
const CUBE_PROGRAM: &str = include_str!("../../tests/executor/inputs/cube.kcl");
const MATH_PROGRAM: &str = include_str!("../../tests/executor/inputs/math.kcl");
const MIKE_STRESS_TEST_PROGRAM: &str = include_str!("../../tests/executor/inputs/mike_stress_test.kcl");
const MIKE_STRESS_TEST_PROGRAM: &str = include_str!("../tests/mike_stress_test/input.kcl");
const GLOBAL_TAGS_FILE: &str = include_str!("../../tests/executor/inputs/global-tags.kcl");
const LSYSTEM_PROGRAM: &str = include_str!("../../tests/executor/inputs/lsystem.kcl");

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,157 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing array_elem_push_fail.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 15,
"id": {
"end": 3,
"name": "arr",
"start": 0,
"type": "Identifier"
},
"init": {
"elements": [
{
"end": 8,
"raw": "1",
"start": 7,
"type": "Literal",
"type": "Literal",
"value": 1
},
{
"end": 11,
"raw": "2",
"start": 10,
"type": "Literal",
"type": "Literal",
"value": 2
},
{
"end": 14,
"raw": "3",
"start": 13,
"type": "Literal",
"type": "Literal",
"value": 3
}
],
"end": 15,
"start": 6,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
"start": 0,
"type": "VariableDeclarator"
}
],
"end": 15,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 40,
"id": {
"end": 25,
"name": "pushedArr",
"start": 16,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 36,
"name": "arr",
"start": 33,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 39,
"raw": "4",
"start": 38,
"type": "Literal",
"type": "Literal",
"value": 4
}
],
"callee": {
"end": 32,
"name": "push",
"start": 28,
"type": "Identifier"
},
"end": 40,
"optional": false,
"start": 28,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 16,
"type": "VariableDeclarator"
}
],
"end": 40,
"kind": "const",
"start": 16,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 54,
"id": {
"end": 45,
"name": "fail",
"start": 41,
"type": "Identifier"
},
"init": {
"computed": false,
"end": 54,
"object": {
"end": 51,
"name": "arr",
"start": 48,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 53,
"raw": "3",
"start": 52,
"type": "Literal",
"type": "Literal",
"value": 3
},
"start": 48,
"type": "MemberExpression",
"type": "MemberExpression"
},
"start": 41,
"type": "VariableDeclarator"
}
],
"end": 54,
"kind": "const",
"start": 41,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 55,
"start": 0
}
}

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Error from executing array_elem_push_fail.kcl
snapshot_kind: text
---
undefined value: KclErrorDetails { source_ranges: [SourceRange([48, 54, 0])], message: "The array doesn't have any item at index 3" }

View File

@ -0,0 +1,3 @@
arr = [1, 2, 3]
pushedArr = push(arr, 4)
fail = arr[3]

View File

@ -0,0 +1,219 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing array_elem_push_fail.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "word",
"start": 0,
"end": 3,
"value": "arr"
},
{
"type": "whitespace",
"start": 3,
"end": 4,
"value": " "
},
{
"type": "operator",
"start": 4,
"end": 5,
"value": "="
},
{
"type": "whitespace",
"start": 5,
"end": 6,
"value": " "
},
{
"type": "brace",
"start": 6,
"end": 7,
"value": "["
},
{
"type": "number",
"start": 7,
"end": 8,
"value": "1"
},
{
"type": "comma",
"start": 8,
"end": 9,
"value": ","
},
{
"type": "whitespace",
"start": 9,
"end": 10,
"value": " "
},
{
"type": "number",
"start": 10,
"end": 11,
"value": "2"
},
{
"type": "comma",
"start": 11,
"end": 12,
"value": ","
},
{
"type": "whitespace",
"start": 12,
"end": 13,
"value": " "
},
{
"type": "number",
"start": 13,
"end": 14,
"value": "3"
},
{
"type": "brace",
"start": 14,
"end": 15,
"value": "]"
},
{
"type": "whitespace",
"start": 15,
"end": 16,
"value": "\n"
},
{
"type": "word",
"start": 16,
"end": 25,
"value": "pushedArr"
},
{
"type": "whitespace",
"start": 25,
"end": 26,
"value": " "
},
{
"type": "operator",
"start": 26,
"end": 27,
"value": "="
},
{
"type": "whitespace",
"start": 27,
"end": 28,
"value": " "
},
{
"type": "word",
"start": 28,
"end": 32,
"value": "push"
},
{
"type": "brace",
"start": 32,
"end": 33,
"value": "("
},
{
"type": "word",
"start": 33,
"end": 36,
"value": "arr"
},
{
"type": "comma",
"start": 36,
"end": 37,
"value": ","
},
{
"type": "whitespace",
"start": 37,
"end": 38,
"value": " "
},
{
"type": "number",
"start": 38,
"end": 39,
"value": "4"
},
{
"type": "brace",
"start": 39,
"end": 40,
"value": ")"
},
{
"type": "whitespace",
"start": 40,
"end": 41,
"value": "\n"
},
{
"type": "word",
"start": 41,
"end": 45,
"value": "fail"
},
{
"type": "whitespace",
"start": 45,
"end": 46,
"value": " "
},
{
"type": "operator",
"start": 46,
"end": 47,
"value": "="
},
{
"type": "whitespace",
"start": 47,
"end": 48,
"value": " "
},
{
"type": "word",
"start": 48,
"end": 51,
"value": "arr"
},
{
"type": "brace",
"start": 51,
"end": 52,
"value": "["
},
{
"type": "number",
"start": 52,
"end": 53,
"value": "3"
},
{
"type": "brace",
"start": 53,
"end": 54,
"value": "]"
},
{
"type": "whitespace",
"start": 54,
"end": 55,
"value": "\n"
}
]
}

View File

@ -0,0 +1,82 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing array_index_oob.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 8,
"id": {
"end": 3,
"name": "arr",
"start": 0,
"type": "Identifier"
},
"init": {
"elements": [],
"end": 8,
"start": 6,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
"start": 0,
"type": "VariableDeclarator"
}
],
"end": 8,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 19,
"id": {
"end": 10,
"name": "x",
"start": 9,
"type": "Identifier"
},
"init": {
"computed": false,
"end": 19,
"object": {
"end": 16,
"name": "arr",
"start": 13,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 18,
"raw": "0",
"start": 17,
"type": "Literal",
"type": "Literal",
"value": 0
},
"start": 13,
"type": "MemberExpression",
"type": "MemberExpression"
},
"start": 9,
"type": "VariableDeclarator"
}
],
"end": 19,
"kind": "const",
"start": 9,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 20,
"start": 0
}
}

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Error from executing array_index_oob.kcl
snapshot_kind: text
---
undefined value: KclErrorDetails { source_ranges: [SourceRange([13, 19, 0])], message: "The array doesn't have any item at index 0" }

View File

@ -0,0 +1,2 @@
arr = []
x = arr[0]

View File

@ -0,0 +1,105 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing array_index_oob.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "word",
"start": 0,
"end": 3,
"value": "arr"
},
{
"type": "whitespace",
"start": 3,
"end": 4,
"value": " "
},
{
"type": "operator",
"start": 4,
"end": 5,
"value": "="
},
{
"type": "whitespace",
"start": 5,
"end": 6,
"value": " "
},
{
"type": "brace",
"start": 6,
"end": 7,
"value": "["
},
{
"type": "brace",
"start": 7,
"end": 8,
"value": "]"
},
{
"type": "whitespace",
"start": 8,
"end": 9,
"value": "\n"
},
{
"type": "word",
"start": 9,
"end": 10,
"value": "x"
},
{
"type": "whitespace",
"start": 10,
"end": 11,
"value": " "
},
{
"type": "operator",
"start": 11,
"end": 12,
"value": "="
},
{
"type": "whitespace",
"start": 12,
"end": 13,
"value": " "
},
{
"type": "word",
"start": 13,
"end": 16,
"value": "arr"
},
{
"type": "brace",
"start": 16,
"end": 17,
"value": "["
},
{
"type": "number",
"start": 17,
"end": 18,
"value": "0"
},
{
"type": "brace",
"start": 18,
"end": 19,
"value": "]"
},
{
"type": "whitespace",
"start": 19,
"end": 20,
"value": "\n"
}
]
}

View File

@ -0,0 +1,418 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing basic_fillet_cube_close_opposite.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 277,
"id": {
"end": 7,
"name": "part001",
"start": 0,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 28,
"raw": "'XY'",
"start": 24,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 23,
"name": "startSketchOn",
"start": 10,
"type": "Identifier"
},
"end": 29,
"optional": false,
"start": 10,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 52,
"raw": "0",
"start": 51,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 55,
"raw": "0",
"start": 54,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 56,
"start": 50,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 59,
"start": 58,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 49,
"name": "startProfileAt",
"start": 35,
"type": "Identifier"
},
"end": 60,
"optional": false,
"start": 35,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 73,
"raw": "0",
"start": 72,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 77,
"raw": "10",
"start": 75,
"type": "Literal",
"type": "Literal",
"value": 10
}
],
"end": 78,
"start": 71,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 81,
"start": 80,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 89,
"start": 83,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "thing"
}
],
"callee": {
"end": 70,
"name": "line",
"start": 66,
"type": "Identifier"
},
"end": 90,
"optional": false,
"start": 66,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 104,
"raw": "10",
"start": 102,
"type": "Literal",
"type": "Literal",
"value": 10
},
{
"end": 107,
"raw": "0",
"start": 106,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 108,
"start": 101,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 111,
"start": 110,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 100,
"name": "line",
"start": 96,
"type": "Identifier"
},
"end": 112,
"optional": false,
"start": 96,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 125,
"raw": "0",
"start": 124,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"argument": {
"end": 130,
"raw": "10",
"start": 128,
"type": "Literal",
"type": "Literal",
"value": 10
},
"end": 130,
"operator": "-",
"start": 127,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 131,
"start": 123,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 134,
"start": 133,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 143,
"start": 136,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "thing2"
}
],
"callee": {
"end": 122,
"name": "line",
"start": 118,
"type": "Identifier"
},
"end": 144,
"optional": false,
"start": 118,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 157,
"start": 156,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 166,
"start": 159,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "thing3"
}
],
"callee": {
"end": 155,
"name": "close",
"start": 150,
"type": "Identifier"
},
"end": 167,
"optional": false,
"start": 150,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 183,
"raw": "10",
"start": 181,
"type": "Literal",
"type": "Literal",
"value": 10
},
{
"end": 186,
"start": 185,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 180,
"name": "extrude",
"start": 173,
"type": "Identifier"
},
"end": 187,
"optional": false,
"start": 173,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 273,
"properties": [
{
"end": 218,
"key": {
"end": 215,
"name": "radius",
"start": 209,
"type": "Identifier"
},
"start": 209,
"type": "ObjectProperty",
"value": {
"end": 218,
"raw": "2",
"start": 217,
"type": "Literal",
"type": "Literal",
"value": 2
}
},
{
"end": 266,
"key": {
"end": 231,
"name": "tags",
"start": 227,
"type": "Identifier"
},
"start": 227,
"type": "ObjectProperty",
"value": {
"elements": [
{
"end": 240,
"name": "thing3",
"start": 234,
"type": "Identifier",
"type": "Identifier"
},
{
"arguments": [
{
"end": 264,
"name": "thing3",
"start": 258,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 257,
"name": "getOppositeEdge",
"start": 242,
"type": "Identifier"
},
"end": 265,
"optional": false,
"start": 242,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 266,
"start": 233,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"start": 200,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 276,
"start": 275,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 199,
"name": "fillet",
"start": 193,
"type": "Identifier"
},
"end": 277,
"optional": false,
"start": 193,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 277,
"start": 10,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 0,
"type": "VariableDeclarator"
}
],
"end": 277,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 278,
"start": 0
}
}

View File

@ -0,0 +1,11 @@
part001 = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> line([0, 10], %, $thing)
|> line([10, 0], %)
|> line([0, -10], %, $thing2)
|> close(%, $thing3)
|> extrude(10, %)
|> fillet({
radius: 2,
tags: [thing3, getOppositeEdge(thing3)]
}, %)

View File

@ -0,0 +1,644 @@
---
source: kcl/src/simulation_tests.rs
description: Program memory after executing basic_fillet_cube_close_opposite.kcl
snapshot_kind: text
---
{
"environments": [
{
"bindings": {
"HALF_TURN": {
"type": "Number",
"value": 180.0,
"__meta": []
},
"QUARTER_TURN": {
"type": "Number",
"value": 90.0,
"__meta": []
},
"THREE_QUARTER_TURN": {
"type": "Number",
"value": 270.0,
"__meta": []
},
"ZERO": {
"type": "Number",
"value": 0.0,
"__meta": []
},
"part001": {
"type": "Solid",
"type": "Solid",
"id": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
90,
0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
96,
112,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
118,
144,
0
],
"tag": {
"end": 143,
"start": 136,
"type": "TagDeclarator",
"value": "thing2"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
150,
167,
0
],
"tag": {
"end": 166,
"start": 159,
"type": "TagDeclarator",
"value": "thing3"
},
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
90,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"to": [
0.0,
10.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
96,
112,
0
]
},
"from": [
0.0,
10.0
],
"tag": null,
"to": [
10.0,
10.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
118,
144,
0
]
},
"from": [
10.0,
10.0
],
"tag": {
"end": 143,
"start": 136,
"type": "TagDeclarator",
"value": "thing2"
},
"to": [
10.0,
0.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
150,
167,
0
]
},
"from": [
10.0,
0.0
],
"tag": {
"end": 166,
"start": 159,
"type": "TagDeclarator",
"value": "thing3"
},
"to": [
0.0,
0.0
],
"type": "ToPoint"
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"__meta": []
},
"start": {
"from": [
0.0,
0.0
],
"to": [
0.0,
0.0
],
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
35,
60,
0
]
}
},
"tags": {
"thing": {
"type": "TagIdentifier",
"value": "thing",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
90,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"to": [
0.0,
10.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
90,
0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
83,
89,
0
]
}
]
},
"thing2": {
"type": "TagIdentifier",
"value": "thing2",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
118,
144,
0
]
},
"from": [
10.0,
10.0
],
"tag": {
"end": 143,
"start": 136,
"type": "TagDeclarator",
"value": "thing2"
},
"to": [
10.0,
0.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
118,
144,
0
],
"tag": {
"end": 143,
"start": 136,
"type": "TagDeclarator",
"value": "thing2"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
136,
143,
0
]
}
]
},
"thing3": {
"type": "TagIdentifier",
"value": "thing3",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
150,
167,
0
]
},
"from": [
10.0,
0.0
],
"tag": {
"end": 166,
"start": 159,
"type": "TagDeclarator",
"value": "thing3"
},
"to": [
0.0,
0.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
150,
167,
0
],
"tag": {
"end": 166,
"start": 159,
"type": "TagDeclarator",
"value": "thing3"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
159,
166,
0
]
}
]
}
},
"__meta": [
{
"sourceRange": [
35,
60,
0
]
}
]
},
"height": 10.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"edgeCuts": [
{
"type": "fillet",
"id": "[uuid]",
"radius": 2.0,
"edgeId": "[uuid]",
"tag": null
},
{
"type": "fillet",
"id": "[uuid]",
"radius": 2.0,
"edgeId": "[uuid]",
"tag": null
}
],
"__meta": [
{
"sourceRange": [
35,
60,
0
]
}
]
},
"thing": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "thing",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
90,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"to": [
0.0,
10.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
90,
0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
83,
89,
0
]
}
]
},
"thing2": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "thing2",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
118,
144,
0
]
},
"from": [
10.0,
10.0
],
"tag": {
"end": 143,
"start": 136,
"type": "TagDeclarator",
"value": "thing2"
},
"to": [
10.0,
0.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
118,
144,
0
],
"tag": {
"end": 143,
"start": 136,
"type": "TagDeclarator",
"value": "thing2"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
136,
143,
0
]
}
]
},
"thing3": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "thing3",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
150,
167,
0
]
},
"from": [
10.0,
0.0
],
"tag": {
"end": 166,
"start": 159,
"type": "TagDeclarator",
"value": "thing3"
},
"to": [
0.0,
0.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
150,
167,
0
],
"tag": {
"end": 166,
"start": 159,
"type": "TagDeclarator",
"value": "thing3"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
159,
166,
0
]
}
]
}
},
"parent": null
}
],
"currentEnv": 0,
"return": null
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

View File

@ -0,0 +1,789 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing basic_fillet_cube_close_opposite.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "word",
"start": 0,
"end": 7,
"value": "part001"
},
{
"type": "whitespace",
"start": 7,
"end": 8,
"value": " "
},
{
"type": "operator",
"start": 8,
"end": 9,
"value": "="
},
{
"type": "whitespace",
"start": 9,
"end": 10,
"value": " "
},
{
"type": "word",
"start": 10,
"end": 23,
"value": "startSketchOn"
},
{
"type": "brace",
"start": 23,
"end": 24,
"value": "("
},
{
"type": "string",
"start": 24,
"end": 28,
"value": "'XY'"
},
{
"type": "brace",
"start": 28,
"end": 29,
"value": ")"
},
{
"type": "whitespace",
"start": 29,
"end": 32,
"value": "\n "
},
{
"type": "operator",
"start": 32,
"end": 34,
"value": "|>"
},
{
"type": "whitespace",
"start": 34,
"end": 35,
"value": " "
},
{
"type": "word",
"start": 35,
"end": 49,
"value": "startProfileAt"
},
{
"type": "brace",
"start": 49,
"end": 50,
"value": "("
},
{
"type": "brace",
"start": 50,
"end": 51,
"value": "["
},
{
"type": "number",
"start": 51,
"end": 52,
"value": "0"
},
{
"type": "comma",
"start": 52,
"end": 53,
"value": ","
},
{
"type": "whitespace",
"start": 53,
"end": 54,
"value": " "
},
{
"type": "number",
"start": 54,
"end": 55,
"value": "0"
},
{
"type": "brace",
"start": 55,
"end": 56,
"value": "]"
},
{
"type": "comma",
"start": 56,
"end": 57,
"value": ","
},
{
"type": "whitespace",
"start": 57,
"end": 58,
"value": " "
},
{
"type": "operator",
"start": 58,
"end": 59,
"value": "%"
},
{
"type": "brace",
"start": 59,
"end": 60,
"value": ")"
},
{
"type": "whitespace",
"start": 60,
"end": 63,
"value": "\n "
},
{
"type": "operator",
"start": 63,
"end": 65,
"value": "|>"
},
{
"type": "whitespace",
"start": 65,
"end": 66,
"value": " "
},
{
"type": "word",
"start": 66,
"end": 70,
"value": "line"
},
{
"type": "brace",
"start": 70,
"end": 71,
"value": "("
},
{
"type": "brace",
"start": 71,
"end": 72,
"value": "["
},
{
"type": "number",
"start": 72,
"end": 73,
"value": "0"
},
{
"type": "comma",
"start": 73,
"end": 74,
"value": ","
},
{
"type": "whitespace",
"start": 74,
"end": 75,
"value": " "
},
{
"type": "number",
"start": 75,
"end": 77,
"value": "10"
},
{
"type": "brace",
"start": 77,
"end": 78,
"value": "]"
},
{
"type": "comma",
"start": 78,
"end": 79,
"value": ","
},
{
"type": "whitespace",
"start": 79,
"end": 80,
"value": " "
},
{
"type": "operator",
"start": 80,
"end": 81,
"value": "%"
},
{
"type": "comma",
"start": 81,
"end": 82,
"value": ","
},
{
"type": "whitespace",
"start": 82,
"end": 83,
"value": " "
},
{
"type": "dollar",
"start": 83,
"end": 84,
"value": "$"
},
{
"type": "word",
"start": 84,
"end": 89,
"value": "thing"
},
{
"type": "brace",
"start": 89,
"end": 90,
"value": ")"
},
{
"type": "whitespace",
"start": 90,
"end": 93,
"value": "\n "
},
{
"type": "operator",
"start": 93,
"end": 95,
"value": "|>"
},
{
"type": "whitespace",
"start": 95,
"end": 96,
"value": " "
},
{
"type": "word",
"start": 96,
"end": 100,
"value": "line"
},
{
"type": "brace",
"start": 100,
"end": 101,
"value": "("
},
{
"type": "brace",
"start": 101,
"end": 102,
"value": "["
},
{
"type": "number",
"start": 102,
"end": 104,
"value": "10"
},
{
"type": "comma",
"start": 104,
"end": 105,
"value": ","
},
{
"type": "whitespace",
"start": 105,
"end": 106,
"value": " "
},
{
"type": "number",
"start": 106,
"end": 107,
"value": "0"
},
{
"type": "brace",
"start": 107,
"end": 108,
"value": "]"
},
{
"type": "comma",
"start": 108,
"end": 109,
"value": ","
},
{
"type": "whitespace",
"start": 109,
"end": 110,
"value": " "
},
{
"type": "operator",
"start": 110,
"end": 111,
"value": "%"
},
{
"type": "brace",
"start": 111,
"end": 112,
"value": ")"
},
{
"type": "whitespace",
"start": 112,
"end": 115,
"value": "\n "
},
{
"type": "operator",
"start": 115,
"end": 117,
"value": "|>"
},
{
"type": "whitespace",
"start": 117,
"end": 118,
"value": " "
},
{
"type": "word",
"start": 118,
"end": 122,
"value": "line"
},
{
"type": "brace",
"start": 122,
"end": 123,
"value": "("
},
{
"type": "brace",
"start": 123,
"end": 124,
"value": "["
},
{
"type": "number",
"start": 124,
"end": 125,
"value": "0"
},
{
"type": "comma",
"start": 125,
"end": 126,
"value": ","
},
{
"type": "whitespace",
"start": 126,
"end": 127,
"value": " "
},
{
"type": "operator",
"start": 127,
"end": 128,
"value": "-"
},
{
"type": "number",
"start": 128,
"end": 130,
"value": "10"
},
{
"type": "brace",
"start": 130,
"end": 131,
"value": "]"
},
{
"type": "comma",
"start": 131,
"end": 132,
"value": ","
},
{
"type": "whitespace",
"start": 132,
"end": 133,
"value": " "
},
{
"type": "operator",
"start": 133,
"end": 134,
"value": "%"
},
{
"type": "comma",
"start": 134,
"end": 135,
"value": ","
},
{
"type": "whitespace",
"start": 135,
"end": 136,
"value": " "
},
{
"type": "dollar",
"start": 136,
"end": 137,
"value": "$"
},
{
"type": "word",
"start": 137,
"end": 143,
"value": "thing2"
},
{
"type": "brace",
"start": 143,
"end": 144,
"value": ")"
},
{
"type": "whitespace",
"start": 144,
"end": 147,
"value": "\n "
},
{
"type": "operator",
"start": 147,
"end": 149,
"value": "|>"
},
{
"type": "whitespace",
"start": 149,
"end": 150,
"value": " "
},
{
"type": "word",
"start": 150,
"end": 155,
"value": "close"
},
{
"type": "brace",
"start": 155,
"end": 156,
"value": "("
},
{
"type": "operator",
"start": 156,
"end": 157,
"value": "%"
},
{
"type": "comma",
"start": 157,
"end": 158,
"value": ","
},
{
"type": "whitespace",
"start": 158,
"end": 159,
"value": " "
},
{
"type": "dollar",
"start": 159,
"end": 160,
"value": "$"
},
{
"type": "word",
"start": 160,
"end": 166,
"value": "thing3"
},
{
"type": "brace",
"start": 166,
"end": 167,
"value": ")"
},
{
"type": "whitespace",
"start": 167,
"end": 170,
"value": "\n "
},
{
"type": "operator",
"start": 170,
"end": 172,
"value": "|>"
},
{
"type": "whitespace",
"start": 172,
"end": 173,
"value": " "
},
{
"type": "word",
"start": 173,
"end": 180,
"value": "extrude"
},
{
"type": "brace",
"start": 180,
"end": 181,
"value": "("
},
{
"type": "number",
"start": 181,
"end": 183,
"value": "10"
},
{
"type": "comma",
"start": 183,
"end": 184,
"value": ","
},
{
"type": "whitespace",
"start": 184,
"end": 185,
"value": " "
},
{
"type": "operator",
"start": 185,
"end": 186,
"value": "%"
},
{
"type": "brace",
"start": 186,
"end": 187,
"value": ")"
},
{
"type": "whitespace",
"start": 187,
"end": 190,
"value": "\n "
},
{
"type": "operator",
"start": 190,
"end": 192,
"value": "|>"
},
{
"type": "whitespace",
"start": 192,
"end": 193,
"value": " "
},
{
"type": "word",
"start": 193,
"end": 199,
"value": "fillet"
},
{
"type": "brace",
"start": 199,
"end": 200,
"value": "("
},
{
"type": "brace",
"start": 200,
"end": 201,
"value": "{"
},
{
"type": "whitespace",
"start": 201,
"end": 209,
"value": "\n "
},
{
"type": "word",
"start": 209,
"end": 215,
"value": "radius"
},
{
"type": "colon",
"start": 215,
"end": 216,
"value": ":"
},
{
"type": "whitespace",
"start": 216,
"end": 217,
"value": " "
},
{
"type": "number",
"start": 217,
"end": 218,
"value": "2"
},
{
"type": "comma",
"start": 218,
"end": 219,
"value": ","
},
{
"type": "whitespace",
"start": 219,
"end": 227,
"value": "\n "
},
{
"type": "word",
"start": 227,
"end": 231,
"value": "tags"
},
{
"type": "colon",
"start": 231,
"end": 232,
"value": ":"
},
{
"type": "whitespace",
"start": 232,
"end": 233,
"value": " "
},
{
"type": "brace",
"start": 233,
"end": 234,
"value": "["
},
{
"type": "word",
"start": 234,
"end": 240,
"value": "thing3"
},
{
"type": "comma",
"start": 240,
"end": 241,
"value": ","
},
{
"type": "whitespace",
"start": 241,
"end": 242,
"value": " "
},
{
"type": "word",
"start": 242,
"end": 257,
"value": "getOppositeEdge"
},
{
"type": "brace",
"start": 257,
"end": 258,
"value": "("
},
{
"type": "word",
"start": 258,
"end": 264,
"value": "thing3"
},
{
"type": "brace",
"start": 264,
"end": 265,
"value": ")"
},
{
"type": "brace",
"start": 265,
"end": 266,
"value": "]"
},
{
"type": "whitespace",
"start": 266,
"end": 272,
"value": "\n "
},
{
"type": "brace",
"start": 272,
"end": 273,
"value": "}"
},
{
"type": "comma",
"start": 273,
"end": 274,
"value": ","
},
{
"type": "whitespace",
"start": 274,
"end": 275,
"value": " "
},
{
"type": "operator",
"start": 275,
"end": 276,
"value": "%"
},
{
"type": "brace",
"start": 276,
"end": 277,
"value": ")"
},
{
"type": "whitespace",
"start": 277,
"end": 278,
"value": "\n"
}
]
}

View File

@ -0,0 +1,411 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing basic_fillet_cube_end.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 266,
"id": {
"end": 7,
"name": "part001",
"start": 0,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 28,
"raw": "'XY'",
"start": 24,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 23,
"name": "startSketchOn",
"start": 10,
"type": "Identifier"
},
"end": 29,
"optional": false,
"start": 10,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 52,
"raw": "0",
"start": 51,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 55,
"raw": "0",
"start": 54,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 56,
"start": 50,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 59,
"start": 58,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 49,
"name": "startProfileAt",
"start": 35,
"type": "Identifier"
},
"end": 60,
"optional": false,
"start": 35,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 73,
"raw": "0",
"start": 72,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 77,
"raw": "10",
"start": 75,
"type": "Literal",
"type": "Literal",
"value": 10
}
],
"end": 78,
"start": 71,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 81,
"start": 80,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 89,
"start": 83,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "thing"
}
],
"callee": {
"end": 70,
"name": "line",
"start": 66,
"type": "Identifier"
},
"end": 90,
"optional": false,
"start": 66,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 104,
"raw": "10",
"start": 102,
"type": "Literal",
"type": "Literal",
"value": 10
},
{
"end": 107,
"raw": "0",
"start": 106,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 108,
"start": 101,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 111,
"start": 110,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 100,
"name": "line",
"start": 96,
"type": "Identifier"
},
"end": 112,
"optional": false,
"start": 96,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 125,
"raw": "0",
"start": 124,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"argument": {
"end": 130,
"raw": "10",
"start": 128,
"type": "Literal",
"type": "Literal",
"value": 10
},
"end": 130,
"operator": "-",
"start": 127,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 131,
"start": 123,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 134,
"start": 133,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 143,
"start": 136,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "thing2"
}
],
"callee": {
"end": 122,
"name": "line",
"start": 118,
"type": "Identifier"
},
"end": 144,
"optional": false,
"start": 118,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 157,
"start": 156,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 155,
"name": "close",
"start": 150,
"type": "Identifier"
},
"end": 158,
"optional": false,
"start": 150,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 174,
"raw": "10",
"start": 172,
"type": "Literal",
"type": "Literal",
"value": 10
},
{
"end": 177,
"start": 176,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 171,
"name": "extrude",
"start": 164,
"type": "Identifier"
},
"end": 178,
"optional": false,
"start": 164,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 262,
"properties": [
{
"end": 209,
"key": {
"end": 206,
"name": "radius",
"start": 200,
"type": "Identifier"
},
"start": 200,
"type": "ObjectProperty",
"value": {
"end": 209,
"raw": "2",
"start": 208,
"type": "Literal",
"type": "Literal",
"value": 2
}
},
{
"end": 255,
"key": {
"end": 222,
"name": "tags",
"start": 218,
"type": "Identifier"
},
"start": 218,
"type": "ObjectProperty",
"value": {
"elements": [
{
"end": 230,
"name": "thing",
"start": 225,
"type": "Identifier",
"type": "Identifier"
},
{
"arguments": [
{
"end": 253,
"name": "thing",
"start": 248,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 247,
"name": "getOppositeEdge",
"start": 232,
"type": "Identifier"
},
"end": 254,
"optional": false,
"start": 232,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 255,
"start": 224,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"start": 191,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 265,
"start": 264,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 190,
"name": "fillet",
"start": 184,
"type": "Identifier"
},
"end": 266,
"optional": false,
"start": 184,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 266,
"start": 10,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 0,
"type": "VariableDeclarator"
}
],
"end": 266,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 267,
"start": 0
}
}

View File

@ -0,0 +1,11 @@
part001 = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> line([0, 10], %, $thing)
|> line([10, 0], %)
|> line([0, -10], %, $thing2)
|> close(%)
|> extrude(10, %)
|> fillet({
radius: 2,
tags: [thing, getOppositeEdge(thing)]
}, %)

View File

@ -0,0 +1,515 @@
---
source: kcl/src/simulation_tests.rs
description: Program memory after executing basic_fillet_cube_end.kcl
snapshot_kind: text
---
{
"environments": [
{
"bindings": {
"HALF_TURN": {
"type": "Number",
"value": 180.0,
"__meta": []
},
"QUARTER_TURN": {
"type": "Number",
"value": 90.0,
"__meta": []
},
"THREE_QUARTER_TURN": {
"type": "Number",
"value": 270.0,
"__meta": []
},
"ZERO": {
"type": "Number",
"value": 0.0,
"__meta": []
},
"part001": {
"type": "Solid",
"type": "Solid",
"id": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
90,
0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
96,
112,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
118,
144,
0
],
"tag": {
"end": 143,
"start": 136,
"type": "TagDeclarator",
"value": "thing2"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
150,
158,
0
],
"tag": null,
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
90,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"to": [
0.0,
10.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
96,
112,
0
]
},
"from": [
0.0,
10.0
],
"tag": null,
"to": [
10.0,
10.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
118,
144,
0
]
},
"from": [
10.0,
10.0
],
"tag": {
"end": 143,
"start": 136,
"type": "TagDeclarator",
"value": "thing2"
},
"to": [
10.0,
0.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
150,
158,
0
]
},
"from": [
10.0,
0.0
],
"tag": null,
"to": [
0.0,
0.0
],
"type": "ToPoint"
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"__meta": []
},
"start": {
"from": [
0.0,
0.0
],
"to": [
0.0,
0.0
],
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
35,
60,
0
]
}
},
"tags": {
"thing": {
"type": "TagIdentifier",
"value": "thing",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
90,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"to": [
0.0,
10.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
90,
0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
83,
89,
0
]
}
]
},
"thing2": {
"type": "TagIdentifier",
"value": "thing2",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
118,
144,
0
]
},
"from": [
10.0,
10.0
],
"tag": {
"end": 143,
"start": 136,
"type": "TagDeclarator",
"value": "thing2"
},
"to": [
10.0,
0.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
118,
144,
0
],
"tag": {
"end": 143,
"start": 136,
"type": "TagDeclarator",
"value": "thing2"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
136,
143,
0
]
}
]
}
},
"__meta": [
{
"sourceRange": [
35,
60,
0
]
}
]
},
"height": 10.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"edgeCuts": [
{
"type": "fillet",
"id": "[uuid]",
"radius": 2.0,
"edgeId": "[uuid]",
"tag": null
},
{
"type": "fillet",
"id": "[uuid]",
"radius": 2.0,
"edgeId": "[uuid]",
"tag": null
}
],
"__meta": [
{
"sourceRange": [
35,
60,
0
]
}
]
},
"thing": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "thing",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
90,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"to": [
0.0,
10.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
90,
0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
83,
89,
0
]
}
]
},
"thing2": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "thing2",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
118,
144,
0
]
},
"from": [
10.0,
10.0
],
"tag": {
"end": 143,
"start": 136,
"type": "TagDeclarator",
"value": "thing2"
},
"to": [
10.0,
0.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
118,
144,
0
],
"tag": {
"end": 143,
"start": 136,
"type": "TagDeclarator",
"value": "thing2"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
136,
143,
0
]
}
]
}
},
"parent": null
}
],
"currentEnv": 0,
"return": null
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

View File

@ -0,0 +1,765 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing basic_fillet_cube_end.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "word",
"start": 0,
"end": 7,
"value": "part001"
},
{
"type": "whitespace",
"start": 7,
"end": 8,
"value": " "
},
{
"type": "operator",
"start": 8,
"end": 9,
"value": "="
},
{
"type": "whitespace",
"start": 9,
"end": 10,
"value": " "
},
{
"type": "word",
"start": 10,
"end": 23,
"value": "startSketchOn"
},
{
"type": "brace",
"start": 23,
"end": 24,
"value": "("
},
{
"type": "string",
"start": 24,
"end": 28,
"value": "'XY'"
},
{
"type": "brace",
"start": 28,
"end": 29,
"value": ")"
},
{
"type": "whitespace",
"start": 29,
"end": 32,
"value": "\n "
},
{
"type": "operator",
"start": 32,
"end": 34,
"value": "|>"
},
{
"type": "whitespace",
"start": 34,
"end": 35,
"value": " "
},
{
"type": "word",
"start": 35,
"end": 49,
"value": "startProfileAt"
},
{
"type": "brace",
"start": 49,
"end": 50,
"value": "("
},
{
"type": "brace",
"start": 50,
"end": 51,
"value": "["
},
{
"type": "number",
"start": 51,
"end": 52,
"value": "0"
},
{
"type": "comma",
"start": 52,
"end": 53,
"value": ","
},
{
"type": "whitespace",
"start": 53,
"end": 54,
"value": " "
},
{
"type": "number",
"start": 54,
"end": 55,
"value": "0"
},
{
"type": "brace",
"start": 55,
"end": 56,
"value": "]"
},
{
"type": "comma",
"start": 56,
"end": 57,
"value": ","
},
{
"type": "whitespace",
"start": 57,
"end": 58,
"value": " "
},
{
"type": "operator",
"start": 58,
"end": 59,
"value": "%"
},
{
"type": "brace",
"start": 59,
"end": 60,
"value": ")"
},
{
"type": "whitespace",
"start": 60,
"end": 63,
"value": "\n "
},
{
"type": "operator",
"start": 63,
"end": 65,
"value": "|>"
},
{
"type": "whitespace",
"start": 65,
"end": 66,
"value": " "
},
{
"type": "word",
"start": 66,
"end": 70,
"value": "line"
},
{
"type": "brace",
"start": 70,
"end": 71,
"value": "("
},
{
"type": "brace",
"start": 71,
"end": 72,
"value": "["
},
{
"type": "number",
"start": 72,
"end": 73,
"value": "0"
},
{
"type": "comma",
"start": 73,
"end": 74,
"value": ","
},
{
"type": "whitespace",
"start": 74,
"end": 75,
"value": " "
},
{
"type": "number",
"start": 75,
"end": 77,
"value": "10"
},
{
"type": "brace",
"start": 77,
"end": 78,
"value": "]"
},
{
"type": "comma",
"start": 78,
"end": 79,
"value": ","
},
{
"type": "whitespace",
"start": 79,
"end": 80,
"value": " "
},
{
"type": "operator",
"start": 80,
"end": 81,
"value": "%"
},
{
"type": "comma",
"start": 81,
"end": 82,
"value": ","
},
{
"type": "whitespace",
"start": 82,
"end": 83,
"value": " "
},
{
"type": "dollar",
"start": 83,
"end": 84,
"value": "$"
},
{
"type": "word",
"start": 84,
"end": 89,
"value": "thing"
},
{
"type": "brace",
"start": 89,
"end": 90,
"value": ")"
},
{
"type": "whitespace",
"start": 90,
"end": 93,
"value": "\n "
},
{
"type": "operator",
"start": 93,
"end": 95,
"value": "|>"
},
{
"type": "whitespace",
"start": 95,
"end": 96,
"value": " "
},
{
"type": "word",
"start": 96,
"end": 100,
"value": "line"
},
{
"type": "brace",
"start": 100,
"end": 101,
"value": "("
},
{
"type": "brace",
"start": 101,
"end": 102,
"value": "["
},
{
"type": "number",
"start": 102,
"end": 104,
"value": "10"
},
{
"type": "comma",
"start": 104,
"end": 105,
"value": ","
},
{
"type": "whitespace",
"start": 105,
"end": 106,
"value": " "
},
{
"type": "number",
"start": 106,
"end": 107,
"value": "0"
},
{
"type": "brace",
"start": 107,
"end": 108,
"value": "]"
},
{
"type": "comma",
"start": 108,
"end": 109,
"value": ","
},
{
"type": "whitespace",
"start": 109,
"end": 110,
"value": " "
},
{
"type": "operator",
"start": 110,
"end": 111,
"value": "%"
},
{
"type": "brace",
"start": 111,
"end": 112,
"value": ")"
},
{
"type": "whitespace",
"start": 112,
"end": 115,
"value": "\n "
},
{
"type": "operator",
"start": 115,
"end": 117,
"value": "|>"
},
{
"type": "whitespace",
"start": 117,
"end": 118,
"value": " "
},
{
"type": "word",
"start": 118,
"end": 122,
"value": "line"
},
{
"type": "brace",
"start": 122,
"end": 123,
"value": "("
},
{
"type": "brace",
"start": 123,
"end": 124,
"value": "["
},
{
"type": "number",
"start": 124,
"end": 125,
"value": "0"
},
{
"type": "comma",
"start": 125,
"end": 126,
"value": ","
},
{
"type": "whitespace",
"start": 126,
"end": 127,
"value": " "
},
{
"type": "operator",
"start": 127,
"end": 128,
"value": "-"
},
{
"type": "number",
"start": 128,
"end": 130,
"value": "10"
},
{
"type": "brace",
"start": 130,
"end": 131,
"value": "]"
},
{
"type": "comma",
"start": 131,
"end": 132,
"value": ","
},
{
"type": "whitespace",
"start": 132,
"end": 133,
"value": " "
},
{
"type": "operator",
"start": 133,
"end": 134,
"value": "%"
},
{
"type": "comma",
"start": 134,
"end": 135,
"value": ","
},
{
"type": "whitespace",
"start": 135,
"end": 136,
"value": " "
},
{
"type": "dollar",
"start": 136,
"end": 137,
"value": "$"
},
{
"type": "word",
"start": 137,
"end": 143,
"value": "thing2"
},
{
"type": "brace",
"start": 143,
"end": 144,
"value": ")"
},
{
"type": "whitespace",
"start": 144,
"end": 147,
"value": "\n "
},
{
"type": "operator",
"start": 147,
"end": 149,
"value": "|>"
},
{
"type": "whitespace",
"start": 149,
"end": 150,
"value": " "
},
{
"type": "word",
"start": 150,
"end": 155,
"value": "close"
},
{
"type": "brace",
"start": 155,
"end": 156,
"value": "("
},
{
"type": "operator",
"start": 156,
"end": 157,
"value": "%"
},
{
"type": "brace",
"start": 157,
"end": 158,
"value": ")"
},
{
"type": "whitespace",
"start": 158,
"end": 161,
"value": "\n "
},
{
"type": "operator",
"start": 161,
"end": 163,
"value": "|>"
},
{
"type": "whitespace",
"start": 163,
"end": 164,
"value": " "
},
{
"type": "word",
"start": 164,
"end": 171,
"value": "extrude"
},
{
"type": "brace",
"start": 171,
"end": 172,
"value": "("
},
{
"type": "number",
"start": 172,
"end": 174,
"value": "10"
},
{
"type": "comma",
"start": 174,
"end": 175,
"value": ","
},
{
"type": "whitespace",
"start": 175,
"end": 176,
"value": " "
},
{
"type": "operator",
"start": 176,
"end": 177,
"value": "%"
},
{
"type": "brace",
"start": 177,
"end": 178,
"value": ")"
},
{
"type": "whitespace",
"start": 178,
"end": 181,
"value": "\n "
},
{
"type": "operator",
"start": 181,
"end": 183,
"value": "|>"
},
{
"type": "whitespace",
"start": 183,
"end": 184,
"value": " "
},
{
"type": "word",
"start": 184,
"end": 190,
"value": "fillet"
},
{
"type": "brace",
"start": 190,
"end": 191,
"value": "("
},
{
"type": "brace",
"start": 191,
"end": 192,
"value": "{"
},
{
"type": "whitespace",
"start": 192,
"end": 200,
"value": "\n "
},
{
"type": "word",
"start": 200,
"end": 206,
"value": "radius"
},
{
"type": "colon",
"start": 206,
"end": 207,
"value": ":"
},
{
"type": "whitespace",
"start": 207,
"end": 208,
"value": " "
},
{
"type": "number",
"start": 208,
"end": 209,
"value": "2"
},
{
"type": "comma",
"start": 209,
"end": 210,
"value": ","
},
{
"type": "whitespace",
"start": 210,
"end": 218,
"value": "\n "
},
{
"type": "word",
"start": 218,
"end": 222,
"value": "tags"
},
{
"type": "colon",
"start": 222,
"end": 223,
"value": ":"
},
{
"type": "whitespace",
"start": 223,
"end": 224,
"value": " "
},
{
"type": "brace",
"start": 224,
"end": 225,
"value": "["
},
{
"type": "word",
"start": 225,
"end": 230,
"value": "thing"
},
{
"type": "comma",
"start": 230,
"end": 231,
"value": ","
},
{
"type": "whitespace",
"start": 231,
"end": 232,
"value": " "
},
{
"type": "word",
"start": 232,
"end": 247,
"value": "getOppositeEdge"
},
{
"type": "brace",
"start": 247,
"end": 248,
"value": "("
},
{
"type": "word",
"start": 248,
"end": 253,
"value": "thing"
},
{
"type": "brace",
"start": 253,
"end": 254,
"value": ")"
},
{
"type": "brace",
"start": 254,
"end": 255,
"value": "]"
},
{
"type": "whitespace",
"start": 255,
"end": 261,
"value": "\n "
},
{
"type": "brace",
"start": 261,
"end": 262,
"value": "}"
},
{
"type": "comma",
"start": 262,
"end": 263,
"value": ","
},
{
"type": "whitespace",
"start": 263,
"end": 264,
"value": " "
},
{
"type": "operator",
"start": 264,
"end": 265,
"value": "%"
},
{
"type": "brace",
"start": 265,
"end": 266,
"value": ")"
},
{
"type": "whitespace",
"start": 266,
"end": 267,
"value": "\n"
}
]
}

View File

@ -0,0 +1,418 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing basic_fillet_cube_next_adjacent.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 282,
"id": {
"end": 7,
"name": "part001",
"start": 0,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 28,
"raw": "'XY'",
"start": 24,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 23,
"name": "startSketchOn",
"start": 10,
"type": "Identifier"
},
"end": 29,
"optional": false,
"start": 10,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 52,
"raw": "0",
"start": 51,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 55,
"raw": "0",
"start": 54,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 56,
"start": 50,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 59,
"start": 58,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 49,
"name": "startProfileAt",
"start": 35,
"type": "Identifier"
},
"end": 60,
"optional": false,
"start": 35,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 73,
"raw": "0",
"start": 72,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 77,
"raw": "10",
"start": 75,
"type": "Literal",
"type": "Literal",
"value": 10
}
],
"end": 78,
"start": 71,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 81,
"start": 80,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 89,
"start": 83,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "thing"
}
],
"callee": {
"end": 70,
"name": "line",
"start": 66,
"type": "Identifier"
},
"end": 90,
"optional": false,
"start": 66,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 104,
"raw": "10",
"start": 102,
"type": "Literal",
"type": "Literal",
"value": 10
},
{
"end": 107,
"raw": "0",
"start": 106,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 108,
"start": 101,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 111,
"start": 110,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 120,
"start": 113,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "thing1"
}
],
"callee": {
"end": 100,
"name": "line",
"start": 96,
"type": "Identifier"
},
"end": 121,
"optional": false,
"start": 96,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 134,
"raw": "0",
"start": 133,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"argument": {
"end": 139,
"raw": "10",
"start": 137,
"type": "Literal",
"type": "Literal",
"value": 10
},
"end": 139,
"operator": "-",
"start": 136,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 140,
"start": 132,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 143,
"start": 142,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 152,
"start": 145,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "thing2"
}
],
"callee": {
"end": 131,
"name": "line",
"start": 127,
"type": "Identifier"
},
"end": 153,
"optional": false,
"start": 127,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 166,
"start": 165,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 175,
"start": 168,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "thing3"
}
],
"callee": {
"end": 164,
"name": "close",
"start": 159,
"type": "Identifier"
},
"end": 176,
"optional": false,
"start": 159,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 192,
"raw": "10",
"start": 190,
"type": "Literal",
"type": "Literal",
"value": 10
},
{
"end": 195,
"start": 194,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 189,
"name": "extrude",
"start": 182,
"type": "Identifier"
},
"end": 196,
"optional": false,
"start": 182,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 278,
"properties": [
{
"end": 227,
"key": {
"end": 224,
"name": "radius",
"start": 218,
"type": "Identifier"
},
"start": 218,
"type": "ObjectProperty",
"value": {
"end": 227,
"raw": "2",
"start": 226,
"type": "Literal",
"type": "Literal",
"value": 2
}
},
{
"end": 271,
"key": {
"end": 240,
"name": "tags",
"start": 236,
"type": "Identifier"
},
"start": 236,
"type": "ObjectProperty",
"value": {
"elements": [
{
"arguments": [
{
"end": 269,
"name": "thing3",
"start": 263,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 262,
"name": "getNextAdjacentEdge",
"start": 243,
"type": "Identifier"
},
"end": 270,
"optional": false,
"start": 243,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 271,
"start": 242,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"start": 209,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 281,
"start": 280,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 208,
"name": "fillet",
"start": 202,
"type": "Identifier"
},
"end": 282,
"optional": false,
"start": 202,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 282,
"start": 10,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 0,
"type": "VariableDeclarator"
}
],
"end": 282,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 283,
"start": 0
}
}

View File

@ -0,0 +1,11 @@
part001 = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> line([0, 10], %, $thing)
|> line([10, 0], %, $thing1)
|> line([0, -10], %, $thing2)
|> close(%, $thing3)
|> extrude(10, %)
|> fillet({
radius: 2,
tags: [getNextAdjacentEdge(thing3)]
}, %)

View File

@ -0,0 +1,766 @@
---
source: kcl/src/simulation_tests.rs
description: Program memory after executing basic_fillet_cube_next_adjacent.kcl
snapshot_kind: text
---
{
"environments": [
{
"bindings": {
"HALF_TURN": {
"type": "Number",
"value": 180.0,
"__meta": []
},
"QUARTER_TURN": {
"type": "Number",
"value": 90.0,
"__meta": []
},
"THREE_QUARTER_TURN": {
"type": "Number",
"value": 270.0,
"__meta": []
},
"ZERO": {
"type": "Number",
"value": 0.0,
"__meta": []
},
"part001": {
"type": "Solid",
"type": "Solid",
"id": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
90,
0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
96,
121,
0
],
"tag": {
"end": 120,
"start": 113,
"type": "TagDeclarator",
"value": "thing1"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
127,
153,
0
],
"tag": {
"end": 152,
"start": 145,
"type": "TagDeclarator",
"value": "thing2"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
159,
176,
0
],
"tag": {
"end": 175,
"start": 168,
"type": "TagDeclarator",
"value": "thing3"
},
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
90,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"to": [
0.0,
10.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
96,
121,
0
]
},
"from": [
0.0,
10.0
],
"tag": {
"end": 120,
"start": 113,
"type": "TagDeclarator",
"value": "thing1"
},
"to": [
10.0,
10.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
127,
153,
0
]
},
"from": [
10.0,
10.0
],
"tag": {
"end": 152,
"start": 145,
"type": "TagDeclarator",
"value": "thing2"
},
"to": [
10.0,
0.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
159,
176,
0
]
},
"from": [
10.0,
0.0
],
"tag": {
"end": 175,
"start": 168,
"type": "TagDeclarator",
"value": "thing3"
},
"to": [
0.0,
0.0
],
"type": "ToPoint"
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"__meta": []
},
"start": {
"from": [
0.0,
0.0
],
"to": [
0.0,
0.0
],
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
35,
60,
0
]
}
},
"tags": {
"thing": {
"type": "TagIdentifier",
"value": "thing",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
90,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"to": [
0.0,
10.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
90,
0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
83,
89,
0
]
}
]
},
"thing1": {
"type": "TagIdentifier",
"value": "thing1",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
96,
121,
0
]
},
"from": [
0.0,
10.0
],
"tag": {
"end": 120,
"start": 113,
"type": "TagDeclarator",
"value": "thing1"
},
"to": [
10.0,
10.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
96,
121,
0
],
"tag": {
"end": 120,
"start": 113,
"type": "TagDeclarator",
"value": "thing1"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
113,
120,
0
]
}
]
},
"thing2": {
"type": "TagIdentifier",
"value": "thing2",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
127,
153,
0
]
},
"from": [
10.0,
10.0
],
"tag": {
"end": 152,
"start": 145,
"type": "TagDeclarator",
"value": "thing2"
},
"to": [
10.0,
0.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
127,
153,
0
],
"tag": {
"end": 152,
"start": 145,
"type": "TagDeclarator",
"value": "thing2"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
145,
152,
0
]
}
]
},
"thing3": {
"type": "TagIdentifier",
"value": "thing3",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
159,
176,
0
]
},
"from": [
10.0,
0.0
],
"tag": {
"end": 175,
"start": 168,
"type": "TagDeclarator",
"value": "thing3"
},
"to": [
0.0,
0.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
159,
176,
0
],
"tag": {
"end": 175,
"start": 168,
"type": "TagDeclarator",
"value": "thing3"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
168,
175,
0
]
}
]
}
},
"__meta": [
{
"sourceRange": [
35,
60,
0
]
}
]
},
"height": 10.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"edgeCuts": [
{
"type": "fillet",
"id": "[uuid]",
"radius": 2.0,
"edgeId": "[uuid]",
"tag": null
}
],
"__meta": [
{
"sourceRange": [
35,
60,
0
]
}
]
},
"thing": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "thing",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
90,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"to": [
0.0,
10.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
90,
0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
83,
89,
0
]
}
]
},
"thing1": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "thing1",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
96,
121,
0
]
},
"from": [
0.0,
10.0
],
"tag": {
"end": 120,
"start": 113,
"type": "TagDeclarator",
"value": "thing1"
},
"to": [
10.0,
10.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
96,
121,
0
],
"tag": {
"end": 120,
"start": 113,
"type": "TagDeclarator",
"value": "thing1"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
113,
120,
0
]
}
]
},
"thing2": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "thing2",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
127,
153,
0
]
},
"from": [
10.0,
10.0
],
"tag": {
"end": 152,
"start": 145,
"type": "TagDeclarator",
"value": "thing2"
},
"to": [
10.0,
0.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
127,
153,
0
],
"tag": {
"end": 152,
"start": 145,
"type": "TagDeclarator",
"value": "thing2"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
145,
152,
0
]
}
]
},
"thing3": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "thing3",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
159,
176,
0
]
},
"from": [
10.0,
0.0
],
"tag": {
"end": 175,
"start": 168,
"type": "TagDeclarator",
"value": "thing3"
},
"to": [
0.0,
0.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
159,
176,
0
],
"tag": {
"end": 175,
"start": 168,
"type": "TagDeclarator",
"value": "thing3"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
168,
175,
0
]
}
]
}
},
"parent": null
}
],
"currentEnv": 0,
"return": null
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

View File

@ -0,0 +1,795 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing basic_fillet_cube_next_adjacent.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "word",
"start": 0,
"end": 7,
"value": "part001"
},
{
"type": "whitespace",
"start": 7,
"end": 8,
"value": " "
},
{
"type": "operator",
"start": 8,
"end": 9,
"value": "="
},
{
"type": "whitespace",
"start": 9,
"end": 10,
"value": " "
},
{
"type": "word",
"start": 10,
"end": 23,
"value": "startSketchOn"
},
{
"type": "brace",
"start": 23,
"end": 24,
"value": "("
},
{
"type": "string",
"start": 24,
"end": 28,
"value": "'XY'"
},
{
"type": "brace",
"start": 28,
"end": 29,
"value": ")"
},
{
"type": "whitespace",
"start": 29,
"end": 32,
"value": "\n "
},
{
"type": "operator",
"start": 32,
"end": 34,
"value": "|>"
},
{
"type": "whitespace",
"start": 34,
"end": 35,
"value": " "
},
{
"type": "word",
"start": 35,
"end": 49,
"value": "startProfileAt"
},
{
"type": "brace",
"start": 49,
"end": 50,
"value": "("
},
{
"type": "brace",
"start": 50,
"end": 51,
"value": "["
},
{
"type": "number",
"start": 51,
"end": 52,
"value": "0"
},
{
"type": "comma",
"start": 52,
"end": 53,
"value": ","
},
{
"type": "whitespace",
"start": 53,
"end": 54,
"value": " "
},
{
"type": "number",
"start": 54,
"end": 55,
"value": "0"
},
{
"type": "brace",
"start": 55,
"end": 56,
"value": "]"
},
{
"type": "comma",
"start": 56,
"end": 57,
"value": ","
},
{
"type": "whitespace",
"start": 57,
"end": 58,
"value": " "
},
{
"type": "operator",
"start": 58,
"end": 59,
"value": "%"
},
{
"type": "brace",
"start": 59,
"end": 60,
"value": ")"
},
{
"type": "whitespace",
"start": 60,
"end": 63,
"value": "\n "
},
{
"type": "operator",
"start": 63,
"end": 65,
"value": "|>"
},
{
"type": "whitespace",
"start": 65,
"end": 66,
"value": " "
},
{
"type": "word",
"start": 66,
"end": 70,
"value": "line"
},
{
"type": "brace",
"start": 70,
"end": 71,
"value": "("
},
{
"type": "brace",
"start": 71,
"end": 72,
"value": "["
},
{
"type": "number",
"start": 72,
"end": 73,
"value": "0"
},
{
"type": "comma",
"start": 73,
"end": 74,
"value": ","
},
{
"type": "whitespace",
"start": 74,
"end": 75,
"value": " "
},
{
"type": "number",
"start": 75,
"end": 77,
"value": "10"
},
{
"type": "brace",
"start": 77,
"end": 78,
"value": "]"
},
{
"type": "comma",
"start": 78,
"end": 79,
"value": ","
},
{
"type": "whitespace",
"start": 79,
"end": 80,
"value": " "
},
{
"type": "operator",
"start": 80,
"end": 81,
"value": "%"
},
{
"type": "comma",
"start": 81,
"end": 82,
"value": ","
},
{
"type": "whitespace",
"start": 82,
"end": 83,
"value": " "
},
{
"type": "dollar",
"start": 83,
"end": 84,
"value": "$"
},
{
"type": "word",
"start": 84,
"end": 89,
"value": "thing"
},
{
"type": "brace",
"start": 89,
"end": 90,
"value": ")"
},
{
"type": "whitespace",
"start": 90,
"end": 93,
"value": "\n "
},
{
"type": "operator",
"start": 93,
"end": 95,
"value": "|>"
},
{
"type": "whitespace",
"start": 95,
"end": 96,
"value": " "
},
{
"type": "word",
"start": 96,
"end": 100,
"value": "line"
},
{
"type": "brace",
"start": 100,
"end": 101,
"value": "("
},
{
"type": "brace",
"start": 101,
"end": 102,
"value": "["
},
{
"type": "number",
"start": 102,
"end": 104,
"value": "10"
},
{
"type": "comma",
"start": 104,
"end": 105,
"value": ","
},
{
"type": "whitespace",
"start": 105,
"end": 106,
"value": " "
},
{
"type": "number",
"start": 106,
"end": 107,
"value": "0"
},
{
"type": "brace",
"start": 107,
"end": 108,
"value": "]"
},
{
"type": "comma",
"start": 108,
"end": 109,
"value": ","
},
{
"type": "whitespace",
"start": 109,
"end": 110,
"value": " "
},
{
"type": "operator",
"start": 110,
"end": 111,
"value": "%"
},
{
"type": "comma",
"start": 111,
"end": 112,
"value": ","
},
{
"type": "whitespace",
"start": 112,
"end": 113,
"value": " "
},
{
"type": "dollar",
"start": 113,
"end": 114,
"value": "$"
},
{
"type": "word",
"start": 114,
"end": 120,
"value": "thing1"
},
{
"type": "brace",
"start": 120,
"end": 121,
"value": ")"
},
{
"type": "whitespace",
"start": 121,
"end": 124,
"value": "\n "
},
{
"type": "operator",
"start": 124,
"end": 126,
"value": "|>"
},
{
"type": "whitespace",
"start": 126,
"end": 127,
"value": " "
},
{
"type": "word",
"start": 127,
"end": 131,
"value": "line"
},
{
"type": "brace",
"start": 131,
"end": 132,
"value": "("
},
{
"type": "brace",
"start": 132,
"end": 133,
"value": "["
},
{
"type": "number",
"start": 133,
"end": 134,
"value": "0"
},
{
"type": "comma",
"start": 134,
"end": 135,
"value": ","
},
{
"type": "whitespace",
"start": 135,
"end": 136,
"value": " "
},
{
"type": "operator",
"start": 136,
"end": 137,
"value": "-"
},
{
"type": "number",
"start": 137,
"end": 139,
"value": "10"
},
{
"type": "brace",
"start": 139,
"end": 140,
"value": "]"
},
{
"type": "comma",
"start": 140,
"end": 141,
"value": ","
},
{
"type": "whitespace",
"start": 141,
"end": 142,
"value": " "
},
{
"type": "operator",
"start": 142,
"end": 143,
"value": "%"
},
{
"type": "comma",
"start": 143,
"end": 144,
"value": ","
},
{
"type": "whitespace",
"start": 144,
"end": 145,
"value": " "
},
{
"type": "dollar",
"start": 145,
"end": 146,
"value": "$"
},
{
"type": "word",
"start": 146,
"end": 152,
"value": "thing2"
},
{
"type": "brace",
"start": 152,
"end": 153,
"value": ")"
},
{
"type": "whitespace",
"start": 153,
"end": 156,
"value": "\n "
},
{
"type": "operator",
"start": 156,
"end": 158,
"value": "|>"
},
{
"type": "whitespace",
"start": 158,
"end": 159,
"value": " "
},
{
"type": "word",
"start": 159,
"end": 164,
"value": "close"
},
{
"type": "brace",
"start": 164,
"end": 165,
"value": "("
},
{
"type": "operator",
"start": 165,
"end": 166,
"value": "%"
},
{
"type": "comma",
"start": 166,
"end": 167,
"value": ","
},
{
"type": "whitespace",
"start": 167,
"end": 168,
"value": " "
},
{
"type": "dollar",
"start": 168,
"end": 169,
"value": "$"
},
{
"type": "word",
"start": 169,
"end": 175,
"value": "thing3"
},
{
"type": "brace",
"start": 175,
"end": 176,
"value": ")"
},
{
"type": "whitespace",
"start": 176,
"end": 179,
"value": "\n "
},
{
"type": "operator",
"start": 179,
"end": 181,
"value": "|>"
},
{
"type": "whitespace",
"start": 181,
"end": 182,
"value": " "
},
{
"type": "word",
"start": 182,
"end": 189,
"value": "extrude"
},
{
"type": "brace",
"start": 189,
"end": 190,
"value": "("
},
{
"type": "number",
"start": 190,
"end": 192,
"value": "10"
},
{
"type": "comma",
"start": 192,
"end": 193,
"value": ","
},
{
"type": "whitespace",
"start": 193,
"end": 194,
"value": " "
},
{
"type": "operator",
"start": 194,
"end": 195,
"value": "%"
},
{
"type": "brace",
"start": 195,
"end": 196,
"value": ")"
},
{
"type": "whitespace",
"start": 196,
"end": 199,
"value": "\n "
},
{
"type": "operator",
"start": 199,
"end": 201,
"value": "|>"
},
{
"type": "whitespace",
"start": 201,
"end": 202,
"value": " "
},
{
"type": "word",
"start": 202,
"end": 208,
"value": "fillet"
},
{
"type": "brace",
"start": 208,
"end": 209,
"value": "("
},
{
"type": "brace",
"start": 209,
"end": 210,
"value": "{"
},
{
"type": "whitespace",
"start": 210,
"end": 218,
"value": "\n "
},
{
"type": "word",
"start": 218,
"end": 224,
"value": "radius"
},
{
"type": "colon",
"start": 224,
"end": 225,
"value": ":"
},
{
"type": "whitespace",
"start": 225,
"end": 226,
"value": " "
},
{
"type": "number",
"start": 226,
"end": 227,
"value": "2"
},
{
"type": "comma",
"start": 227,
"end": 228,
"value": ","
},
{
"type": "whitespace",
"start": 228,
"end": 236,
"value": "\n "
},
{
"type": "word",
"start": 236,
"end": 240,
"value": "tags"
},
{
"type": "colon",
"start": 240,
"end": 241,
"value": ":"
},
{
"type": "whitespace",
"start": 241,
"end": 242,
"value": " "
},
{
"type": "brace",
"start": 242,
"end": 243,
"value": "["
},
{
"type": "word",
"start": 243,
"end": 262,
"value": "getNextAdjacentEdge"
},
{
"type": "brace",
"start": 262,
"end": 263,
"value": "("
},
{
"type": "word",
"start": 263,
"end": 269,
"value": "thing3"
},
{
"type": "brace",
"start": 269,
"end": 270,
"value": ")"
},
{
"type": "brace",
"start": 270,
"end": 271,
"value": "]"
},
{
"type": "whitespace",
"start": 271,
"end": 277,
"value": "\n "
},
{
"type": "brace",
"start": 277,
"end": 278,
"value": "}"
},
{
"type": "comma",
"start": 278,
"end": 279,
"value": ","
},
{
"type": "whitespace",
"start": 279,
"end": 280,
"value": " "
},
{
"type": "operator",
"start": 280,
"end": 281,
"value": "%"
},
{
"type": "brace",
"start": 281,
"end": 282,
"value": ")"
},
{
"type": "whitespace",
"start": 282,
"end": 283,
"value": "\n"
}
]
}

View File

@ -0,0 +1,418 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing basic_fillet_cube_previous_adjacent.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 286,
"id": {
"end": 7,
"name": "part001",
"start": 0,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 28,
"raw": "'XY'",
"start": 24,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 23,
"name": "startSketchOn",
"start": 10,
"type": "Identifier"
},
"end": 29,
"optional": false,
"start": 10,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 52,
"raw": "0",
"start": 51,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 55,
"raw": "0",
"start": 54,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 56,
"start": 50,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 59,
"start": 58,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 49,
"name": "startProfileAt",
"start": 35,
"type": "Identifier"
},
"end": 60,
"optional": false,
"start": 35,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 73,
"raw": "0",
"start": 72,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 77,
"raw": "10",
"start": 75,
"type": "Literal",
"type": "Literal",
"value": 10
}
],
"end": 78,
"start": 71,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 81,
"start": 80,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 89,
"start": 83,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "thing"
}
],
"callee": {
"end": 70,
"name": "line",
"start": 66,
"type": "Identifier"
},
"end": 90,
"optional": false,
"start": 66,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 104,
"raw": "10",
"start": 102,
"type": "Literal",
"type": "Literal",
"value": 10
},
{
"end": 107,
"raw": "0",
"start": 106,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 108,
"start": 101,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 111,
"start": 110,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 120,
"start": 113,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "thing1"
}
],
"callee": {
"end": 100,
"name": "line",
"start": 96,
"type": "Identifier"
},
"end": 121,
"optional": false,
"start": 96,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 134,
"raw": "0",
"start": 133,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"argument": {
"end": 139,
"raw": "10",
"start": 137,
"type": "Literal",
"type": "Literal",
"value": 10
},
"end": 139,
"operator": "-",
"start": 136,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 140,
"start": 132,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 143,
"start": 142,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 152,
"start": 145,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "thing2"
}
],
"callee": {
"end": 131,
"name": "line",
"start": 127,
"type": "Identifier"
},
"end": 153,
"optional": false,
"start": 127,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 166,
"start": 165,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 175,
"start": 168,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "thing3"
}
],
"callee": {
"end": 164,
"name": "close",
"start": 159,
"type": "Identifier"
},
"end": 176,
"optional": false,
"start": 159,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 192,
"raw": "10",
"start": 190,
"type": "Literal",
"type": "Literal",
"value": 10
},
{
"end": 195,
"start": 194,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 189,
"name": "extrude",
"start": 182,
"type": "Identifier"
},
"end": 196,
"optional": false,
"start": 182,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 282,
"properties": [
{
"end": 227,
"key": {
"end": 224,
"name": "radius",
"start": 218,
"type": "Identifier"
},
"start": 218,
"type": "ObjectProperty",
"value": {
"end": 227,
"raw": "2",
"start": 226,
"type": "Literal",
"type": "Literal",
"value": 2
}
},
{
"end": 275,
"key": {
"end": 240,
"name": "tags",
"start": 236,
"type": "Identifier"
},
"start": 236,
"type": "ObjectProperty",
"value": {
"elements": [
{
"arguments": [
{
"end": 273,
"name": "thing3",
"start": 267,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 266,
"name": "getPreviousAdjacentEdge",
"start": 243,
"type": "Identifier"
},
"end": 274,
"optional": false,
"start": 243,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 275,
"start": 242,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"start": 209,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 285,
"start": 284,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 208,
"name": "fillet",
"start": 202,
"type": "Identifier"
},
"end": 286,
"optional": false,
"start": 202,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 286,
"start": 10,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 0,
"type": "VariableDeclarator"
}
],
"end": 286,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 287,
"start": 0
}
}

View File

@ -0,0 +1,11 @@
part001 = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> line([0, 10], %, $thing)
|> line([10, 0], %, $thing1)
|> line([0, -10], %, $thing2)
|> close(%, $thing3)
|> extrude(10, %)
|> fillet({
radius: 2,
tags: [getPreviousAdjacentEdge(thing3)]
}, %)

View File

@ -0,0 +1,766 @@
---
source: kcl/src/simulation_tests.rs
description: Program memory after executing basic_fillet_cube_previous_adjacent.kcl
snapshot_kind: text
---
{
"environments": [
{
"bindings": {
"HALF_TURN": {
"type": "Number",
"value": 180.0,
"__meta": []
},
"QUARTER_TURN": {
"type": "Number",
"value": 90.0,
"__meta": []
},
"THREE_QUARTER_TURN": {
"type": "Number",
"value": 270.0,
"__meta": []
},
"ZERO": {
"type": "Number",
"value": 0.0,
"__meta": []
},
"part001": {
"type": "Solid",
"type": "Solid",
"id": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
90,
0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
96,
121,
0
],
"tag": {
"end": 120,
"start": 113,
"type": "TagDeclarator",
"value": "thing1"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
127,
153,
0
],
"tag": {
"end": 152,
"start": 145,
"type": "TagDeclarator",
"value": "thing2"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
159,
176,
0
],
"tag": {
"end": 175,
"start": 168,
"type": "TagDeclarator",
"value": "thing3"
},
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
90,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"to": [
0.0,
10.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
96,
121,
0
]
},
"from": [
0.0,
10.0
],
"tag": {
"end": 120,
"start": 113,
"type": "TagDeclarator",
"value": "thing1"
},
"to": [
10.0,
10.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
127,
153,
0
]
},
"from": [
10.0,
10.0
],
"tag": {
"end": 152,
"start": 145,
"type": "TagDeclarator",
"value": "thing2"
},
"to": [
10.0,
0.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
159,
176,
0
]
},
"from": [
10.0,
0.0
],
"tag": {
"end": 175,
"start": 168,
"type": "TagDeclarator",
"value": "thing3"
},
"to": [
0.0,
0.0
],
"type": "ToPoint"
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"__meta": []
},
"start": {
"from": [
0.0,
0.0
],
"to": [
0.0,
0.0
],
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
35,
60,
0
]
}
},
"tags": {
"thing": {
"type": "TagIdentifier",
"value": "thing",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
90,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"to": [
0.0,
10.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
90,
0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
83,
89,
0
]
}
]
},
"thing1": {
"type": "TagIdentifier",
"value": "thing1",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
96,
121,
0
]
},
"from": [
0.0,
10.0
],
"tag": {
"end": 120,
"start": 113,
"type": "TagDeclarator",
"value": "thing1"
},
"to": [
10.0,
10.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
96,
121,
0
],
"tag": {
"end": 120,
"start": 113,
"type": "TagDeclarator",
"value": "thing1"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
113,
120,
0
]
}
]
},
"thing2": {
"type": "TagIdentifier",
"value": "thing2",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
127,
153,
0
]
},
"from": [
10.0,
10.0
],
"tag": {
"end": 152,
"start": 145,
"type": "TagDeclarator",
"value": "thing2"
},
"to": [
10.0,
0.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
127,
153,
0
],
"tag": {
"end": 152,
"start": 145,
"type": "TagDeclarator",
"value": "thing2"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
145,
152,
0
]
}
]
},
"thing3": {
"type": "TagIdentifier",
"value": "thing3",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
159,
176,
0
]
},
"from": [
10.0,
0.0
],
"tag": {
"end": 175,
"start": 168,
"type": "TagDeclarator",
"value": "thing3"
},
"to": [
0.0,
0.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
159,
176,
0
],
"tag": {
"end": 175,
"start": 168,
"type": "TagDeclarator",
"value": "thing3"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
168,
175,
0
]
}
]
}
},
"__meta": [
{
"sourceRange": [
35,
60,
0
]
}
]
},
"height": 10.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"edgeCuts": [
{
"type": "fillet",
"id": "[uuid]",
"radius": 2.0,
"edgeId": "[uuid]",
"tag": null
}
],
"__meta": [
{
"sourceRange": [
35,
60,
0
]
}
]
},
"thing": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "thing",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
90,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"to": [
0.0,
10.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
90,
0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
83,
89,
0
]
}
]
},
"thing1": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "thing1",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
96,
121,
0
]
},
"from": [
0.0,
10.0
],
"tag": {
"end": 120,
"start": 113,
"type": "TagDeclarator",
"value": "thing1"
},
"to": [
10.0,
10.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
96,
121,
0
],
"tag": {
"end": 120,
"start": 113,
"type": "TagDeclarator",
"value": "thing1"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
113,
120,
0
]
}
]
},
"thing2": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "thing2",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
127,
153,
0
]
},
"from": [
10.0,
10.0
],
"tag": {
"end": 152,
"start": 145,
"type": "TagDeclarator",
"value": "thing2"
},
"to": [
10.0,
0.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
127,
153,
0
],
"tag": {
"end": 152,
"start": 145,
"type": "TagDeclarator",
"value": "thing2"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
145,
152,
0
]
}
]
},
"thing3": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "thing3",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
159,
176,
0
]
},
"from": [
10.0,
0.0
],
"tag": {
"end": 175,
"start": 168,
"type": "TagDeclarator",
"value": "thing3"
},
"to": [
0.0,
0.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
159,
176,
0
],
"tag": {
"end": 175,
"start": 168,
"type": "TagDeclarator",
"value": "thing3"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
168,
175,
0
]
}
]
}
},
"parent": null
}
],
"currentEnv": 0,
"return": null
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

View File

@ -0,0 +1,795 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing basic_fillet_cube_previous_adjacent.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "word",
"start": 0,
"end": 7,
"value": "part001"
},
{
"type": "whitespace",
"start": 7,
"end": 8,
"value": " "
},
{
"type": "operator",
"start": 8,
"end": 9,
"value": "="
},
{
"type": "whitespace",
"start": 9,
"end": 10,
"value": " "
},
{
"type": "word",
"start": 10,
"end": 23,
"value": "startSketchOn"
},
{
"type": "brace",
"start": 23,
"end": 24,
"value": "("
},
{
"type": "string",
"start": 24,
"end": 28,
"value": "'XY'"
},
{
"type": "brace",
"start": 28,
"end": 29,
"value": ")"
},
{
"type": "whitespace",
"start": 29,
"end": 32,
"value": "\n "
},
{
"type": "operator",
"start": 32,
"end": 34,
"value": "|>"
},
{
"type": "whitespace",
"start": 34,
"end": 35,
"value": " "
},
{
"type": "word",
"start": 35,
"end": 49,
"value": "startProfileAt"
},
{
"type": "brace",
"start": 49,
"end": 50,
"value": "("
},
{
"type": "brace",
"start": 50,
"end": 51,
"value": "["
},
{
"type": "number",
"start": 51,
"end": 52,
"value": "0"
},
{
"type": "comma",
"start": 52,
"end": 53,
"value": ","
},
{
"type": "whitespace",
"start": 53,
"end": 54,
"value": " "
},
{
"type": "number",
"start": 54,
"end": 55,
"value": "0"
},
{
"type": "brace",
"start": 55,
"end": 56,
"value": "]"
},
{
"type": "comma",
"start": 56,
"end": 57,
"value": ","
},
{
"type": "whitespace",
"start": 57,
"end": 58,
"value": " "
},
{
"type": "operator",
"start": 58,
"end": 59,
"value": "%"
},
{
"type": "brace",
"start": 59,
"end": 60,
"value": ")"
},
{
"type": "whitespace",
"start": 60,
"end": 63,
"value": "\n "
},
{
"type": "operator",
"start": 63,
"end": 65,
"value": "|>"
},
{
"type": "whitespace",
"start": 65,
"end": 66,
"value": " "
},
{
"type": "word",
"start": 66,
"end": 70,
"value": "line"
},
{
"type": "brace",
"start": 70,
"end": 71,
"value": "("
},
{
"type": "brace",
"start": 71,
"end": 72,
"value": "["
},
{
"type": "number",
"start": 72,
"end": 73,
"value": "0"
},
{
"type": "comma",
"start": 73,
"end": 74,
"value": ","
},
{
"type": "whitespace",
"start": 74,
"end": 75,
"value": " "
},
{
"type": "number",
"start": 75,
"end": 77,
"value": "10"
},
{
"type": "brace",
"start": 77,
"end": 78,
"value": "]"
},
{
"type": "comma",
"start": 78,
"end": 79,
"value": ","
},
{
"type": "whitespace",
"start": 79,
"end": 80,
"value": " "
},
{
"type": "operator",
"start": 80,
"end": 81,
"value": "%"
},
{
"type": "comma",
"start": 81,
"end": 82,
"value": ","
},
{
"type": "whitespace",
"start": 82,
"end": 83,
"value": " "
},
{
"type": "dollar",
"start": 83,
"end": 84,
"value": "$"
},
{
"type": "word",
"start": 84,
"end": 89,
"value": "thing"
},
{
"type": "brace",
"start": 89,
"end": 90,
"value": ")"
},
{
"type": "whitespace",
"start": 90,
"end": 93,
"value": "\n "
},
{
"type": "operator",
"start": 93,
"end": 95,
"value": "|>"
},
{
"type": "whitespace",
"start": 95,
"end": 96,
"value": " "
},
{
"type": "word",
"start": 96,
"end": 100,
"value": "line"
},
{
"type": "brace",
"start": 100,
"end": 101,
"value": "("
},
{
"type": "brace",
"start": 101,
"end": 102,
"value": "["
},
{
"type": "number",
"start": 102,
"end": 104,
"value": "10"
},
{
"type": "comma",
"start": 104,
"end": 105,
"value": ","
},
{
"type": "whitespace",
"start": 105,
"end": 106,
"value": " "
},
{
"type": "number",
"start": 106,
"end": 107,
"value": "0"
},
{
"type": "brace",
"start": 107,
"end": 108,
"value": "]"
},
{
"type": "comma",
"start": 108,
"end": 109,
"value": ","
},
{
"type": "whitespace",
"start": 109,
"end": 110,
"value": " "
},
{
"type": "operator",
"start": 110,
"end": 111,
"value": "%"
},
{
"type": "comma",
"start": 111,
"end": 112,
"value": ","
},
{
"type": "whitespace",
"start": 112,
"end": 113,
"value": " "
},
{
"type": "dollar",
"start": 113,
"end": 114,
"value": "$"
},
{
"type": "word",
"start": 114,
"end": 120,
"value": "thing1"
},
{
"type": "brace",
"start": 120,
"end": 121,
"value": ")"
},
{
"type": "whitespace",
"start": 121,
"end": 124,
"value": "\n "
},
{
"type": "operator",
"start": 124,
"end": 126,
"value": "|>"
},
{
"type": "whitespace",
"start": 126,
"end": 127,
"value": " "
},
{
"type": "word",
"start": 127,
"end": 131,
"value": "line"
},
{
"type": "brace",
"start": 131,
"end": 132,
"value": "("
},
{
"type": "brace",
"start": 132,
"end": 133,
"value": "["
},
{
"type": "number",
"start": 133,
"end": 134,
"value": "0"
},
{
"type": "comma",
"start": 134,
"end": 135,
"value": ","
},
{
"type": "whitespace",
"start": 135,
"end": 136,
"value": " "
},
{
"type": "operator",
"start": 136,
"end": 137,
"value": "-"
},
{
"type": "number",
"start": 137,
"end": 139,
"value": "10"
},
{
"type": "brace",
"start": 139,
"end": 140,
"value": "]"
},
{
"type": "comma",
"start": 140,
"end": 141,
"value": ","
},
{
"type": "whitespace",
"start": 141,
"end": 142,
"value": " "
},
{
"type": "operator",
"start": 142,
"end": 143,
"value": "%"
},
{
"type": "comma",
"start": 143,
"end": 144,
"value": ","
},
{
"type": "whitespace",
"start": 144,
"end": 145,
"value": " "
},
{
"type": "dollar",
"start": 145,
"end": 146,
"value": "$"
},
{
"type": "word",
"start": 146,
"end": 152,
"value": "thing2"
},
{
"type": "brace",
"start": 152,
"end": 153,
"value": ")"
},
{
"type": "whitespace",
"start": 153,
"end": 156,
"value": "\n "
},
{
"type": "operator",
"start": 156,
"end": 158,
"value": "|>"
},
{
"type": "whitespace",
"start": 158,
"end": 159,
"value": " "
},
{
"type": "word",
"start": 159,
"end": 164,
"value": "close"
},
{
"type": "brace",
"start": 164,
"end": 165,
"value": "("
},
{
"type": "operator",
"start": 165,
"end": 166,
"value": "%"
},
{
"type": "comma",
"start": 166,
"end": 167,
"value": ","
},
{
"type": "whitespace",
"start": 167,
"end": 168,
"value": " "
},
{
"type": "dollar",
"start": 168,
"end": 169,
"value": "$"
},
{
"type": "word",
"start": 169,
"end": 175,
"value": "thing3"
},
{
"type": "brace",
"start": 175,
"end": 176,
"value": ")"
},
{
"type": "whitespace",
"start": 176,
"end": 179,
"value": "\n "
},
{
"type": "operator",
"start": 179,
"end": 181,
"value": "|>"
},
{
"type": "whitespace",
"start": 181,
"end": 182,
"value": " "
},
{
"type": "word",
"start": 182,
"end": 189,
"value": "extrude"
},
{
"type": "brace",
"start": 189,
"end": 190,
"value": "("
},
{
"type": "number",
"start": 190,
"end": 192,
"value": "10"
},
{
"type": "comma",
"start": 192,
"end": 193,
"value": ","
},
{
"type": "whitespace",
"start": 193,
"end": 194,
"value": " "
},
{
"type": "operator",
"start": 194,
"end": 195,
"value": "%"
},
{
"type": "brace",
"start": 195,
"end": 196,
"value": ")"
},
{
"type": "whitespace",
"start": 196,
"end": 199,
"value": "\n "
},
{
"type": "operator",
"start": 199,
"end": 201,
"value": "|>"
},
{
"type": "whitespace",
"start": 201,
"end": 202,
"value": " "
},
{
"type": "word",
"start": 202,
"end": 208,
"value": "fillet"
},
{
"type": "brace",
"start": 208,
"end": 209,
"value": "("
},
{
"type": "brace",
"start": 209,
"end": 210,
"value": "{"
},
{
"type": "whitespace",
"start": 210,
"end": 218,
"value": "\n "
},
{
"type": "word",
"start": 218,
"end": 224,
"value": "radius"
},
{
"type": "colon",
"start": 224,
"end": 225,
"value": ":"
},
{
"type": "whitespace",
"start": 225,
"end": 226,
"value": " "
},
{
"type": "number",
"start": 226,
"end": 227,
"value": "2"
},
{
"type": "comma",
"start": 227,
"end": 228,
"value": ","
},
{
"type": "whitespace",
"start": 228,
"end": 236,
"value": "\n "
},
{
"type": "word",
"start": 236,
"end": 240,
"value": "tags"
},
{
"type": "colon",
"start": 240,
"end": 241,
"value": ":"
},
{
"type": "whitespace",
"start": 241,
"end": 242,
"value": " "
},
{
"type": "brace",
"start": 242,
"end": 243,
"value": "["
},
{
"type": "word",
"start": 243,
"end": 266,
"value": "getPreviousAdjacentEdge"
},
{
"type": "brace",
"start": 266,
"end": 267,
"value": "("
},
{
"type": "word",
"start": 267,
"end": 273,
"value": "thing3"
},
{
"type": "brace",
"start": 273,
"end": 274,
"value": ")"
},
{
"type": "brace",
"start": 274,
"end": 275,
"value": "]"
},
{
"type": "whitespace",
"start": 275,
"end": 281,
"value": "\n "
},
{
"type": "brace",
"start": 281,
"end": 282,
"value": "}"
},
{
"type": "comma",
"start": 282,
"end": 283,
"value": ","
},
{
"type": "whitespace",
"start": 283,
"end": 284,
"value": " "
},
{
"type": "operator",
"start": 284,
"end": 285,
"value": "%"
},
{
"type": "brace",
"start": 285,
"end": 286,
"value": ")"
},
{
"type": "whitespace",
"start": 286,
"end": 287,
"value": "\n"
}
]
}

View File

@ -0,0 +1,396 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing basic_fillet_cube_start.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 231,
"id": {
"end": 7,
"name": "part001",
"start": 0,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 28,
"raw": "'XY'",
"start": 24,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 23,
"name": "startSketchOn",
"start": 10,
"type": "Identifier"
},
"end": 29,
"optional": false,
"start": 10,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 52,
"raw": "0",
"start": 51,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 55,
"raw": "0",
"start": 54,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 56,
"start": 50,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 59,
"start": 58,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 49,
"name": "startProfileAt",
"start": 35,
"type": "Identifier"
},
"end": 60,
"optional": false,
"start": 35,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 73,
"raw": "0",
"start": 72,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 77,
"raw": "10",
"start": 75,
"type": "Literal",
"type": "Literal",
"value": 10
}
],
"end": 78,
"start": 71,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 81,
"start": 80,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 89,
"start": 83,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "thing"
}
],
"callee": {
"end": 70,
"name": "line",
"start": 66,
"type": "Identifier"
},
"end": 90,
"optional": false,
"start": 66,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 104,
"raw": "10",
"start": 102,
"type": "Literal",
"type": "Literal",
"value": 10
},
{
"end": 107,
"raw": "0",
"start": 106,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 108,
"start": 101,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 111,
"start": 110,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 100,
"name": "line",
"start": 96,
"type": "Identifier"
},
"end": 112,
"optional": false,
"start": 96,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 125,
"raw": "0",
"start": 124,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"argument": {
"end": 130,
"raw": "10",
"start": 128,
"type": "Literal",
"type": "Literal",
"value": 10
},
"end": 130,
"operator": "-",
"start": 127,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 131,
"start": 123,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 134,
"start": 133,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 143,
"start": 136,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "thing2"
}
],
"callee": {
"end": 122,
"name": "line",
"start": 118,
"type": "Identifier"
},
"end": 144,
"optional": false,
"start": 118,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 157,
"start": 156,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 155,
"name": "close",
"start": 150,
"type": "Identifier"
},
"end": 158,
"optional": false,
"start": 150,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 174,
"raw": "10",
"start": 172,
"type": "Literal",
"type": "Literal",
"value": 10
},
{
"end": 177,
"start": 176,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 171,
"name": "extrude",
"start": 164,
"type": "Identifier"
},
"end": 178,
"optional": false,
"start": 164,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 227,
"properties": [
{
"end": 202,
"key": {
"end": 199,
"name": "radius",
"start": 193,
"type": "Identifier"
},
"start": 193,
"type": "ObjectProperty",
"value": {
"end": 202,
"raw": "2",
"start": 201,
"type": "Literal",
"type": "Literal",
"value": 2
}
},
{
"end": 225,
"key": {
"end": 208,
"name": "tags",
"start": 204,
"type": "Identifier"
},
"start": 204,
"type": "ObjectProperty",
"value": {
"elements": [
{
"end": 216,
"name": "thing",
"start": 211,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 224,
"name": "thing2",
"start": 218,
"type": "Identifier",
"type": "Identifier"
}
],
"end": 225,
"start": 210,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"start": 191,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 230,
"start": 229,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 190,
"name": "fillet",
"start": 184,
"type": "Identifier"
},
"end": 231,
"optional": false,
"start": 184,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 231,
"start": 10,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 0,
"type": "VariableDeclarator"
}
],
"end": 231,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 232,
"start": 0
}
}

View File

@ -0,0 +1,8 @@
part001 = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> line([0, 10], %, $thing)
|> line([10, 0], %)
|> line([0, -10], %, $thing2)
|> close(%)
|> extrude(10, %)
|> fillet({ radius: 2, tags: [thing, thing2] }, %)

View File

@ -0,0 +1,515 @@
---
source: kcl/src/simulation_tests.rs
description: Program memory after executing basic_fillet_cube_start.kcl
snapshot_kind: text
---
{
"environments": [
{
"bindings": {
"HALF_TURN": {
"type": "Number",
"value": 180.0,
"__meta": []
},
"QUARTER_TURN": {
"type": "Number",
"value": 90.0,
"__meta": []
},
"THREE_QUARTER_TURN": {
"type": "Number",
"value": 270.0,
"__meta": []
},
"ZERO": {
"type": "Number",
"value": 0.0,
"__meta": []
},
"part001": {
"type": "Solid",
"type": "Solid",
"id": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
90,
0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
96,
112,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
118,
144,
0
],
"tag": {
"end": 143,
"start": 136,
"type": "TagDeclarator",
"value": "thing2"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
150,
158,
0
],
"tag": null,
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
90,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"to": [
0.0,
10.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
96,
112,
0
]
},
"from": [
0.0,
10.0
],
"tag": null,
"to": [
10.0,
10.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
118,
144,
0
]
},
"from": [
10.0,
10.0
],
"tag": {
"end": 143,
"start": 136,
"type": "TagDeclarator",
"value": "thing2"
},
"to": [
10.0,
0.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
150,
158,
0
]
},
"from": [
10.0,
0.0
],
"tag": null,
"to": [
0.0,
0.0
],
"type": "ToPoint"
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"__meta": []
},
"start": {
"from": [
0.0,
0.0
],
"to": [
0.0,
0.0
],
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
35,
60,
0
]
}
},
"tags": {
"thing": {
"type": "TagIdentifier",
"value": "thing",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
90,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"to": [
0.0,
10.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
90,
0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
83,
89,
0
]
}
]
},
"thing2": {
"type": "TagIdentifier",
"value": "thing2",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
118,
144,
0
]
},
"from": [
10.0,
10.0
],
"tag": {
"end": 143,
"start": 136,
"type": "TagDeclarator",
"value": "thing2"
},
"to": [
10.0,
0.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
118,
144,
0
],
"tag": {
"end": 143,
"start": 136,
"type": "TagDeclarator",
"value": "thing2"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
136,
143,
0
]
}
]
}
},
"__meta": [
{
"sourceRange": [
35,
60,
0
]
}
]
},
"height": 10.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"edgeCuts": [
{
"type": "fillet",
"id": "[uuid]",
"radius": 2.0,
"edgeId": "[uuid]",
"tag": null
},
{
"type": "fillet",
"id": "[uuid]",
"radius": 2.0,
"edgeId": "[uuid]",
"tag": null
}
],
"__meta": [
{
"sourceRange": [
35,
60,
0
]
}
]
},
"thing": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "thing",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
90,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"to": [
0.0,
10.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
90,
0
],
"tag": {
"end": 89,
"start": 83,
"type": "TagDeclarator",
"value": "thing"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
83,
89,
0
]
}
]
},
"thing2": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "thing2",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
118,
144,
0
]
},
"from": [
10.0,
10.0
],
"tag": {
"end": 143,
"start": 136,
"type": "TagDeclarator",
"value": "thing2"
},
"to": [
10.0,
0.0
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
118,
144,
0
],
"tag": {
"end": 143,
"start": 136,
"type": "TagDeclarator",
"value": "thing2"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
136,
143,
0
]
}
]
}
},
"parent": null
}
],
"currentEnv": 0,
"return": null
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

View File

@ -0,0 +1,747 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing basic_fillet_cube_start.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "word",
"start": 0,
"end": 7,
"value": "part001"
},
{
"type": "whitespace",
"start": 7,
"end": 8,
"value": " "
},
{
"type": "operator",
"start": 8,
"end": 9,
"value": "="
},
{
"type": "whitespace",
"start": 9,
"end": 10,
"value": " "
},
{
"type": "word",
"start": 10,
"end": 23,
"value": "startSketchOn"
},
{
"type": "brace",
"start": 23,
"end": 24,
"value": "("
},
{
"type": "string",
"start": 24,
"end": 28,
"value": "'XY'"
},
{
"type": "brace",
"start": 28,
"end": 29,
"value": ")"
},
{
"type": "whitespace",
"start": 29,
"end": 32,
"value": "\n "
},
{
"type": "operator",
"start": 32,
"end": 34,
"value": "|>"
},
{
"type": "whitespace",
"start": 34,
"end": 35,
"value": " "
},
{
"type": "word",
"start": 35,
"end": 49,
"value": "startProfileAt"
},
{
"type": "brace",
"start": 49,
"end": 50,
"value": "("
},
{
"type": "brace",
"start": 50,
"end": 51,
"value": "["
},
{
"type": "number",
"start": 51,
"end": 52,
"value": "0"
},
{
"type": "comma",
"start": 52,
"end": 53,
"value": ","
},
{
"type": "whitespace",
"start": 53,
"end": 54,
"value": " "
},
{
"type": "number",
"start": 54,
"end": 55,
"value": "0"
},
{
"type": "brace",
"start": 55,
"end": 56,
"value": "]"
},
{
"type": "comma",
"start": 56,
"end": 57,
"value": ","
},
{
"type": "whitespace",
"start": 57,
"end": 58,
"value": " "
},
{
"type": "operator",
"start": 58,
"end": 59,
"value": "%"
},
{
"type": "brace",
"start": 59,
"end": 60,
"value": ")"
},
{
"type": "whitespace",
"start": 60,
"end": 63,
"value": "\n "
},
{
"type": "operator",
"start": 63,
"end": 65,
"value": "|>"
},
{
"type": "whitespace",
"start": 65,
"end": 66,
"value": " "
},
{
"type": "word",
"start": 66,
"end": 70,
"value": "line"
},
{
"type": "brace",
"start": 70,
"end": 71,
"value": "("
},
{
"type": "brace",
"start": 71,
"end": 72,
"value": "["
},
{
"type": "number",
"start": 72,
"end": 73,
"value": "0"
},
{
"type": "comma",
"start": 73,
"end": 74,
"value": ","
},
{
"type": "whitespace",
"start": 74,
"end": 75,
"value": " "
},
{
"type": "number",
"start": 75,
"end": 77,
"value": "10"
},
{
"type": "brace",
"start": 77,
"end": 78,
"value": "]"
},
{
"type": "comma",
"start": 78,
"end": 79,
"value": ","
},
{
"type": "whitespace",
"start": 79,
"end": 80,
"value": " "
},
{
"type": "operator",
"start": 80,
"end": 81,
"value": "%"
},
{
"type": "comma",
"start": 81,
"end": 82,
"value": ","
},
{
"type": "whitespace",
"start": 82,
"end": 83,
"value": " "
},
{
"type": "dollar",
"start": 83,
"end": 84,
"value": "$"
},
{
"type": "word",
"start": 84,
"end": 89,
"value": "thing"
},
{
"type": "brace",
"start": 89,
"end": 90,
"value": ")"
},
{
"type": "whitespace",
"start": 90,
"end": 93,
"value": "\n "
},
{
"type": "operator",
"start": 93,
"end": 95,
"value": "|>"
},
{
"type": "whitespace",
"start": 95,
"end": 96,
"value": " "
},
{
"type": "word",
"start": 96,
"end": 100,
"value": "line"
},
{
"type": "brace",
"start": 100,
"end": 101,
"value": "("
},
{
"type": "brace",
"start": 101,
"end": 102,
"value": "["
},
{
"type": "number",
"start": 102,
"end": 104,
"value": "10"
},
{
"type": "comma",
"start": 104,
"end": 105,
"value": ","
},
{
"type": "whitespace",
"start": 105,
"end": 106,
"value": " "
},
{
"type": "number",
"start": 106,
"end": 107,
"value": "0"
},
{
"type": "brace",
"start": 107,
"end": 108,
"value": "]"
},
{
"type": "comma",
"start": 108,
"end": 109,
"value": ","
},
{
"type": "whitespace",
"start": 109,
"end": 110,
"value": " "
},
{
"type": "operator",
"start": 110,
"end": 111,
"value": "%"
},
{
"type": "brace",
"start": 111,
"end": 112,
"value": ")"
},
{
"type": "whitespace",
"start": 112,
"end": 115,
"value": "\n "
},
{
"type": "operator",
"start": 115,
"end": 117,
"value": "|>"
},
{
"type": "whitespace",
"start": 117,
"end": 118,
"value": " "
},
{
"type": "word",
"start": 118,
"end": 122,
"value": "line"
},
{
"type": "brace",
"start": 122,
"end": 123,
"value": "("
},
{
"type": "brace",
"start": 123,
"end": 124,
"value": "["
},
{
"type": "number",
"start": 124,
"end": 125,
"value": "0"
},
{
"type": "comma",
"start": 125,
"end": 126,
"value": ","
},
{
"type": "whitespace",
"start": 126,
"end": 127,
"value": " "
},
{
"type": "operator",
"start": 127,
"end": 128,
"value": "-"
},
{
"type": "number",
"start": 128,
"end": 130,
"value": "10"
},
{
"type": "brace",
"start": 130,
"end": 131,
"value": "]"
},
{
"type": "comma",
"start": 131,
"end": 132,
"value": ","
},
{
"type": "whitespace",
"start": 132,
"end": 133,
"value": " "
},
{
"type": "operator",
"start": 133,
"end": 134,
"value": "%"
},
{
"type": "comma",
"start": 134,
"end": 135,
"value": ","
},
{
"type": "whitespace",
"start": 135,
"end": 136,
"value": " "
},
{
"type": "dollar",
"start": 136,
"end": 137,
"value": "$"
},
{
"type": "word",
"start": 137,
"end": 143,
"value": "thing2"
},
{
"type": "brace",
"start": 143,
"end": 144,
"value": ")"
},
{
"type": "whitespace",
"start": 144,
"end": 147,
"value": "\n "
},
{
"type": "operator",
"start": 147,
"end": 149,
"value": "|>"
},
{
"type": "whitespace",
"start": 149,
"end": 150,
"value": " "
},
{
"type": "word",
"start": 150,
"end": 155,
"value": "close"
},
{
"type": "brace",
"start": 155,
"end": 156,
"value": "("
},
{
"type": "operator",
"start": 156,
"end": 157,
"value": "%"
},
{
"type": "brace",
"start": 157,
"end": 158,
"value": ")"
},
{
"type": "whitespace",
"start": 158,
"end": 161,
"value": "\n "
},
{
"type": "operator",
"start": 161,
"end": 163,
"value": "|>"
},
{
"type": "whitespace",
"start": 163,
"end": 164,
"value": " "
},
{
"type": "word",
"start": 164,
"end": 171,
"value": "extrude"
},
{
"type": "brace",
"start": 171,
"end": 172,
"value": "("
},
{
"type": "number",
"start": 172,
"end": 174,
"value": "10"
},
{
"type": "comma",
"start": 174,
"end": 175,
"value": ","
},
{
"type": "whitespace",
"start": 175,
"end": 176,
"value": " "
},
{
"type": "operator",
"start": 176,
"end": 177,
"value": "%"
},
{
"type": "brace",
"start": 177,
"end": 178,
"value": ")"
},
{
"type": "whitespace",
"start": 178,
"end": 181,
"value": "\n "
},
{
"type": "operator",
"start": 181,
"end": 183,
"value": "|>"
},
{
"type": "whitespace",
"start": 183,
"end": 184,
"value": " "
},
{
"type": "word",
"start": 184,
"end": 190,
"value": "fillet"
},
{
"type": "brace",
"start": 190,
"end": 191,
"value": "("
},
{
"type": "brace",
"start": 191,
"end": 192,
"value": "{"
},
{
"type": "whitespace",
"start": 192,
"end": 193,
"value": " "
},
{
"type": "word",
"start": 193,
"end": 199,
"value": "radius"
},
{
"type": "colon",
"start": 199,
"end": 200,
"value": ":"
},
{
"type": "whitespace",
"start": 200,
"end": 201,
"value": " "
},
{
"type": "number",
"start": 201,
"end": 202,
"value": "2"
},
{
"type": "comma",
"start": 202,
"end": 203,
"value": ","
},
{
"type": "whitespace",
"start": 203,
"end": 204,
"value": " "
},
{
"type": "word",
"start": 204,
"end": 208,
"value": "tags"
},
{
"type": "colon",
"start": 208,
"end": 209,
"value": ":"
},
{
"type": "whitespace",
"start": 209,
"end": 210,
"value": " "
},
{
"type": "brace",
"start": 210,
"end": 211,
"value": "["
},
{
"type": "word",
"start": 211,
"end": 216,
"value": "thing"
},
{
"type": "comma",
"start": 216,
"end": 217,
"value": ","
},
{
"type": "whitespace",
"start": 217,
"end": 218,
"value": " "
},
{
"type": "word",
"start": 218,
"end": 224,
"value": "thing2"
},
{
"type": "brace",
"start": 224,
"end": 225,
"value": "]"
},
{
"type": "whitespace",
"start": 225,
"end": 226,
"value": " "
},
{
"type": "brace",
"start": 226,
"end": 227,
"value": "}"
},
{
"type": "comma",
"start": 227,
"end": 228,
"value": ","
},
{
"type": "whitespace",
"start": 228,
"end": 229,
"value": " "
},
{
"type": "operator",
"start": 229,
"end": 230,
"value": "%"
},
{
"type": "brace",
"start": 230,
"end": 231,
"value": ")"
},
{
"type": "whitespace",
"start": 231,
"end": 232,
"value": "\n"
}
]
}

View File

@ -0,0 +1,291 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing big_number_angle_to_match_length_x.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 188,
"id": {
"end": 7,
"name": "part001",
"start": 0,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 28,
"raw": "'XY'",
"start": 24,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 23,
"name": "startSketchOn",
"start": 10,
"type": "Identifier"
},
"end": 29,
"optional": false,
"start": 10,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 52,
"raw": "0",
"start": 51,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 55,
"raw": "0",
"start": 54,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 56,
"start": 50,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 59,
"start": 58,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 49,
"name": "startProfileAt",
"start": 35,
"type": "Identifier"
},
"end": 60,
"optional": false,
"start": 35,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 73,
"raw": "1",
"start": 72,
"type": "Literal",
"type": "Literal",
"value": 1
},
{
"end": 79,
"raw": "3.82",
"start": 75,
"type": "Literal",
"type": "Literal",
"value": 3.82
}
],
"end": 80,
"start": 71,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 83,
"start": 82,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 91,
"start": 85,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "seg01"
}
],
"callee": {
"end": 70,
"name": "line",
"start": 66,
"type": "Identifier"
},
"end": 92,
"optional": false,
"start": 66,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"argument": {
"arguments": [
{
"end": 139,
"name": "seg01",
"start": 134,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 142,
"raw": "3",
"start": 141,
"type": "Literal",
"type": "Literal",
"value": 3
},
{
"end": 145,
"start": 144,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 133,
"name": "angleToMatchLengthX",
"start": 114,
"type": "Identifier"
},
"end": 146,
"optional": false,
"start": 114,
"type": "CallExpression",
"type": "CallExpression"
},
"end": 146,
"operator": "-",
"start": 113,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"end": 149,
"raw": "3",
"start": 148,
"type": "Literal",
"type": "Literal",
"value": 3
}
],
"end": 150,
"start": 112,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 153,
"start": 152,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 111,
"name": "angledLineToX",
"start": 98,
"type": "Identifier"
},
"end": 154,
"optional": false,
"start": 98,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 167,
"start": 166,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 165,
"name": "close",
"start": 160,
"type": "Identifier"
},
"end": 168,
"optional": false,
"start": 160,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 184,
"raw": "10",
"start": 182,
"type": "Literal",
"type": "Literal",
"value": 10
},
{
"end": 187,
"start": 186,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 181,
"name": "extrude",
"start": 174,
"type": "Identifier"
},
"end": 188,
"optional": false,
"start": 174,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 188,
"start": 10,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 0,
"type": "VariableDeclarator"
}
],
"end": 188,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 189,
"start": 0
}
}

View File

@ -0,0 +1,6 @@
part001 = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> line([1, 3.82], %, $seg01)
|> angledLineToX([-angleToMatchLengthX(seg01, 3, %), 3], %)
|> close(%)
|> extrude(10, %)

View File

@ -0,0 +1,339 @@
---
source: kcl/src/simulation_tests.rs
description: Program memory after executing big_number_angle_to_match_length_x.kcl
snapshot_kind: text
---
{
"environments": [
{
"bindings": {
"HALF_TURN": {
"type": "Number",
"value": 180.0,
"__meta": []
},
"QUARTER_TURN": {
"type": "Number",
"value": 90.0,
"__meta": []
},
"THREE_QUARTER_TURN": {
"type": "Number",
"value": 270.0,
"__meta": []
},
"ZERO": {
"type": "Number",
"value": 0.0,
"__meta": []
},
"part001": {
"type": "Solid",
"type": "Solid",
"id": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
92,
0
],
"tag": {
"end": 91,
"start": 85,
"type": "TagDeclarator",
"value": "seg01"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
98,
154,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
160,
168,
0
],
"tag": null,
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
92,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 91,
"start": 85,
"type": "TagDeclarator",
"value": "seg01"
},
"to": [
1.0,
3.82
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
98,
154,
0
]
},
"from": [
1.0,
3.82
],
"tag": null,
"to": [
3.0,
0.4152
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
160,
168,
0
]
},
"from": [
3.0,
0.4152
],
"tag": null,
"to": [
0.0,
0.0
],
"type": "ToPoint"
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"__meta": []
},
"start": {
"from": [
0.0,
0.0
],
"to": [
0.0,
0.0
],
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
35,
60,
0
]
}
},
"tags": {
"seg01": {
"type": "TagIdentifier",
"value": "seg01",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
92,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 91,
"start": 85,
"type": "TagDeclarator",
"value": "seg01"
},
"to": [
1.0,
3.82
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
92,
0
],
"tag": {
"end": 91,
"start": 85,
"type": "TagDeclarator",
"value": "seg01"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
85,
91,
0
]
}
]
}
},
"__meta": [
{
"sourceRange": [
35,
60,
0
]
}
]
},
"height": 10.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"__meta": [
{
"sourceRange": [
35,
60,
0
]
}
]
},
"seg01": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "seg01",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
92,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 91,
"start": 85,
"type": "TagDeclarator",
"value": "seg01"
},
"to": [
1.0,
3.82
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
92,
0
],
"tag": {
"end": 91,
"start": 85,
"type": "TagDeclarator",
"value": "seg01"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
85,
91,
0
]
}
]
}
},
"parent": null
}
],
"currentEnv": 0,
"return": null
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

View File

@ -0,0 +1,519 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing big_number_angle_to_match_length_x.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "word",
"start": 0,
"end": 7,
"value": "part001"
},
{
"type": "whitespace",
"start": 7,
"end": 8,
"value": " "
},
{
"type": "operator",
"start": 8,
"end": 9,
"value": "="
},
{
"type": "whitespace",
"start": 9,
"end": 10,
"value": " "
},
{
"type": "word",
"start": 10,
"end": 23,
"value": "startSketchOn"
},
{
"type": "brace",
"start": 23,
"end": 24,
"value": "("
},
{
"type": "string",
"start": 24,
"end": 28,
"value": "'XY'"
},
{
"type": "brace",
"start": 28,
"end": 29,
"value": ")"
},
{
"type": "whitespace",
"start": 29,
"end": 32,
"value": "\n "
},
{
"type": "operator",
"start": 32,
"end": 34,
"value": "|>"
},
{
"type": "whitespace",
"start": 34,
"end": 35,
"value": " "
},
{
"type": "word",
"start": 35,
"end": 49,
"value": "startProfileAt"
},
{
"type": "brace",
"start": 49,
"end": 50,
"value": "("
},
{
"type": "brace",
"start": 50,
"end": 51,
"value": "["
},
{
"type": "number",
"start": 51,
"end": 52,
"value": "0"
},
{
"type": "comma",
"start": 52,
"end": 53,
"value": ","
},
{
"type": "whitespace",
"start": 53,
"end": 54,
"value": " "
},
{
"type": "number",
"start": 54,
"end": 55,
"value": "0"
},
{
"type": "brace",
"start": 55,
"end": 56,
"value": "]"
},
{
"type": "comma",
"start": 56,
"end": 57,
"value": ","
},
{
"type": "whitespace",
"start": 57,
"end": 58,
"value": " "
},
{
"type": "operator",
"start": 58,
"end": 59,
"value": "%"
},
{
"type": "brace",
"start": 59,
"end": 60,
"value": ")"
},
{
"type": "whitespace",
"start": 60,
"end": 63,
"value": "\n "
},
{
"type": "operator",
"start": 63,
"end": 65,
"value": "|>"
},
{
"type": "whitespace",
"start": 65,
"end": 66,
"value": " "
},
{
"type": "word",
"start": 66,
"end": 70,
"value": "line"
},
{
"type": "brace",
"start": 70,
"end": 71,
"value": "("
},
{
"type": "brace",
"start": 71,
"end": 72,
"value": "["
},
{
"type": "number",
"start": 72,
"end": 73,
"value": "1"
},
{
"type": "comma",
"start": 73,
"end": 74,
"value": ","
},
{
"type": "whitespace",
"start": 74,
"end": 75,
"value": " "
},
{
"type": "number",
"start": 75,
"end": 79,
"value": "3.82"
},
{
"type": "brace",
"start": 79,
"end": 80,
"value": "]"
},
{
"type": "comma",
"start": 80,
"end": 81,
"value": ","
},
{
"type": "whitespace",
"start": 81,
"end": 82,
"value": " "
},
{
"type": "operator",
"start": 82,
"end": 83,
"value": "%"
},
{
"type": "comma",
"start": 83,
"end": 84,
"value": ","
},
{
"type": "whitespace",
"start": 84,
"end": 85,
"value": " "
},
{
"type": "dollar",
"start": 85,
"end": 86,
"value": "$"
},
{
"type": "word",
"start": 86,
"end": 91,
"value": "seg01"
},
{
"type": "brace",
"start": 91,
"end": 92,
"value": ")"
},
{
"type": "whitespace",
"start": 92,
"end": 95,
"value": "\n "
},
{
"type": "operator",
"start": 95,
"end": 97,
"value": "|>"
},
{
"type": "whitespace",
"start": 97,
"end": 98,
"value": " "
},
{
"type": "word",
"start": 98,
"end": 111,
"value": "angledLineToX"
},
{
"type": "brace",
"start": 111,
"end": 112,
"value": "("
},
{
"type": "brace",
"start": 112,
"end": 113,
"value": "["
},
{
"type": "operator",
"start": 113,
"end": 114,
"value": "-"
},
{
"type": "word",
"start": 114,
"end": 133,
"value": "angleToMatchLengthX"
},
{
"type": "brace",
"start": 133,
"end": 134,
"value": "("
},
{
"type": "word",
"start": 134,
"end": 139,
"value": "seg01"
},
{
"type": "comma",
"start": 139,
"end": 140,
"value": ","
},
{
"type": "whitespace",
"start": 140,
"end": 141,
"value": " "
},
{
"type": "number",
"start": 141,
"end": 142,
"value": "3"
},
{
"type": "comma",
"start": 142,
"end": 143,
"value": ","
},
{
"type": "whitespace",
"start": 143,
"end": 144,
"value": " "
},
{
"type": "operator",
"start": 144,
"end": 145,
"value": "%"
},
{
"type": "brace",
"start": 145,
"end": 146,
"value": ")"
},
{
"type": "comma",
"start": 146,
"end": 147,
"value": ","
},
{
"type": "whitespace",
"start": 147,
"end": 148,
"value": " "
},
{
"type": "number",
"start": 148,
"end": 149,
"value": "3"
},
{
"type": "brace",
"start": 149,
"end": 150,
"value": "]"
},
{
"type": "comma",
"start": 150,
"end": 151,
"value": ","
},
{
"type": "whitespace",
"start": 151,
"end": 152,
"value": " "
},
{
"type": "operator",
"start": 152,
"end": 153,
"value": "%"
},
{
"type": "brace",
"start": 153,
"end": 154,
"value": ")"
},
{
"type": "whitespace",
"start": 154,
"end": 157,
"value": "\n "
},
{
"type": "operator",
"start": 157,
"end": 159,
"value": "|>"
},
{
"type": "whitespace",
"start": 159,
"end": 160,
"value": " "
},
{
"type": "word",
"start": 160,
"end": 165,
"value": "close"
},
{
"type": "brace",
"start": 165,
"end": 166,
"value": "("
},
{
"type": "operator",
"start": 166,
"end": 167,
"value": "%"
},
{
"type": "brace",
"start": 167,
"end": 168,
"value": ")"
},
{
"type": "whitespace",
"start": 168,
"end": 171,
"value": "\n "
},
{
"type": "operator",
"start": 171,
"end": 173,
"value": "|>"
},
{
"type": "whitespace",
"start": 173,
"end": 174,
"value": " "
},
{
"type": "word",
"start": 174,
"end": 181,
"value": "extrude"
},
{
"type": "brace",
"start": 181,
"end": 182,
"value": "("
},
{
"type": "number",
"start": 182,
"end": 184,
"value": "10"
},
{
"type": "comma",
"start": 184,
"end": 185,
"value": ","
},
{
"type": "whitespace",
"start": 185,
"end": 186,
"value": " "
},
{
"type": "operator",
"start": 186,
"end": 187,
"value": "%"
},
{
"type": "brace",
"start": 187,
"end": 188,
"value": ")"
},
{
"type": "whitespace",
"start": 188,
"end": 189,
"value": "\n"
}
]
}

View File

@ -0,0 +1,291 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing big_number_angle_to_match_length_y.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 188,
"id": {
"end": 7,
"name": "part001",
"start": 0,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 28,
"raw": "'XY'",
"start": 24,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 23,
"name": "startSketchOn",
"start": 10,
"type": "Identifier"
},
"end": 29,
"optional": false,
"start": 10,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 52,
"raw": "0",
"start": 51,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 55,
"raw": "0",
"start": 54,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 56,
"start": 50,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 59,
"start": 58,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 49,
"name": "startProfileAt",
"start": 35,
"type": "Identifier"
},
"end": 60,
"optional": false,
"start": 35,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 73,
"raw": "1",
"start": 72,
"type": "Literal",
"type": "Literal",
"value": 1
},
{
"end": 79,
"raw": "3.82",
"start": 75,
"type": "Literal",
"type": "Literal",
"value": 3.82
}
],
"end": 80,
"start": 71,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 83,
"start": 82,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 91,
"start": 85,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "seg01"
}
],
"callee": {
"end": 70,
"name": "line",
"start": 66,
"type": "Identifier"
},
"end": 92,
"optional": false,
"start": 66,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"argument": {
"arguments": [
{
"end": 139,
"name": "seg01",
"start": 134,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 142,
"raw": "3",
"start": 141,
"type": "Literal",
"type": "Literal",
"value": 3
},
{
"end": 145,
"start": 144,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 133,
"name": "angleToMatchLengthY",
"start": 114,
"type": "Identifier"
},
"end": 146,
"optional": false,
"start": 114,
"type": "CallExpression",
"type": "CallExpression"
},
"end": 146,
"operator": "-",
"start": 113,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"end": 149,
"raw": "3",
"start": 148,
"type": "Literal",
"type": "Literal",
"value": 3
}
],
"end": 150,
"start": 112,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 153,
"start": 152,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 111,
"name": "angledLineToX",
"start": 98,
"type": "Identifier"
},
"end": 154,
"optional": false,
"start": 98,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 167,
"start": 166,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 165,
"name": "close",
"start": 160,
"type": "Identifier"
},
"end": 168,
"optional": false,
"start": 160,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 184,
"raw": "10",
"start": 182,
"type": "Literal",
"type": "Literal",
"value": 10
},
{
"end": 187,
"start": 186,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 181,
"name": "extrude",
"start": 174,
"type": "Identifier"
},
"end": 188,
"optional": false,
"start": 174,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 188,
"start": 10,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 0,
"type": "VariableDeclarator"
}
],
"end": 188,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 189,
"start": 0
}
}

View File

@ -0,0 +1,6 @@
part001 = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> line([1, 3.82], %, $seg01)
|> angledLineToX([-angleToMatchLengthY(seg01, 3, %), 3], %)
|> close(%)
|> extrude(10, %)

View File

@ -0,0 +1,339 @@
---
source: kcl/src/simulation_tests.rs
description: Program memory after executing big_number_angle_to_match_length_y.kcl
snapshot_kind: text
---
{
"environments": [
{
"bindings": {
"HALF_TURN": {
"type": "Number",
"value": 180.0,
"__meta": []
},
"QUARTER_TURN": {
"type": "Number",
"value": 90.0,
"__meta": []
},
"THREE_QUARTER_TURN": {
"type": "Number",
"value": 270.0,
"__meta": []
},
"ZERO": {
"type": "Number",
"value": 0.0,
"__meta": []
},
"part001": {
"type": "Solid",
"type": "Solid",
"id": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
92,
0
],
"tag": {
"end": 91,
"start": 85,
"type": "TagDeclarator",
"value": "seg01"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
98,
154,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
160,
168,
0
],
"tag": null,
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
92,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 91,
"start": 85,
"type": "TagDeclarator",
"value": "seg01"
},
"to": [
1.0,
3.82
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
98,
154,
0
]
},
"from": [
1.0,
3.82
],
"tag": null,
"to": [
3.0,
3.3954
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
160,
168,
0
]
},
"from": [
3.0,
3.3954
],
"tag": null,
"to": [
0.0,
0.0
],
"type": "ToPoint"
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"__meta": []
},
"start": {
"from": [
0.0,
0.0
],
"to": [
0.0,
0.0
],
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
35,
60,
0
]
}
},
"tags": {
"seg01": {
"type": "TagIdentifier",
"value": "seg01",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
92,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 91,
"start": 85,
"type": "TagDeclarator",
"value": "seg01"
},
"to": [
1.0,
3.82
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
92,
0
],
"tag": {
"end": 91,
"start": 85,
"type": "TagDeclarator",
"value": "seg01"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
85,
91,
0
]
}
]
}
},
"__meta": [
{
"sourceRange": [
35,
60,
0
]
}
]
},
"height": 10.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"__meta": [
{
"sourceRange": [
35,
60,
0
]
}
]
},
"seg01": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "seg01",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
66,
92,
0
]
},
"from": [
0.0,
0.0
],
"tag": {
"end": 91,
"start": 85,
"type": "TagDeclarator",
"value": "seg01"
},
"to": [
1.0,
3.82
],
"type": "ToPoint"
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
66,
92,
0
],
"tag": {
"end": 91,
"start": 85,
"type": "TagDeclarator",
"value": "seg01"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
85,
91,
0
]
}
]
}
},
"parent": null
}
],
"currentEnv": 0,
"return": null
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -0,0 +1,519 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing big_number_angle_to_match_length_y.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "word",
"start": 0,
"end": 7,
"value": "part001"
},
{
"type": "whitespace",
"start": 7,
"end": 8,
"value": " "
},
{
"type": "operator",
"start": 8,
"end": 9,
"value": "="
},
{
"type": "whitespace",
"start": 9,
"end": 10,
"value": " "
},
{
"type": "word",
"start": 10,
"end": 23,
"value": "startSketchOn"
},
{
"type": "brace",
"start": 23,
"end": 24,
"value": "("
},
{
"type": "string",
"start": 24,
"end": 28,
"value": "'XY'"
},
{
"type": "brace",
"start": 28,
"end": 29,
"value": ")"
},
{
"type": "whitespace",
"start": 29,
"end": 32,
"value": "\n "
},
{
"type": "operator",
"start": 32,
"end": 34,
"value": "|>"
},
{
"type": "whitespace",
"start": 34,
"end": 35,
"value": " "
},
{
"type": "word",
"start": 35,
"end": 49,
"value": "startProfileAt"
},
{
"type": "brace",
"start": 49,
"end": 50,
"value": "("
},
{
"type": "brace",
"start": 50,
"end": 51,
"value": "["
},
{
"type": "number",
"start": 51,
"end": 52,
"value": "0"
},
{
"type": "comma",
"start": 52,
"end": 53,
"value": ","
},
{
"type": "whitespace",
"start": 53,
"end": 54,
"value": " "
},
{
"type": "number",
"start": 54,
"end": 55,
"value": "0"
},
{
"type": "brace",
"start": 55,
"end": 56,
"value": "]"
},
{
"type": "comma",
"start": 56,
"end": 57,
"value": ","
},
{
"type": "whitespace",
"start": 57,
"end": 58,
"value": " "
},
{
"type": "operator",
"start": 58,
"end": 59,
"value": "%"
},
{
"type": "brace",
"start": 59,
"end": 60,
"value": ")"
},
{
"type": "whitespace",
"start": 60,
"end": 63,
"value": "\n "
},
{
"type": "operator",
"start": 63,
"end": 65,
"value": "|>"
},
{
"type": "whitespace",
"start": 65,
"end": 66,
"value": " "
},
{
"type": "word",
"start": 66,
"end": 70,
"value": "line"
},
{
"type": "brace",
"start": 70,
"end": 71,
"value": "("
},
{
"type": "brace",
"start": 71,
"end": 72,
"value": "["
},
{
"type": "number",
"start": 72,
"end": 73,
"value": "1"
},
{
"type": "comma",
"start": 73,
"end": 74,
"value": ","
},
{
"type": "whitespace",
"start": 74,
"end": 75,
"value": " "
},
{
"type": "number",
"start": 75,
"end": 79,
"value": "3.82"
},
{
"type": "brace",
"start": 79,
"end": 80,
"value": "]"
},
{
"type": "comma",
"start": 80,
"end": 81,
"value": ","
},
{
"type": "whitespace",
"start": 81,
"end": 82,
"value": " "
},
{
"type": "operator",
"start": 82,
"end": 83,
"value": "%"
},
{
"type": "comma",
"start": 83,
"end": 84,
"value": ","
},
{
"type": "whitespace",
"start": 84,
"end": 85,
"value": " "
},
{
"type": "dollar",
"start": 85,
"end": 86,
"value": "$"
},
{
"type": "word",
"start": 86,
"end": 91,
"value": "seg01"
},
{
"type": "brace",
"start": 91,
"end": 92,
"value": ")"
},
{
"type": "whitespace",
"start": 92,
"end": 95,
"value": "\n "
},
{
"type": "operator",
"start": 95,
"end": 97,
"value": "|>"
},
{
"type": "whitespace",
"start": 97,
"end": 98,
"value": " "
},
{
"type": "word",
"start": 98,
"end": 111,
"value": "angledLineToX"
},
{
"type": "brace",
"start": 111,
"end": 112,
"value": "("
},
{
"type": "brace",
"start": 112,
"end": 113,
"value": "["
},
{
"type": "operator",
"start": 113,
"end": 114,
"value": "-"
},
{
"type": "word",
"start": 114,
"end": 133,
"value": "angleToMatchLengthY"
},
{
"type": "brace",
"start": 133,
"end": 134,
"value": "("
},
{
"type": "word",
"start": 134,
"end": 139,
"value": "seg01"
},
{
"type": "comma",
"start": 139,
"end": 140,
"value": ","
},
{
"type": "whitespace",
"start": 140,
"end": 141,
"value": " "
},
{
"type": "number",
"start": 141,
"end": 142,
"value": "3"
},
{
"type": "comma",
"start": 142,
"end": 143,
"value": ","
},
{
"type": "whitespace",
"start": 143,
"end": 144,
"value": " "
},
{
"type": "operator",
"start": 144,
"end": 145,
"value": "%"
},
{
"type": "brace",
"start": 145,
"end": 146,
"value": ")"
},
{
"type": "comma",
"start": 146,
"end": 147,
"value": ","
},
{
"type": "whitespace",
"start": 147,
"end": 148,
"value": " "
},
{
"type": "number",
"start": 148,
"end": 149,
"value": "3"
},
{
"type": "brace",
"start": 149,
"end": 150,
"value": "]"
},
{
"type": "comma",
"start": 150,
"end": 151,
"value": ","
},
{
"type": "whitespace",
"start": 151,
"end": 152,
"value": " "
},
{
"type": "operator",
"start": 152,
"end": 153,
"value": "%"
},
{
"type": "brace",
"start": 153,
"end": 154,
"value": ")"
},
{
"type": "whitespace",
"start": 154,
"end": 157,
"value": "\n "
},
{
"type": "operator",
"start": 157,
"end": 159,
"value": "|>"
},
{
"type": "whitespace",
"start": 159,
"end": 160,
"value": " "
},
{
"type": "word",
"start": 160,
"end": 165,
"value": "close"
},
{
"type": "brace",
"start": 165,
"end": 166,
"value": "("
},
{
"type": "operator",
"start": 166,
"end": 167,
"value": "%"
},
{
"type": "brace",
"start": 167,
"end": 168,
"value": ")"
},
{
"type": "whitespace",
"start": 168,
"end": 171,
"value": "\n "
},
{
"type": "operator",
"start": 171,
"end": 173,
"value": "|>"
},
{
"type": "whitespace",
"start": 173,
"end": 174,
"value": " "
},
{
"type": "word",
"start": 174,
"end": 181,
"value": "extrude"
},
{
"type": "brace",
"start": 181,
"end": 182,
"value": "("
},
{
"type": "number",
"start": 182,
"end": 184,
"value": "10"
},
{
"type": "comma",
"start": 184,
"end": 185,
"value": ","
},
{
"type": "whitespace",
"start": 185,
"end": 186,
"value": " "
},
{
"type": "operator",
"start": 186,
"end": 187,
"value": "%"
},
{
"type": "brace",
"start": 187,
"end": 188,
"value": ")"
},
{
"type": "whitespace",
"start": 188,
"end": 189,
"value": "\n"
}
]
}

View File

@ -0,0 +1,671 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing circular_pattern3d_a_pattern.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 163,
"id": {
"end": 13,
"name": "exampleSketch",
"start": 0,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 34,
"raw": "'XZ'",
"start": 30,
"type": "Literal",
"type": "Literal",
"value": "XZ"
}
],
"callee": {
"end": 29,
"name": "startSketchOn",
"start": 16,
"type": "Identifier"
},
"end": 35,
"optional": false,
"start": 16,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 58,
"raw": "0",
"start": 57,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 61,
"raw": "0",
"start": 60,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 62,
"start": 56,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 65,
"start": 64,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 55,
"name": "startProfileAt",
"start": 41,
"type": "Identifier"
},
"end": 66,
"optional": false,
"start": 41,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 79,
"raw": "0",
"start": 78,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 82,
"raw": "2",
"start": 81,
"type": "Literal",
"type": "Literal",
"value": 2
}
],
"end": 83,
"start": 77,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 86,
"start": 85,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 76,
"name": "line",
"start": 72,
"type": "Identifier"
},
"end": 87,
"optional": false,
"start": 72,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 100,
"raw": "3",
"start": 99,
"type": "Literal",
"type": "Literal",
"value": 3
},
{
"end": 103,
"raw": "1",
"start": 102,
"type": "Literal",
"type": "Literal",
"value": 1
}
],
"end": 104,
"start": 98,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 107,
"start": 106,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 97,
"name": "line",
"start": 93,
"type": "Identifier"
},
"end": 108,
"optional": false,
"start": 93,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 121,
"raw": "0",
"start": 120,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"argument": {
"end": 125,
"raw": "4",
"start": 124,
"type": "Literal",
"type": "Literal",
"value": 4
},
"end": 125,
"operator": "-",
"start": 123,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 126,
"start": 119,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 129,
"start": 128,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 118,
"name": "line",
"start": 114,
"type": "Identifier"
},
"end": 130,
"optional": false,
"start": 114,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 143,
"start": 142,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 141,
"name": "close",
"start": 136,
"type": "Identifier"
},
"end": 144,
"optional": false,
"start": 136,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 159,
"raw": "1",
"start": 158,
"type": "Literal",
"type": "Literal",
"value": 1
},
{
"end": 162,
"start": 161,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 157,
"name": "extrude",
"start": 150,
"type": "Identifier"
},
"end": 163,
"optional": false,
"start": 150,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 163,
"start": 16,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 0,
"type": "VariableDeclarator"
}
],
"end": 163,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 258,
"id": {
"end": 171,
"name": "pattn1",
"start": 165,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 242,
"properties": [
{
"end": 209,
"key": {
"end": 198,
"name": "axis",
"start": 194,
"type": "Identifier"
},
"start": 194,
"type": "ObjectProperty",
"value": {
"elements": [
{
"end": 202,
"raw": "1",
"start": 201,
"type": "Literal",
"type": "Literal",
"value": 1
},
{
"end": 205,
"raw": "0",
"start": 204,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 208,
"raw": "0",
"start": 207,
"type": "Literal",
"type": "Literal",
"value": 0
}
],
"end": 209,
"start": 200,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
},
{
"end": 225,
"key": {
"end": 222,
"name": "instances",
"start": 213,
"type": "Identifier"
},
"start": 213,
"type": "ObjectProperty",
"value": {
"end": 225,
"raw": "7",
"start": 224,
"type": "Literal",
"type": "Literal",
"value": 7
}
},
{
"end": 240,
"key": {
"end": 237,
"name": "distance",
"start": 229,
"type": "Identifier"
},
"start": 229,
"type": "ObjectProperty",
"value": {
"end": 240,
"raw": "6",
"start": 239,
"type": "Literal",
"type": "Literal",
"value": 6
}
}
],
"start": 190,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 257,
"name": "exampleSketch",
"start": 244,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 189,
"name": "patternLinear3d",
"start": 174,
"type": "Identifier"
},
"end": 258,
"optional": false,
"start": 174,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 165,
"type": "VariableDeclarator"
}
],
"end": 258,
"kind": "const",
"start": 165,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 407,
"id": {
"end": 266,
"name": "pattn2",
"start": 260,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 398,
"properties": [
{
"end": 306,
"key": {
"end": 295,
"name": "axis",
"start": 291,
"type": "Identifier"
},
"start": 291,
"type": "ObjectProperty",
"value": {
"elements": [
{
"end": 299,
"raw": "0",
"start": 298,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 302,
"raw": "0",
"start": 301,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 305,
"raw": "1",
"start": 304,
"type": "Literal",
"type": "Literal",
"value": 1
}
],
"end": 306,
"start": 297,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
},
{
"end": 333,
"key": {
"end": 316,
"name": "center",
"start": 310,
"type": "Identifier"
},
"start": 310,
"type": "ObjectProperty",
"value": {
"elements": [
{
"argument": {
"end": 322,
"raw": "20",
"start": 320,
"type": "Literal",
"type": "Literal",
"value": 20
},
"end": 322,
"operator": "-",
"start": 319,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"argument": {
"end": 327,
"raw": "20",
"start": 325,
"type": "Literal",
"type": "Literal",
"value": 20
},
"end": 327,
"operator": "-",
"start": 324,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"argument": {
"end": 332,
"raw": "20",
"start": 330,
"type": "Literal",
"type": "Literal",
"value": 20
},
"end": 332,
"operator": "-",
"start": 329,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 333,
"start": 318,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
},
{
"end": 350,
"key": {
"end": 346,
"name": "instances",
"start": 337,
"type": "Identifier"
},
"start": 337,
"type": "ObjectProperty",
"value": {
"end": 350,
"raw": "41",
"start": 348,
"type": "Literal",
"type": "Literal",
"value": 41
}
},
{
"end": 369,
"key": {
"end": 364,
"name": "arcDegrees",
"start": 354,
"type": "Identifier"
},
"start": 354,
"type": "ObjectProperty",
"value": {
"end": 369,
"raw": "360",
"start": 366,
"type": "Literal",
"type": "Literal",
"value": 360
}
},
{
"end": 396,
"key": {
"end": 389,
"name": "rotateDuplicates",
"start": 373,
"type": "Identifier"
},
"start": 373,
"type": "ObjectProperty",
"value": {
"end": 396,
"raw": "false",
"start": 391,
"type": "Literal",
"type": "Literal",
"value": false
}
}
],
"start": 287,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 406,
"name": "pattn1",
"start": 400,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 286,
"name": "patternCircular3d",
"start": 269,
"type": "Identifier"
},
"end": 407,
"optional": false,
"start": 269,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 260,
"type": "VariableDeclarator"
}
],
"end": 407,
"kind": "const",
"start": 260,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 408,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"end": 165,
"start": 163,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"1": [
{
"end": 260,
"start": 258,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 0
}
}

View File

@ -0,0 +1,21 @@
exampleSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line([0, 2], %)
|> line([3, 1], %)
|> line([0, -4], %)
|> close(%)
|> extrude(1, %)
pattn1 = patternLinear3d({
axis: [1, 0, 0],
instances: 7,
distance: 6
}, exampleSketch)
pattn2 = patternCircular3d({
axis: [0, 0, 1],
center: [-20, -20, -20],
instances: 41,
arcDegrees: 360,
rotateDuplicates: false
}, pattn1)

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,80 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing comparisons_multiple.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"end": 46,
"expression": {
"arguments": [
{
"end": 18,
"left": {
"end": 13,
"left": {
"end": 8,
"raw": "3",
"start": 7,
"type": "Literal",
"type": "Literal",
"value": 3
},
"operator": "==",
"right": {
"end": 13,
"raw": "3",
"start": 12,
"type": "Literal",
"type": "Literal",
"value": 3
},
"start": 7,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"operator": "==",
"right": {
"end": 18,
"raw": "3",
"start": 17,
"type": "Literal",
"type": "Literal",
"value": 3
},
"start": 7,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"end": 45,
"raw": "\"this should not compile\"",
"start": 20,
"type": "Literal",
"type": "Literal",
"value": "this should not compile"
}
],
"callee": {
"end": 6,
"name": "assert",
"start": 0,
"type": "Identifier"
},
"end": 46,
"optional": false,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 47,
"start": 0
}
}

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Error from executing comparisons_multiple.kcl
snapshot_kind: text
---
semantic: KclErrorDetails { source_ranges: [SourceRange([7, 13, 0])], message: "Expected a number, but found a boolean (true/false value)" }

View File

@ -0,0 +1 @@
assert(3 == 3 == 3, "this should not compile")

View File

@ -0,0 +1,105 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing comparisons_multiple.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "word",
"start": 0,
"end": 6,
"value": "assert"
},
{
"type": "brace",
"start": 6,
"end": 7,
"value": "("
},
{
"type": "number",
"start": 7,
"end": 8,
"value": "3"
},
{
"type": "whitespace",
"start": 8,
"end": 9,
"value": " "
},
{
"type": "operator",
"start": 9,
"end": 11,
"value": "=="
},
{
"type": "whitespace",
"start": 11,
"end": 12,
"value": " "
},
{
"type": "number",
"start": 12,
"end": 13,
"value": "3"
},
{
"type": "whitespace",
"start": 13,
"end": 14,
"value": " "
},
{
"type": "operator",
"start": 14,
"end": 16,
"value": "=="
},
{
"type": "whitespace",
"start": 16,
"end": 17,
"value": " "
},
{
"type": "number",
"start": 17,
"end": 18,
"value": "3"
},
{
"type": "comma",
"start": 18,
"end": 19,
"value": ","
},
{
"type": "whitespace",
"start": 19,
"end": 20,
"value": " "
},
{
"type": "string",
"start": 20,
"end": 45,
"value": "\"this should not compile\""
},
{
"type": "brace",
"start": 45,
"end": 46,
"value": ")"
},
{
"type": "whitespace",
"start": 46,
"end": 47,
"value": "\n"
}
]
}

View File

@ -0,0 +1,435 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing computed_var.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 56,
"id": {
"end": 40,
"name": "arr",
"start": 37,
"type": "Identifier"
},
"init": {
"elements": [
{
"end": 45,
"raw": "0",
"start": 44,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 48,
"raw": "0",
"start": 47,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 51,
"raw": "0",
"start": 50,
"type": "Literal",
"type": "Literal",
"value": 0
},
{
"end": 55,
"raw": "10",
"start": 53,
"type": "Literal",
"type": "Literal",
"value": 10
}
],
"end": 56,
"start": 43,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
"start": 37,
"type": "VariableDeclarator"
}
],
"end": 56,
"kind": "const",
"start": 37,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 62,
"id": {
"end": 58,
"name": "i",
"start": 57,
"type": "Identifier"
},
"init": {
"end": 62,
"raw": "3",
"start": 61,
"type": "Literal",
"type": "Literal",
"value": 3
},
"start": 57,
"type": "VariableDeclarator"
}
],
"end": 62,
"kind": "const",
"start": 57,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 75,
"id": {
"end": 66,
"name": "ten",
"start": 63,
"type": "Identifier"
},
"init": {
"computed": true,
"end": 75,
"object": {
"end": 72,
"name": "arr",
"start": 69,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 74,
"name": "i",
"start": 73,
"type": "Identifier",
"type": "Identifier"
},
"start": 69,
"type": "MemberExpression",
"type": "MemberExpression"
},
"start": 63,
"type": "VariableDeclarator"
}
],
"end": 75,
"kind": "const",
"start": 63,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 115,
"expression": {
"arguments": [
{
"end": 92,
"name": "ten",
"start": 89,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 96,
"raw": "10",
"start": 94,
"type": "Literal",
"type": "Literal",
"value": 10
},
{
"end": 106,
"raw": "0.000001",
"start": 98,
"type": "Literal",
"type": "Literal",
"value": 0.000001
},
{
"end": 114,
"raw": "\"oops\"",
"start": 108,
"type": "Literal",
"type": "Literal",
"value": "oops"
}
],
"callee": {
"end": 88,
"name": "assertEqual",
"start": 77,
"type": "Identifier"
},
"end": 115,
"optional": false,
"start": 77,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 77,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declarations": [
{
"end": 126,
"id": {
"end": 118,
"name": "p",
"start": 117,
"type": "Identifier"
},
"init": {
"end": 126,
"raw": "\"foo\"",
"start": 121,
"type": "Literal",
"type": "Literal",
"value": "foo"
},
"start": 117,
"type": "VariableDeclarator"
}
],
"end": 126,
"kind": "const",
"start": 117,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 151,
"id": {
"end": 130,
"name": "obj",
"start": 127,
"type": "Identifier"
},
"init": {
"end": 151,
"properties": [
{
"end": 141,
"key": {
"end": 138,
"name": "foo",
"start": 135,
"type": "Identifier"
},
"start": 135,
"type": "ObjectProperty",
"value": {
"end": 141,
"raw": "1",
"start": 140,
"type": "Literal",
"type": "Literal",
"value": 1
}
},
{
"end": 149,
"key": {
"end": 146,
"name": "bar",
"start": 143,
"type": "Identifier"
},
"start": 143,
"type": "ObjectProperty",
"value": {
"end": 149,
"raw": "0",
"start": 148,
"type": "Literal",
"type": "Literal",
"value": 0
}
}
],
"start": 133,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
"start": 127,
"type": "VariableDeclarator"
}
],
"end": 151,
"kind": "const",
"start": 127,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 164,
"id": {
"end": 155,
"name": "one",
"start": 152,
"type": "Identifier"
},
"init": {
"computed": true,
"end": 164,
"object": {
"end": 161,
"name": "obj",
"start": 158,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 163,
"name": "p",
"start": 162,
"type": "Identifier",
"type": "Identifier"
},
"start": 158,
"type": "MemberExpression",
"type": "MemberExpression"
},
"start": 152,
"type": "VariableDeclarator"
}
],
"end": 164,
"kind": "const",
"start": 152,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 204,
"expression": {
"arguments": [
{
"end": 181,
"name": "one",
"start": 178,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 184,
"raw": "1",
"start": 183,
"type": "Literal",
"type": "Literal",
"value": 1
},
{
"end": 195,
"raw": "0.0000001",
"start": 186,
"type": "Literal",
"type": "Literal",
"value": 0.0000001
},
{
"end": 203,
"raw": "\"oops\"",
"start": 197,
"type": "Literal",
"type": "Literal",
"value": "oops"
}
],
"callee": {
"end": 177,
"name": "assertEqual",
"start": 166,
"type": "Identifier"
},
"end": 204,
"optional": false,
"start": 166,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 166,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 205,
"nonCodeMeta": {
"nonCodeNodes": {
"2": [
{
"end": 77,
"start": 75,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"3": [
{
"end": 117,
"start": 115,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"6": [
{
"end": 166,
"start": 164,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": [
{
"end": 34,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "blockComment",
"value": "This tests computed properties.",
"style": "line"
}
},
{
"end": 37,
"start": 34,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"start": 0
}
}

View File

@ -0,0 +1,14 @@
// This tests computed properties.
arr = [0, 0, 0, 10]
i = 3
ten = arr[i]
assertEqual(ten, 10, 0.000001, "oops")
p = "foo"
obj = { foo: 1, bar: 0 }
one = obj[p]
assertEqual(one, 1, 0.0000001, "oops")

View File

@ -0,0 +1,194 @@
---
source: kcl/src/simulation_tests.rs
description: Program memory after executing computed_var.kcl
snapshot_kind: text
---
{
"environments": [
{
"bindings": {
"HALF_TURN": {
"type": "Number",
"value": 180.0,
"__meta": []
},
"QUARTER_TURN": {
"type": "Number",
"value": 90.0,
"__meta": []
},
"THREE_QUARTER_TURN": {
"type": "Number",
"value": 270.0,
"__meta": []
},
"ZERO": {
"type": "Number",
"value": 0.0,
"__meta": []
},
"arr": {
"type": "Array",
"value": [
{
"type": "Int",
"value": 0,
"__meta": [
{
"sourceRange": [
44,
45,
0
]
}
]
},
{
"type": "Int",
"value": 0,
"__meta": [
{
"sourceRange": [
47,
48,
0
]
}
]
},
{
"type": "Int",
"value": 0,
"__meta": [
{
"sourceRange": [
50,
51,
0
]
}
]
},
{
"type": "Int",
"value": 10,
"__meta": [
{
"sourceRange": [
53,
55,
0
]
}
]
}
],
"__meta": [
{
"sourceRange": [
43,
56,
0
]
}
]
},
"i": {
"type": "Int",
"value": 3,
"__meta": [
{
"sourceRange": [
61,
62,
0
]
}
]
},
"obj": {
"type": "Object",
"value": {
"bar": {
"type": "Int",
"value": 0,
"__meta": [
{
"sourceRange": [
148,
149,
0
]
}
]
},
"foo": {
"type": "Int",
"value": 1,
"__meta": [
{
"sourceRange": [
140,
141,
0
]
}
]
}
},
"__meta": [
{
"sourceRange": [
133,
151,
0
]
}
]
},
"one": {
"type": "Int",
"value": 1,
"__meta": [
{
"sourceRange": [
140,
141,
0
]
}
]
},
"p": {
"type": "String",
"value": "foo",
"__meta": [
{
"sourceRange": [
121,
126,
0
]
}
]
},
"ten": {
"type": "Int",
"value": 10,
"__meta": [
{
"sourceRange": [
53,
55,
0
]
}
]
}
},
"parent": null
}
],
"currentEnv": 0,
"return": null
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -0,0 +1,585 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing computed_var.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "lineComment",
"start": 0,
"end": 34,
"value": "// This tests computed properties."
},
{
"type": "whitespace",
"start": 34,
"end": 37,
"value": "\n\n\n"
},
{
"type": "word",
"start": 37,
"end": 40,
"value": "arr"
},
{
"type": "whitespace",
"start": 40,
"end": 41,
"value": " "
},
{
"type": "operator",
"start": 41,
"end": 42,
"value": "="
},
{
"type": "whitespace",
"start": 42,
"end": 43,
"value": " "
},
{
"type": "brace",
"start": 43,
"end": 44,
"value": "["
},
{
"type": "number",
"start": 44,
"end": 45,
"value": "0"
},
{
"type": "comma",
"start": 45,
"end": 46,
"value": ","
},
{
"type": "whitespace",
"start": 46,
"end": 47,
"value": " "
},
{
"type": "number",
"start": 47,
"end": 48,
"value": "0"
},
{
"type": "comma",
"start": 48,
"end": 49,
"value": ","
},
{
"type": "whitespace",
"start": 49,
"end": 50,
"value": " "
},
{
"type": "number",
"start": 50,
"end": 51,
"value": "0"
},
{
"type": "comma",
"start": 51,
"end": 52,
"value": ","
},
{
"type": "whitespace",
"start": 52,
"end": 53,
"value": " "
},
{
"type": "number",
"start": 53,
"end": 55,
"value": "10"
},
{
"type": "brace",
"start": 55,
"end": 56,
"value": "]"
},
{
"type": "whitespace",
"start": 56,
"end": 57,
"value": "\n"
},
{
"type": "word",
"start": 57,
"end": 58,
"value": "i"
},
{
"type": "whitespace",
"start": 58,
"end": 59,
"value": " "
},
{
"type": "operator",
"start": 59,
"end": 60,
"value": "="
},
{
"type": "whitespace",
"start": 60,
"end": 61,
"value": " "
},
{
"type": "number",
"start": 61,
"end": 62,
"value": "3"
},
{
"type": "whitespace",
"start": 62,
"end": 63,
"value": "\n"
},
{
"type": "word",
"start": 63,
"end": 66,
"value": "ten"
},
{
"type": "whitespace",
"start": 66,
"end": 67,
"value": " "
},
{
"type": "operator",
"start": 67,
"end": 68,
"value": "="
},
{
"type": "whitespace",
"start": 68,
"end": 69,
"value": " "
},
{
"type": "word",
"start": 69,
"end": 72,
"value": "arr"
},
{
"type": "brace",
"start": 72,
"end": 73,
"value": "["
},
{
"type": "word",
"start": 73,
"end": 74,
"value": "i"
},
{
"type": "brace",
"start": 74,
"end": 75,
"value": "]"
},
{
"type": "whitespace",
"start": 75,
"end": 77,
"value": "\n\n"
},
{
"type": "word",
"start": 77,
"end": 88,
"value": "assertEqual"
},
{
"type": "brace",
"start": 88,
"end": 89,
"value": "("
},
{
"type": "word",
"start": 89,
"end": 92,
"value": "ten"
},
{
"type": "comma",
"start": 92,
"end": 93,
"value": ","
},
{
"type": "whitespace",
"start": 93,
"end": 94,
"value": " "
},
{
"type": "number",
"start": 94,
"end": 96,
"value": "10"
},
{
"type": "comma",
"start": 96,
"end": 97,
"value": ","
},
{
"type": "whitespace",
"start": 97,
"end": 98,
"value": " "
},
{
"type": "number",
"start": 98,
"end": 106,
"value": "0.000001"
},
{
"type": "comma",
"start": 106,
"end": 107,
"value": ","
},
{
"type": "whitespace",
"start": 107,
"end": 108,
"value": " "
},
{
"type": "string",
"start": 108,
"end": 114,
"value": "\"oops\""
},
{
"type": "brace",
"start": 114,
"end": 115,
"value": ")"
},
{
"type": "whitespace",
"start": 115,
"end": 117,
"value": "\n\n"
},
{
"type": "word",
"start": 117,
"end": 118,
"value": "p"
},
{
"type": "whitespace",
"start": 118,
"end": 119,
"value": " "
},
{
"type": "operator",
"start": 119,
"end": 120,
"value": "="
},
{
"type": "whitespace",
"start": 120,
"end": 121,
"value": " "
},
{
"type": "string",
"start": 121,
"end": 126,
"value": "\"foo\""
},
{
"type": "whitespace",
"start": 126,
"end": 127,
"value": "\n"
},
{
"type": "word",
"start": 127,
"end": 130,
"value": "obj"
},
{
"type": "whitespace",
"start": 130,
"end": 131,
"value": " "
},
{
"type": "operator",
"start": 131,
"end": 132,
"value": "="
},
{
"type": "whitespace",
"start": 132,
"end": 133,
"value": " "
},
{
"type": "brace",
"start": 133,
"end": 134,
"value": "{"
},
{
"type": "whitespace",
"start": 134,
"end": 135,
"value": " "
},
{
"type": "word",
"start": 135,
"end": 138,
"value": "foo"
},
{
"type": "colon",
"start": 138,
"end": 139,
"value": ":"
},
{
"type": "whitespace",
"start": 139,
"end": 140,
"value": " "
},
{
"type": "number",
"start": 140,
"end": 141,
"value": "1"
},
{
"type": "comma",
"start": 141,
"end": 142,
"value": ","
},
{
"type": "whitespace",
"start": 142,
"end": 143,
"value": " "
},
{
"type": "word",
"start": 143,
"end": 146,
"value": "bar"
},
{
"type": "colon",
"start": 146,
"end": 147,
"value": ":"
},
{
"type": "whitespace",
"start": 147,
"end": 148,
"value": " "
},
{
"type": "number",
"start": 148,
"end": 149,
"value": "0"
},
{
"type": "whitespace",
"start": 149,
"end": 150,
"value": " "
},
{
"type": "brace",
"start": 150,
"end": 151,
"value": "}"
},
{
"type": "whitespace",
"start": 151,
"end": 152,
"value": "\n"
},
{
"type": "word",
"start": 152,
"end": 155,
"value": "one"
},
{
"type": "whitespace",
"start": 155,
"end": 156,
"value": " "
},
{
"type": "operator",
"start": 156,
"end": 157,
"value": "="
},
{
"type": "whitespace",
"start": 157,
"end": 158,
"value": " "
},
{
"type": "word",
"start": 158,
"end": 161,
"value": "obj"
},
{
"type": "brace",
"start": 161,
"end": 162,
"value": "["
},
{
"type": "word",
"start": 162,
"end": 163,
"value": "p"
},
{
"type": "brace",
"start": 163,
"end": 164,
"value": "]"
},
{
"type": "whitespace",
"start": 164,
"end": 166,
"value": "\n\n"
},
{
"type": "word",
"start": 166,
"end": 177,
"value": "assertEqual"
},
{
"type": "brace",
"start": 177,
"end": 178,
"value": "("
},
{
"type": "word",
"start": 178,
"end": 181,
"value": "one"
},
{
"type": "comma",
"start": 181,
"end": 182,
"value": ","
},
{
"type": "whitespace",
"start": 182,
"end": 183,
"value": " "
},
{
"type": "number",
"start": 183,
"end": 184,
"value": "1"
},
{
"type": "comma",
"start": 184,
"end": 185,
"value": ","
},
{
"type": "whitespace",
"start": 185,
"end": 186,
"value": " "
},
{
"type": "number",
"start": 186,
"end": 195,
"value": "0.0000001"
},
{
"type": "comma",
"start": 195,
"end": 196,
"value": ","
},
{
"type": "whitespace",
"start": 196,
"end": 197,
"value": " "
},
{
"type": "string",
"start": 197,
"end": 203,
"value": "\"oops\""
},
{
"type": "brace",
"start": 203,
"end": 204,
"value": ")"
},
{
"type": "whitespace",
"start": 204,
"end": 205,
"value": "\n"
}
]
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,80 @@
rpizWidth = 30
rpizLength = 65
caseThickness = 1
border = 4
screwHeight = 4
caseWidth = rpizWidth + border * 2
caseLength = rpizLength + border * 2
caseHeight = 8
widthBetweenScrews = 23
lengthBetweenScrews = 29 * 2
miniHdmiDistance = 12.4
microUsb1Distance = 41.4
microUsb2Distance = 54
miniHdmiWidth = 11.2
microUsbWidth = 7.4
connectorPadding = 4
miniHdmiHole = startSketchAt([
0,
border + miniHdmiDistance - (miniHdmiWidth / 2)
])
|> lineTo([
0,
border + miniHdmiDistance + miniHdmiWidth / 2
], %)
|> lineTo([
1,
border + miniHdmiDistance + miniHdmiWidth / 2
], %)
|> lineTo([
1,
border + miniHdmiDistance - (miniHdmiWidth / 2)
], %)
|> close(%)
case = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> lineTo([caseWidth, 0], %, $edge1)
|> lineTo([caseWidth, caseLength], %, $edge2)
|> lineTo([0, caseLength], %, $edge3)
|> close(%, $edge4)
|> extrude(caseHeight, %)
|> fillet({
radius: 1,
tags: [
getNextAdjacentEdge(edge1),
getNextAdjacentEdge(edge2),
getNextAdjacentEdge(edge3),
getNextAdjacentEdge(edge4)
]
}, %)
fn m25Screw = (x, y, height) => {
screw = startSketchOn("XY")
|> startProfileAt([0, 0], %)
|> circle({ center: [x, y], radius: 2.5 }, %)
|> hole(circle({ center: [x, y], radius: 1.25 }, %), %)
|> extrude(height, %)
return screw
}
m25Screw(border + rpizWidth / 2 - (widthBetweenScrews / 2), 0 + border + rpizLength / 2 - (lengthBetweenScrews / 2), screwHeight)
m25Screw(border + rpizWidth / 2 - (widthBetweenScrews / 2), 0 + border + rpizLength / 2 + lengthBetweenScrews / 2, screwHeight)
m25Screw(border + rpizWidth / 2 + widthBetweenScrews / 2, 0 + border + rpizLength / 2 + lengthBetweenScrews / 2, screwHeight)
m25Screw(border + rpizWidth / 2 + widthBetweenScrews / 2, 0 + border + rpizLength / 2 - (lengthBetweenScrews / 2), screwHeight)
shell({
faces: ['end'],
thickness: caseThickness
}, case)

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing import_constant.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"end": 39,
"items": [
{
"alias": null,
"end": 12,
"name": {
"end": 12,
"name": "three",
"start": 7,
"type": "Identifier"
},
"start": 7,
"type": "ImportItem"
}
],
"path": "export_constant.kcl",
"raw_path": "\"export_constant.kcl\"",
"start": 0,
"type": "ImportStatement",
"type": "ImportStatement"
}
],
"end": 40,
"start": 0
}
}

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Error from executing import_constant.kcl
snapshot_kind: text
---
engine: KclErrorDetails { source_ranges: [SourceRange([0, 39, 0])], message: "Failed to read file `export_constant.kcl`: No such file or directory (os error 2)" }

View File

@ -0,0 +1 @@
import three from "export_constant.kcl"

View File

@ -0,0 +1,57 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing import_constant.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "keyword",
"start": 0,
"end": 6,
"value": "import"
},
{
"type": "whitespace",
"start": 6,
"end": 7,
"value": " "
},
{
"type": "word",
"start": 7,
"end": 12,
"value": "three"
},
{
"type": "whitespace",
"start": 12,
"end": 13,
"value": " "
},
{
"type": "word",
"start": 13,
"end": 17,
"value": "from"
},
{
"type": "whitespace",
"start": 17,
"end": 18,
"value": " "
},
{
"type": "string",
"start": 18,
"end": 39,
"value": "\"export_constant.kcl\""
},
{
"type": "whitespace",
"start": 39,
"end": 40,
"value": "\n"
}
]
}

View File

@ -0,0 +1,119 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing import_cycle1.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"end": 35,
"items": [
{
"alias": null,
"end": 10,
"name": {
"end": 10,
"name": "two",
"start": 7,
"type": "Identifier"
},
"start": 7,
"type": "ImportItem"
}
],
"path": "import_cycle2.kcl",
"raw_path": "\"import_cycle2.kcl\"",
"start": 0,
"type": "ImportStatement",
"type": "ImportStatement"
},
{
"declarations": [
{
"end": 81,
"id": {
"end": 50,
"name": "one",
"start": 47,
"type": "Identifier"
},
"init": {
"body": {
"body": [
{
"argument": {
"end": 79,
"left": {
"arguments": [],
"callee": {
"end": 73,
"name": "two",
"start": 70,
"type": "Identifier"
},
"end": 75,
"optional": false,
"start": 70,
"type": "CallExpression",
"type": "CallExpression"
},
"operator": "-",
"right": {
"end": 79,
"raw": "1",
"start": 78,
"type": "Literal",
"type": "Literal",
"value": 1
},
"start": 70,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"end": 79,
"start": 63,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"end": 81,
"start": 59
},
"end": 81,
"params": [],
"start": 53,
"type": "FunctionExpression",
"type": "FunctionExpression"
},
"start": 47,
"type": "VariableDeclarator"
}
],
"end": 81,
"kind": "fn",
"start": 37,
"type": "VariableDeclaration",
"type": "VariableDeclaration",
"visibility": "export"
}
],
"end": 82,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"end": 37,
"start": 35,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 0
}
}

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Error from executing import_cycle1.kcl
snapshot_kind: text
---
engine: KclErrorDetails { source_ranges: [SourceRange([0, 35, 0])], message: "Failed to read file `import_cycle2.kcl`: No such file or directory (os error 2)" }

View File

@ -0,0 +1,5 @@
import two from "import_cycle2.kcl"
export fn one = () => {
return two() - 1
}

View File

@ -0,0 +1,219 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing import_cycle1.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "keyword",
"start": 0,
"end": 6,
"value": "import"
},
{
"type": "whitespace",
"start": 6,
"end": 7,
"value": " "
},
{
"type": "word",
"start": 7,
"end": 10,
"value": "two"
},
{
"type": "whitespace",
"start": 10,
"end": 11,
"value": " "
},
{
"type": "word",
"start": 11,
"end": 15,
"value": "from"
},
{
"type": "whitespace",
"start": 15,
"end": 16,
"value": " "
},
{
"type": "string",
"start": 16,
"end": 35,
"value": "\"import_cycle2.kcl\""
},
{
"type": "whitespace",
"start": 35,
"end": 37,
"value": "\n\n"
},
{
"type": "keyword",
"start": 37,
"end": 43,
"value": "export"
},
{
"type": "whitespace",
"start": 43,
"end": 44,
"value": " "
},
{
"type": "keyword",
"start": 44,
"end": 46,
"value": "fn"
},
{
"type": "whitespace",
"start": 46,
"end": 47,
"value": " "
},
{
"type": "word",
"start": 47,
"end": 50,
"value": "one"
},
{
"type": "whitespace",
"start": 50,
"end": 51,
"value": " "
},
{
"type": "operator",
"start": 51,
"end": 52,
"value": "="
},
{
"type": "whitespace",
"start": 52,
"end": 53,
"value": " "
},
{
"type": "brace",
"start": 53,
"end": 54,
"value": "("
},
{
"type": "brace",
"start": 54,
"end": 55,
"value": ")"
},
{
"type": "whitespace",
"start": 55,
"end": 56,
"value": " "
},
{
"type": "operator",
"start": 56,
"end": 58,
"value": "=>"
},
{
"type": "whitespace",
"start": 58,
"end": 59,
"value": " "
},
{
"type": "brace",
"start": 59,
"end": 60,
"value": "{"
},
{
"type": "whitespace",
"start": 60,
"end": 63,
"value": "\n "
},
{
"type": "keyword",
"start": 63,
"end": 69,
"value": "return"
},
{
"type": "whitespace",
"start": 69,
"end": 70,
"value": " "
},
{
"type": "word",
"start": 70,
"end": 73,
"value": "two"
},
{
"type": "brace",
"start": 73,
"end": 74,
"value": "("
},
{
"type": "brace",
"start": 74,
"end": 75,
"value": ")"
},
{
"type": "whitespace",
"start": 75,
"end": 76,
"value": " "
},
{
"type": "operator",
"start": 76,
"end": 77,
"value": "-"
},
{
"type": "whitespace",
"start": 77,
"end": 78,
"value": " "
},
{
"type": "number",
"start": 78,
"end": 79,
"value": "1"
},
{
"type": "whitespace",
"start": 79,
"end": 80,
"value": "\n"
},
{
"type": "brace",
"start": 80,
"end": 81,
"value": "}"
},
{
"type": "whitespace",
"start": 81,
"end": 82,
"value": "\n"
}
]
}

View File

@ -0,0 +1 @@
import cube from "../cube.kcl"

View File

@ -0,0 +1,35 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing import_side_effect.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"end": 40,
"items": [
{
"alias": null,
"end": 10,
"name": {
"end": 10,
"name": "foo",
"start": 7,
"type": "Identifier"
},
"start": 7,
"type": "ImportItem"
}
],
"path": "export_side_effect.kcl",
"raw_path": "\"export_side_effect.kcl\"",
"start": 0,
"type": "ImportStatement",
"type": "ImportStatement"
}
],
"end": 41,
"start": 0
}
}

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Error from executing import_side_effect.kcl
snapshot_kind: text
---
engine: KclErrorDetails { source_ranges: [SourceRange([0, 40, 0])], message: "Failed to read file `export_side_effect.kcl`: No such file or directory (os error 2)" }

View File

@ -0,0 +1 @@
import foo from "export_side_effect.kcl"

View File

@ -0,0 +1,57 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing import_side_effect.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "keyword",
"start": 0,
"end": 6,
"value": "import"
},
{
"type": "whitespace",
"start": 6,
"end": 7,
"value": " "
},
{
"type": "word",
"start": 7,
"end": 10,
"value": "foo"
},
{
"type": "whitespace",
"start": 10,
"end": 11,
"value": " "
},
{
"type": "word",
"start": 11,
"end": 15,
"value": "from"
},
{
"type": "whitespace",
"start": 15,
"end": 16,
"value": " "
},
{
"type": "string",
"start": 16,
"end": 40,
"value": "\"export_side_effect.kcl\""
},
{
"type": "whitespace",
"start": 40,
"end": 41,
"value": "\n"
}
]
}

View File

@ -0,0 +1,107 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing invalid_index_fractional.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 15,
"id": {
"end": 3,
"name": "arr",
"start": 0,
"type": "Identifier"
},
"init": {
"elements": [
{
"end": 8,
"raw": "1",
"start": 7,
"type": "Literal",
"type": "Literal",
"value": 1
},
{
"end": 11,
"raw": "2",
"start": 10,
"type": "Literal",
"type": "Literal",
"value": 2
},
{
"end": 14,
"raw": "3",
"start": 13,
"type": "Literal",
"type": "Literal",
"value": 3
}
],
"end": 15,
"start": 6,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
"start": 0,
"type": "VariableDeclarator"
}
],
"end": 15,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 28,
"id": {
"end": 17,
"name": "x",
"start": 16,
"type": "Identifier"
},
"init": {
"computed": false,
"end": 28,
"object": {
"end": 23,
"name": "arr",
"start": 20,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 27,
"raw": "1.2",
"start": 24,
"type": "Literal",
"type": "Literal",
"value": 1.2
},
"start": 20,
"type": "MemberExpression",
"type": "MemberExpression"
},
"start": 16,
"type": "VariableDeclarator"
}
],
"end": 28,
"kind": "const",
"start": 16,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 29,
"start": 0
}
}

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Error from executing invalid_index_fractional.kcl
snapshot_kind: text
---
semantic: KclErrorDetails { source_ranges: [SourceRange([20, 28, 0])], message: "Only strings or ints (>= 0) can be properties/indexes" }

View File

@ -0,0 +1,2 @@
arr = [1, 2, 3]
x = arr[1.2]

View File

@ -0,0 +1,147 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing invalid_index_fractional.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "word",
"start": 0,
"end": 3,
"value": "arr"
},
{
"type": "whitespace",
"start": 3,
"end": 4,
"value": " "
},
{
"type": "operator",
"start": 4,
"end": 5,
"value": "="
},
{
"type": "whitespace",
"start": 5,
"end": 6,
"value": " "
},
{
"type": "brace",
"start": 6,
"end": 7,
"value": "["
},
{
"type": "number",
"start": 7,
"end": 8,
"value": "1"
},
{
"type": "comma",
"start": 8,
"end": 9,
"value": ","
},
{
"type": "whitespace",
"start": 9,
"end": 10,
"value": " "
},
{
"type": "number",
"start": 10,
"end": 11,
"value": "2"
},
{
"type": "comma",
"start": 11,
"end": 12,
"value": ","
},
{
"type": "whitespace",
"start": 12,
"end": 13,
"value": " "
},
{
"type": "number",
"start": 13,
"end": 14,
"value": "3"
},
{
"type": "brace",
"start": 14,
"end": 15,
"value": "]"
},
{
"type": "whitespace",
"start": 15,
"end": 16,
"value": "\n"
},
{
"type": "word",
"start": 16,
"end": 17,
"value": "x"
},
{
"type": "whitespace",
"start": 17,
"end": 18,
"value": " "
},
{
"type": "operator",
"start": 18,
"end": 19,
"value": "="
},
{
"type": "whitespace",
"start": 19,
"end": 20,
"value": " "
},
{
"type": "word",
"start": 20,
"end": 23,
"value": "arr"
},
{
"type": "brace",
"start": 23,
"end": 24,
"value": "["
},
{
"type": "number",
"start": 24,
"end": 27,
"value": "1.2"
},
{
"type": "brace",
"start": 27,
"end": 28,
"value": "]"
},
{
"type": "whitespace",
"start": 28,
"end": 29,
"value": "\n"
}
]
}

View File

@ -0,0 +1,141 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing invalid_index_negative.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 15,
"id": {
"end": 3,
"name": "arr",
"start": 0,
"type": "Identifier"
},
"init": {
"elements": [
{
"end": 8,
"raw": "1",
"start": 7,
"type": "Literal",
"type": "Literal",
"value": 1
},
{
"end": 11,
"raw": "2",
"start": 10,
"type": "Literal",
"type": "Literal",
"value": 2
},
{
"end": 14,
"raw": "3",
"start": 13,
"type": "Literal",
"type": "Literal",
"value": 3
}
],
"end": 15,
"start": 6,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
"start": 0,
"type": "VariableDeclarator"
}
],
"end": 15,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 22,
"id": {
"end": 17,
"name": "i",
"start": 16,
"type": "Identifier"
},
"init": {
"argument": {
"end": 22,
"raw": "1",
"start": 21,
"type": "Literal",
"type": "Literal",
"value": 1
},
"end": 22,
"operator": "-",
"start": 20,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
"start": 16,
"type": "VariableDeclarator"
}
],
"end": 22,
"kind": "const",
"start": 16,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 33,
"id": {
"end": 24,
"name": "x",
"start": 23,
"type": "Identifier"
},
"init": {
"computed": true,
"end": 33,
"object": {
"end": 30,
"name": "arr",
"start": 27,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 32,
"name": "i",
"start": 31,
"type": "Identifier",
"type": "Identifier"
},
"start": 27,
"type": "MemberExpression",
"type": "MemberExpression"
},
"start": 23,
"type": "VariableDeclarator"
}
],
"end": 33,
"kind": "const",
"start": 23,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 34,
"start": 0
}
}

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Error from executing invalid_index_negative.kcl
snapshot_kind: text
---
semantic: KclErrorDetails { source_ranges: [SourceRange([27, 33, 0])], message: "'-1' is negative, so you can't index an array with it" }

View File

@ -0,0 +1,3 @@
arr = [1, 2, 3]
i = -1
x = arr[i]

View File

@ -0,0 +1,189 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing invalid_index_negative.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "word",
"start": 0,
"end": 3,
"value": "arr"
},
{
"type": "whitespace",
"start": 3,
"end": 4,
"value": " "
},
{
"type": "operator",
"start": 4,
"end": 5,
"value": "="
},
{
"type": "whitespace",
"start": 5,
"end": 6,
"value": " "
},
{
"type": "brace",
"start": 6,
"end": 7,
"value": "["
},
{
"type": "number",
"start": 7,
"end": 8,
"value": "1"
},
{
"type": "comma",
"start": 8,
"end": 9,
"value": ","
},
{
"type": "whitespace",
"start": 9,
"end": 10,
"value": " "
},
{
"type": "number",
"start": 10,
"end": 11,
"value": "2"
},
{
"type": "comma",
"start": 11,
"end": 12,
"value": ","
},
{
"type": "whitespace",
"start": 12,
"end": 13,
"value": " "
},
{
"type": "number",
"start": 13,
"end": 14,
"value": "3"
},
{
"type": "brace",
"start": 14,
"end": 15,
"value": "]"
},
{
"type": "whitespace",
"start": 15,
"end": 16,
"value": "\n"
},
{
"type": "word",
"start": 16,
"end": 17,
"value": "i"
},
{
"type": "whitespace",
"start": 17,
"end": 18,
"value": " "
},
{
"type": "operator",
"start": 18,
"end": 19,
"value": "="
},
{
"type": "whitespace",
"start": 19,
"end": 20,
"value": " "
},
{
"type": "operator",
"start": 20,
"end": 21,
"value": "-"
},
{
"type": "number",
"start": 21,
"end": 22,
"value": "1"
},
{
"type": "whitespace",
"start": 22,
"end": 23,
"value": "\n"
},
{
"type": "word",
"start": 23,
"end": 24,
"value": "x"
},
{
"type": "whitespace",
"start": 24,
"end": 25,
"value": " "
},
{
"type": "operator",
"start": 25,
"end": 26,
"value": "="
},
{
"type": "whitespace",
"start": 26,
"end": 27,
"value": " "
},
{
"type": "word",
"start": 27,
"end": 30,
"value": "arr"
},
{
"type": "brace",
"start": 30,
"end": 31,
"value": "["
},
{
"type": "word",
"start": 31,
"end": 32,
"value": "i"
},
{
"type": "brace",
"start": 32,
"end": 33,
"value": "]"
},
{
"type": "whitespace",
"start": 33,
"end": 34,
"value": "\n"
}
]
}

View File

@ -0,0 +1,107 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing invalid_index_str.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 15,
"id": {
"end": 3,
"name": "arr",
"start": 0,
"type": "Identifier"
},
"init": {
"elements": [
{
"end": 8,
"raw": "1",
"start": 7,
"type": "Literal",
"type": "Literal",
"value": 1
},
{
"end": 11,
"raw": "2",
"start": 10,
"type": "Literal",
"type": "Literal",
"value": 2
},
{
"end": 14,
"raw": "3",
"start": 13,
"type": "Literal",
"type": "Literal",
"value": 3
}
],
"end": 15,
"start": 6,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
"start": 0,
"type": "VariableDeclarator"
}
],
"end": 15,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 28,
"id": {
"end": 17,
"name": "x",
"start": 16,
"type": "Identifier"
},
"init": {
"computed": false,
"end": 28,
"object": {
"end": 23,
"name": "arr",
"start": 20,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 27,
"raw": "\"s\"",
"start": 24,
"type": "Literal",
"type": "Literal",
"value": "s"
},
"start": 20,
"type": "MemberExpression",
"type": "MemberExpression"
},
"start": 16,
"type": "VariableDeclarator"
}
],
"end": 28,
"kind": "const",
"start": 16,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 29,
"start": 0
}
}

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Error from executing invalid_index_str.kcl
snapshot_kind: text
---
semantic: KclErrorDetails { source_ranges: [SourceRange([20, 28, 0])], message: "Only integers >= 0 can be used as the index of an array, but you're using a string" }

View File

@ -0,0 +1,2 @@
arr = [1, 2, 3]
x = arr["s"]

View File

@ -0,0 +1,147 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing invalid_index_str.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "word",
"start": 0,
"end": 3,
"value": "arr"
},
{
"type": "whitespace",
"start": 3,
"end": 4,
"value": " "
},
{
"type": "operator",
"start": 4,
"end": 5,
"value": "="
},
{
"type": "whitespace",
"start": 5,
"end": 6,
"value": " "
},
{
"type": "brace",
"start": 6,
"end": 7,
"value": "["
},
{
"type": "number",
"start": 7,
"end": 8,
"value": "1"
},
{
"type": "comma",
"start": 8,
"end": 9,
"value": ","
},
{
"type": "whitespace",
"start": 9,
"end": 10,
"value": " "
},
{
"type": "number",
"start": 10,
"end": 11,
"value": "2"
},
{
"type": "comma",
"start": 11,
"end": 12,
"value": ","
},
{
"type": "whitespace",
"start": 12,
"end": 13,
"value": " "
},
{
"type": "number",
"start": 13,
"end": 14,
"value": "3"
},
{
"type": "brace",
"start": 14,
"end": 15,
"value": "]"
},
{
"type": "whitespace",
"start": 15,
"end": 16,
"value": "\n"
},
{
"type": "word",
"start": 16,
"end": 17,
"value": "x"
},
{
"type": "whitespace",
"start": 17,
"end": 18,
"value": " "
},
{
"type": "operator",
"start": 18,
"end": 19,
"value": "="
},
{
"type": "whitespace",
"start": 19,
"end": 20,
"value": " "
},
{
"type": "word",
"start": 20,
"end": 23,
"value": "arr"
},
{
"type": "brace",
"start": 23,
"end": 24,
"value": "["
},
{
"type": "string",
"start": 24,
"end": 27,
"value": "\"s\""
},
{
"type": "brace",
"start": 27,
"end": 28,
"value": "]"
},
{
"type": "whitespace",
"start": 28,
"end": 29,
"value": "\n"
}
]
}

View File

@ -0,0 +1,83 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing invalid_member_object.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 9,
"id": {
"end": 3,
"name": "num",
"start": 0,
"type": "Identifier"
},
"init": {
"end": 9,
"raw": "999",
"start": 6,
"type": "Literal",
"type": "Literal",
"value": 999
},
"start": 0,
"type": "VariableDeclarator"
}
],
"end": 9,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 20,
"id": {
"end": 11,
"name": "x",
"start": 10,
"type": "Identifier"
},
"init": {
"computed": false,
"end": 20,
"object": {
"end": 17,
"name": "num",
"start": 14,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 19,
"raw": "3",
"start": 18,
"type": "Literal",
"type": "Literal",
"value": 3
},
"start": 14,
"type": "MemberExpression",
"type": "MemberExpression"
},
"start": 10,
"type": "VariableDeclarator"
}
],
"end": 20,
"kind": "const",
"start": 10,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 21,
"start": 0
}
}

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Error from executing invalid_member_object.kcl
snapshot_kind: text
---
semantic: KclErrorDetails { source_ranges: [SourceRange([14, 20, 0])], message: "Only arrays and objects can be indexed, but you're trying to index an integer" }

View File

@ -0,0 +1,2 @@
num = 999
x = num[3]

View File

@ -0,0 +1,99 @@
---
source: kcl/src/simulation_tests.rs
description: Result of tokenizing invalid_member_object.kcl
snapshot_kind: text
---
{
"Ok": [
{
"type": "word",
"start": 0,
"end": 3,
"value": "num"
},
{
"type": "whitespace",
"start": 3,
"end": 4,
"value": " "
},
{
"type": "operator",
"start": 4,
"end": 5,
"value": "="
},
{
"type": "whitespace",
"start": 5,
"end": 6,
"value": " "
},
{
"type": "number",
"start": 6,
"end": 9,
"value": "999"
},
{
"type": "whitespace",
"start": 9,
"end": 10,
"value": "\n"
},
{
"type": "word",
"start": 10,
"end": 11,
"value": "x"
},
{
"type": "whitespace",
"start": 11,
"end": 12,
"value": " "
},
{
"type": "operator",
"start": 12,
"end": 13,
"value": "="
},
{
"type": "whitespace",
"start": 13,
"end": 14,
"value": " "
},
{
"type": "word",
"start": 14,
"end": 17,
"value": "num"
},
{
"type": "brace",
"start": 17,
"end": 18,
"value": "["
},
{
"type": "number",
"start": 18,
"end": 19,
"value": "3"
},
{
"type": "brace",
"start": 19,
"end": 20,
"value": "]"
},
{
"type": "whitespace",
"start": 20,
"end": 21,
"value": "\n"
}
]
}

View File

@ -0,0 +1,83 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing invalid_member_object_prop.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declarations": [
{
"end": 8,
"id": {
"end": 1,
"name": "b",
"start": 0,
"type": "Identifier"
},
"init": {
"end": 8,
"raw": "true",
"start": 4,
"type": "Literal",
"type": "Literal",
"value": true
},
"start": 0,
"type": "VariableDeclarator"
}
],
"end": 8,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declarations": [
{
"end": 26,
"id": {
"end": 10,
"name": "x",
"start": 9,
"type": "Identifier"
},
"init": {
"computed": false,
"end": 26,
"object": {
"end": 14,
"name": "b",
"start": 13,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 25,
"raw": "\"property\"",
"start": 15,
"type": "Literal",
"type": "Literal",
"value": "property"
},
"start": 13,
"type": "MemberExpression",
"type": "MemberExpression"
},
"start": 9,
"type": "VariableDeclarator"
}
],
"end": 26,
"kind": "const",
"start": 9,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 27,
"start": 0
}
}

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Error from executing invalid_member_object_prop.kcl
snapshot_kind: text
---
semantic: KclErrorDetails { source_ranges: [SourceRange([13, 26, 0])], message: "Only arrays and objects can be indexed, but you're trying to index a boolean (true/false value)" }

Some files were not shown because too many files have changed in this diff Show More