Declare parts of std in KCL rather than Rust (#5147)
Declare std in KCL
This commit is contained in:
15
docs/kcl/HALF_TURN.md
Normal file
15
docs/kcl/HALF_TURN.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "HALF_TURN"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
HALF_TURN: number(deg) = 180deg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
15
docs/kcl/QUARTER_TURN.md
Normal file
15
docs/kcl/QUARTER_TURN.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "QUARTER_TURN"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
QUARTER_TURN: number(deg) = 90deg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
15
docs/kcl/THREE_QUARTER_TURN.md
Normal file
15
docs/kcl/THREE_QUARTER_TURN.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "THREE_QUARTER_TURN"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
THREE_QUARTER_TURN: number(deg) = 270deg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
15
docs/kcl/ZERO.md
Normal file
15
docs/kcl/ZERO.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "ZERO"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
ZERO: number = 0
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
32
docs/kcl/const_E.md
Normal file
32
docs/kcl/const_E.md
Normal file
File diff suppressed because one or more lines are too long
15
docs/kcl/const_HALF_TURN.md
Normal file
15
docs/kcl/const_HALF_TURN.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "HALF_TURN"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
HALF_TURN: number(deg) = 180deg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
28
docs/kcl/const_PI.md
Normal file
28
docs/kcl/const_PI.md
Normal file
File diff suppressed because one or more lines are too long
15
docs/kcl/const_QUARTER_TURN.md
Normal file
15
docs/kcl/const_QUARTER_TURN.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "QUARTER_TURN"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
QUARTER_TURN: number(deg) = 90deg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
32
docs/kcl/const_TAU.md
Normal file
32
docs/kcl/const_TAU.md
Normal file
File diff suppressed because one or more lines are too long
15
docs/kcl/const_THREE_QUARTER_TURN.md
Normal file
15
docs/kcl/const_THREE_QUARTER_TURN.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "THREE_QUARTER_TURN"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
THREE_QUARTER_TURN: number(deg) = 270deg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
15
docs/kcl/const_ZERO.md
Normal file
15
docs/kcl/const_ZERO.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "ZERO"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
ZERO: number = 0
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
32
docs/kcl/const_const_std-math-E.md
Normal file
32
docs/kcl/const_const_std-math-E.md
Normal file
File diff suppressed because one or more lines are too long
28
docs/kcl/const_const_std-math-PI.md
Normal file
28
docs/kcl/const_const_std-math-PI.md
Normal file
File diff suppressed because one or more lines are too long
32
docs/kcl/const_const_std-math-TAU.md
Normal file
32
docs/kcl/const_const_std-math-TAU.md
Normal file
File diff suppressed because one or more lines are too long
15
docs/kcl/const_const_std-prelude-HALF_TURN.md
Normal file
15
docs/kcl/const_const_std-prelude-HALF_TURN.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "std::prelude::HALF_TURN"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
std::prelude::HALF_TURN: number(deg) = 180deg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
15
docs/kcl/const_const_std-prelude-QUARTER_TURN.md
Normal file
15
docs/kcl/const_const_std-prelude-QUARTER_TURN.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "std::prelude::QUARTER_TURN"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
std::prelude::QUARTER_TURN: number(deg) = 90deg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
15
docs/kcl/const_const_std-prelude-THREE_QUARTER_TURN.md
Normal file
15
docs/kcl/const_const_std-prelude-THREE_QUARTER_TURN.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "std::prelude::THREE_QUARTER_TURN"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
std::prelude::THREE_QUARTER_TURN: number(deg) = 270deg
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
15
docs/kcl/const_const_std-prelude-ZERO.md
Normal file
15
docs/kcl/const_const_std-prelude-ZERO.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "std::prelude::ZERO"
|
||||||
|
excerpt: ""
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
std::prelude::ZERO: number = 0
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
File diff suppressed because one or more lines are too long
@ -4,9 +4,11 @@ excerpt: "Return the value of Euler’s number `e`."
|
|||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**WARNING:** This function is deprecated.
|
||||||
|
|
||||||
Return the value of Euler’s number `e`.
|
Return the value of Euler’s number `e`.
|
||||||
|
|
||||||
|
**DEPRECATED** use the constant E
|
||||||
|
|
||||||
```js
|
```js
|
||||||
e() -> number
|
e() -> number
|
||||||
|
|||||||
@ -9,6 +9,7 @@ layout: manual
|
|||||||
* [Types](kcl/types)
|
* [Types](kcl/types)
|
||||||
* [Modules](kcl/modules)
|
* [Modules](kcl/modules)
|
||||||
* [Known Issues](kcl/KNOWN-ISSUES)
|
* [Known Issues](kcl/KNOWN-ISSUES)
|
||||||
|
* **`std`**
|
||||||
* [`abs`](kcl/abs)
|
* [`abs`](kcl/abs)
|
||||||
* [`acos`](kcl/acos)
|
* [`acos`](kcl/acos)
|
||||||
* [`angleToMatchLengthX`](kcl/angleToMatchLengthX)
|
* [`angleToMatchLengthX`](kcl/angleToMatchLengthX)
|
||||||
@ -38,8 +39,6 @@ layout: manual
|
|||||||
* [`circleThreePoint`](kcl/circleThreePoint)
|
* [`circleThreePoint`](kcl/circleThreePoint)
|
||||||
* [`close`](kcl/close)
|
* [`close`](kcl/close)
|
||||||
* [`cm`](kcl/cm)
|
* [`cm`](kcl/cm)
|
||||||
* [`cos`](kcl/cos)
|
|
||||||
* [`e`](kcl/e)
|
|
||||||
* [`extrude`](kcl/extrude)
|
* [`extrude`](kcl/extrude)
|
||||||
* [`fillet`](kcl/fillet)
|
* [`fillet`](kcl/fillet)
|
||||||
* [`floor`](kcl/floor)
|
* [`floor`](kcl/floor)
|
||||||
@ -76,7 +75,6 @@ layout: manual
|
|||||||
* [`patternLinear3d`](kcl/patternLinear3d)
|
* [`patternLinear3d`](kcl/patternLinear3d)
|
||||||
* [`patternTransform`](kcl/patternTransform)
|
* [`patternTransform`](kcl/patternTransform)
|
||||||
* [`patternTransform2d`](kcl/patternTransform2d)
|
* [`patternTransform2d`](kcl/patternTransform2d)
|
||||||
* [`pi`](kcl/pi)
|
|
||||||
* [`polar`](kcl/polar)
|
* [`polar`](kcl/polar)
|
||||||
* [`polygon`](kcl/polygon)
|
* [`polygon`](kcl/polygon)
|
||||||
* [`pop`](kcl/pop)
|
* [`pop`](kcl/pop)
|
||||||
@ -98,17 +96,14 @@ layout: manual
|
|||||||
* [`segStartX`](kcl/segStartX)
|
* [`segStartX`](kcl/segStartX)
|
||||||
* [`segStartY`](kcl/segStartY)
|
* [`segStartY`](kcl/segStartY)
|
||||||
* [`shell`](kcl/shell)
|
* [`shell`](kcl/shell)
|
||||||
* [`sin`](kcl/sin)
|
|
||||||
* [`sqrt`](kcl/sqrt)
|
* [`sqrt`](kcl/sqrt)
|
||||||
* [`startProfileAt`](kcl/startProfileAt)
|
* [`startProfileAt`](kcl/startProfileAt)
|
||||||
* [`startSketchOn`](kcl/startSketchOn)
|
* [`startSketchOn`](kcl/startSketchOn)
|
||||||
* [`sweep`](kcl/sweep)
|
* [`sweep`](kcl/sweep)
|
||||||
* [`tan`](kcl/tan)
|
|
||||||
* [`tangentToEnd`](kcl/tangentToEnd)
|
* [`tangentToEnd`](kcl/tangentToEnd)
|
||||||
* [`tangentialArc`](kcl/tangentialArc)
|
* [`tangentialArc`](kcl/tangentialArc)
|
||||||
* [`tangentialArcTo`](kcl/tangentialArcTo)
|
* [`tangentialArcTo`](kcl/tangentialArcTo)
|
||||||
* [`tangentialArcToRelative`](kcl/tangentialArcToRelative)
|
* [`tangentialArcToRelative`](kcl/tangentialArcToRelative)
|
||||||
* [`tau`](kcl/tau)
|
|
||||||
* [`toDegrees`](kcl/toDegrees)
|
* [`toDegrees`](kcl/toDegrees)
|
||||||
* [`toRadians`](kcl/toRadians)
|
* [`toRadians`](kcl/toRadians)
|
||||||
* [`xLine`](kcl/xLine)
|
* [`xLine`](kcl/xLine)
|
||||||
@ -116,3 +111,15 @@ layout: manual
|
|||||||
* [`yLine`](kcl/yLine)
|
* [`yLine`](kcl/yLine)
|
||||||
* [`yLineTo`](kcl/yLineTo)
|
* [`yLineTo`](kcl/yLineTo)
|
||||||
* [`yd`](kcl/yd)
|
* [`yd`](kcl/yd)
|
||||||
|
* **`std::math`**
|
||||||
|
* [`E`](kcl/const_std-math-E)
|
||||||
|
* [`PI`](kcl/const_std-math-PI)
|
||||||
|
* [`TAU`](kcl/const_std-math-TAU)
|
||||||
|
* [`cos`](kcl/std-math-cos)
|
||||||
|
* [`sin`](kcl/std-math-sin)
|
||||||
|
* [`tan`](kcl/std-math-tan)
|
||||||
|
* **`std::prelude`**
|
||||||
|
* [`HALF_TURN`](kcl/const_std-prelude-HALF_TURN)
|
||||||
|
* [`QUARTER_TURN`](kcl/const_std-prelude-QUARTER_TURN)
|
||||||
|
* [`THREE_QUARTER_TURN`](kcl/const_std-prelude-THREE_QUARTER_TURN)
|
||||||
|
* [`ZERO`](kcl/const_std-prelude-ZERO)
|
||||||
|
|||||||
@ -4,9 +4,11 @@ excerpt: "Return the value of `pi`. Archimedes’ constant (π)."
|
|||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**WARNING:** This function is deprecated.
|
||||||
|
|
||||||
Return the value of `pi`. Archimedes’ constant (π).
|
Return the value of `pi`. Archimedes’ constant (π).
|
||||||
|
|
||||||
|
**DEPRECATED** use the constant PI
|
||||||
|
|
||||||
```js
|
```js
|
||||||
pi() -> number
|
pi() -> number
|
||||||
|
|||||||
@ -76,7 +76,7 @@ assertEqual(sum, 6, 0.00001, "1 + 2 + 3 summed is 6")
|
|||||||
// Declare a function that sketches a decagon.
|
// Declare a function that sketches a decagon.
|
||||||
fn decagon(radius) {
|
fn decagon(radius) {
|
||||||
// Each side of the decagon is turned this many degrees from the previous angle.
|
// Each side of the decagon is turned this many degrees from the previous angle.
|
||||||
stepAngle = 1 / 10 * tau()
|
stepAngle = 1 / 10 * TAU
|
||||||
|
|
||||||
// Start the decagon sketch at this point.
|
// Start the decagon sketch at this point.
|
||||||
startOfDecagonSketch = startSketchOn('XY')
|
startOfDecagonSketch = startSketchOn('XY')
|
||||||
@ -97,7 +97,7 @@ fn decagon(radius) {
|
|||||||
|
|
||||||
/* The `decagon` above is basically like this pseudo-code:
|
/* The `decagon` above is basically like this pseudo-code:
|
||||||
fn decagon(radius):
|
fn decagon(radius):
|
||||||
stepAngle = (1/10) * tau()
|
stepAngle = (1/10) * TAU
|
||||||
plane = startSketchOn('XY')
|
plane = startSketchOn('XY')
|
||||||
startOfDecagonSketch = startProfileAt([(cos(0)*radius), (sin(0) * radius)], plane)
|
startOfDecagonSketch = startProfileAt([(cos(0)*radius), (sin(0) * radius)], plane)
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
44
docs/kcl/std-math-cos.md
Normal file
44
docs/kcl/std-math-cos.md
Normal file
File diff suppressed because one or more lines are too long
44
docs/kcl/std-math-sin.md
Normal file
44
docs/kcl/std-math-sin.md
Normal file
File diff suppressed because one or more lines are too long
44
docs/kcl/std-math-tan.md
Normal file
44
docs/kcl/std-math-tan.md
Normal file
File diff suppressed because one or more lines are too long
@ -83689,52 +83689,10 @@
|
|||||||
"totalWidth = 10 * cm()"
|
"totalWidth = 10 * cm()"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "cos",
|
|
||||||
"summary": "Compute the cosine of a number (in radians).",
|
|
||||||
"description": "",
|
|
||||||
"tags": [
|
|
||||||
"math"
|
|
||||||
],
|
|
||||||
"keywordArguments": false,
|
|
||||||
"args": [
|
|
||||||
{
|
|
||||||
"name": "num",
|
|
||||||
"type": "number",
|
|
||||||
"schema": {
|
|
||||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
|
||||||
"title": "double",
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"required": true,
|
|
||||||
"includeInSnippet": true,
|
|
||||||
"labelRequired": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"returnValue": {
|
|
||||||
"name": "",
|
|
||||||
"type": "number",
|
|
||||||
"schema": {
|
|
||||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
|
||||||
"title": "double",
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"required": true,
|
|
||||||
"includeInSnippet": true,
|
|
||||||
"labelRequired": true
|
|
||||||
},
|
|
||||||
"unpublished": false,
|
|
||||||
"deprecated": false,
|
|
||||||
"examples": [
|
|
||||||
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = 30,\n length = 3 / cos(toRadians(30))\n }, %)\n |> yLineTo(0, %)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "e",
|
"name": "e",
|
||||||
"summary": "Return the value of Euler’s number `e`.",
|
"summary": "Return the value of Euler’s number `e`.",
|
||||||
"description": "",
|
"description": "**DEPRECATED** use the constant E",
|
||||||
"tags": [
|
"tags": [
|
||||||
"math"
|
"math"
|
||||||
],
|
],
|
||||||
@ -83754,7 +83712,7 @@
|
|||||||
"labelRequired": true
|
"labelRequired": true
|
||||||
},
|
},
|
||||||
"unpublished": false,
|
"unpublished": false,
|
||||||
"deprecated": false,
|
"deprecated": true,
|
||||||
"examples": [
|
"examples": [
|
||||||
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 30, length = 2 * e() ^ 2 }, %)\n |> yLineTo(0, %)\n |> close()\n\nexample = extrude(exampleSketch, length = 10)"
|
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 30, length = 2 * e() ^ 2 }, %)\n |> yLineTo(0, %)\n |> close()\n\nexample = extrude(exampleSketch, length = 10)"
|
||||||
]
|
]
|
||||||
@ -135417,7 +135375,6 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"__meta",
|
"__meta",
|
||||||
"memory",
|
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -135428,7 +135385,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"memory": {
|
"memory": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
"$ref": "#/components/schemas/EnvironmentRef"
|
"$ref": "#/components/schemas/EnvironmentRef"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": true
|
||||||
},
|
},
|
||||||
"__meta": {
|
"__meta": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -138031,7 +137993,6 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"__meta",
|
"__meta",
|
||||||
"memory",
|
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -138042,7 +138003,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"memory": {
|
"memory": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
"$ref": "#/components/schemas/EnvironmentRef"
|
"$ref": "#/components/schemas/EnvironmentRef"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": true
|
||||||
},
|
},
|
||||||
"__meta": {
|
"__meta": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -140649,7 +140615,6 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"__meta",
|
"__meta",
|
||||||
"memory",
|
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -140660,7 +140625,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"memory": {
|
"memory": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
"$ref": "#/components/schemas/EnvironmentRef"
|
"$ref": "#/components/schemas/EnvironmentRef"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": true
|
||||||
},
|
},
|
||||||
"__meta": {
|
"__meta": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -208035,7 +208005,7 @@
|
|||||||
{
|
{
|
||||||
"name": "pi",
|
"name": "pi",
|
||||||
"summary": "Return the value of `pi`. Archimedes’ constant (π).",
|
"summary": "Return the value of `pi`. Archimedes’ constant (π).",
|
||||||
"description": "",
|
"description": "**DEPRECATED** use the constant PI",
|
||||||
"tags": [
|
"tags": [
|
||||||
"math"
|
"math"
|
||||||
],
|
],
|
||||||
@ -208055,7 +208025,7 @@
|
|||||||
"labelRequired": true
|
"labelRequired": true
|
||||||
},
|
},
|
||||||
"unpublished": false,
|
"unpublished": false,
|
||||||
"deprecated": false,
|
"deprecated": true,
|
||||||
"examples": [
|
"examples": [
|
||||||
"circumference = 70\n\nexampleSketch = startSketchOn(\"XZ\")\n |> circle({\n center = [0, 0],\n radius = circumference / (2 * pi())\n }, %)\n\nexample = extrude(exampleSketch, length = 5)"
|
"circumference = 70\n\nexampleSketch = startSketchOn(\"XZ\")\n |> circle({\n center = [0, 0],\n radius = circumference / (2 * pi())\n }, %)\n\nexample = extrude(exampleSketch, length = 5)"
|
||||||
]
|
]
|
||||||
@ -213842,7 +213812,6 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"__meta",
|
"__meta",
|
||||||
"memory",
|
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -213853,7 +213822,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"memory": {
|
"memory": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
"$ref": "#/components/schemas/EnvironmentRef"
|
"$ref": "#/components/schemas/EnvironmentRef"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": true
|
||||||
},
|
},
|
||||||
"__meta": {
|
"__meta": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -216455,7 +216429,6 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"__meta",
|
"__meta",
|
||||||
"memory",
|
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -216466,7 +216439,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"memory": {
|
"memory": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
"$ref": "#/components/schemas/EnvironmentRef"
|
"$ref": "#/components/schemas/EnvironmentRef"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": true
|
||||||
},
|
},
|
||||||
"__meta": {
|
"__meta": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -217342,7 +217320,6 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"__meta",
|
"__meta",
|
||||||
"memory",
|
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -217353,7 +217330,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"memory": {
|
"memory": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
"$ref": "#/components/schemas/EnvironmentRef"
|
"$ref": "#/components/schemas/EnvironmentRef"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": true
|
||||||
},
|
},
|
||||||
"__meta": {
|
"__meta": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -224740,7 +224722,6 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"__meta",
|
"__meta",
|
||||||
"memory",
|
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -224751,7 +224732,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"memory": {
|
"memory": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
"$ref": "#/components/schemas/EnvironmentRef"
|
"$ref": "#/components/schemas/EnvironmentRef"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": true
|
||||||
},
|
},
|
||||||
"__meta": {
|
"__meta": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -227351,7 +227337,6 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"__meta",
|
"__meta",
|
||||||
"memory",
|
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -227362,7 +227347,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"memory": {
|
"memory": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
"$ref": "#/components/schemas/EnvironmentRef"
|
"$ref": "#/components/schemas/EnvironmentRef"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": true
|
||||||
},
|
},
|
||||||
"__meta": {
|
"__meta": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -227858,7 +227848,6 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"__meta",
|
"__meta",
|
||||||
"memory",
|
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -227869,7 +227858,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"memory": {
|
"memory": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
"$ref": "#/components/schemas/EnvironmentRef"
|
"$ref": "#/components/schemas/EnvironmentRef"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": true
|
||||||
},
|
},
|
||||||
"__meta": {
|
"__meta": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -230470,7 +230464,6 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"__meta",
|
"__meta",
|
||||||
"memory",
|
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -230481,7 +230474,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"memory": {
|
"memory": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
"$ref": "#/components/schemas/EnvironmentRef"
|
"$ref": "#/components/schemas/EnvironmentRef"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": true
|
||||||
},
|
},
|
||||||
"__meta": {
|
"__meta": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -231357,7 +231355,6 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"__meta",
|
"__meta",
|
||||||
"memory",
|
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -231368,7 +231365,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"memory": {
|
"memory": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
"$ref": "#/components/schemas/EnvironmentRef"
|
"$ref": "#/components/schemas/EnvironmentRef"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": true
|
||||||
},
|
},
|
||||||
"__meta": {
|
"__meta": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -233607,7 +233609,6 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"__meta",
|
"__meta",
|
||||||
"memory",
|
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -233618,7 +233619,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"memory": {
|
"memory": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
"$ref": "#/components/schemas/EnvironmentRef"
|
"$ref": "#/components/schemas/EnvironmentRef"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": true
|
||||||
},
|
},
|
||||||
"__meta": {
|
"__meta": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -236218,7 +236224,6 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"__meta",
|
"__meta",
|
||||||
"memory",
|
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -236229,7 +236234,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"memory": {
|
"memory": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
"$ref": "#/components/schemas/EnvironmentRef"
|
"$ref": "#/components/schemas/EnvironmentRef"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": true
|
||||||
},
|
},
|
||||||
"__meta": {
|
"__meta": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -236725,7 +236735,6 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"__meta",
|
"__meta",
|
||||||
"memory",
|
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -236736,7 +236745,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"memory": {
|
"memory": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
"$ref": "#/components/schemas/EnvironmentRef"
|
"$ref": "#/components/schemas/EnvironmentRef"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": true
|
||||||
},
|
},
|
||||||
"__meta": {
|
"__meta": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -239339,7 +239353,6 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"__meta",
|
"__meta",
|
||||||
"memory",
|
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -239350,7 +239363,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"memory": {
|
"memory": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
"$ref": "#/components/schemas/EnvironmentRef"
|
"$ref": "#/components/schemas/EnvironmentRef"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": true
|
||||||
},
|
},
|
||||||
"__meta": {
|
"__meta": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -241951,7 +241969,6 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"__meta",
|
"__meta",
|
||||||
"memory",
|
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -241962,7 +241979,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"memory": {
|
"memory": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
"$ref": "#/components/schemas/EnvironmentRef"
|
"$ref": "#/components/schemas/EnvironmentRef"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": true
|
||||||
},
|
},
|
||||||
"__meta": {
|
"__meta": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -242838,7 +242860,6 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"__meta",
|
"__meta",
|
||||||
"memory",
|
|
||||||
"type"
|
"type"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -242849,7 +242870,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"memory": {
|
"memory": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
"$ref": "#/components/schemas/EnvironmentRef"
|
"$ref": "#/components/schemas/EnvironmentRef"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": true
|
||||||
},
|
},
|
||||||
"__meta": {
|
"__meta": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -244660,7 +244686,7 @@
|
|||||||
"examples": [
|
"examples": [
|
||||||
"// This function adds two numbers.\nfn add(a, b) {\n return a + b\n}\n\n// This function adds an array of numbers.\n// It uses the `reduce` function, to call the `add` function on every\n// element of the `arr` parameter. The starting value is 0.\nfn sum(arr) {\n return reduce(arr, 0, add)\n}\n\n/* The above is basically like this pseudo-code:\nfn sum(arr):\n sumSoFar = 0\n for i in arr:\n sumSoFar = add(sumSoFar, i)\n return sumSoFar */\n\n\n// We use `assertEqual` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassertEqual(sum([1, 2, 3]), 6, 0.00001, \"1 + 2 + 3 summed is 6\")",
|
"// This function adds two numbers.\nfn add(a, b) {\n return a + b\n}\n\n// This function adds an array of numbers.\n// It uses the `reduce` function, to call the `add` function on every\n// element of the `arr` parameter. The starting value is 0.\nfn sum(arr) {\n return reduce(arr, 0, add)\n}\n\n/* The above is basically like this pseudo-code:\nfn sum(arr):\n sumSoFar = 0\n for i in arr:\n sumSoFar = add(sumSoFar, i)\n return sumSoFar */\n\n\n// We use `assertEqual` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassertEqual(sum([1, 2, 3]), 6, 0.00001, \"1 + 2 + 3 summed is 6\")",
|
||||||
"// This example works just like the previous example above, but it uses\n// an anonymous `add` function as its parameter, instead of declaring a\n// named function outside.\narr = [1, 2, 3]\nsum = reduce(arr, 0, fn(i, result_so_far) {\n return i + result_so_far\n})\n\n// We use `assertEqual` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassertEqual(sum, 6, 0.00001, \"1 + 2 + 3 summed is 6\")",
|
"// This example works just like the previous example above, but it uses\n// an anonymous `add` function as its parameter, instead of declaring a\n// named function outside.\narr = [1, 2, 3]\nsum = reduce(arr, 0, fn(i, result_so_far) {\n return i + result_so_far\n})\n\n// We use `assertEqual` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassertEqual(sum, 6, 0.00001, \"1 + 2 + 3 summed is 6\")",
|
||||||
"// Declare a function that sketches a decagon.\nfn decagon(radius) {\n // Each side of the decagon is turned this many degrees from the previous angle.\n stepAngle = 1 / 10 * tau()\n\n // Start the decagon sketch at this point.\n startOfDecagonSketch = startSketchOn('XY')\n |> startProfileAt([cos(0) * radius, sin(0) * radius], %)\n\n // Use a `reduce` to draw the remaining decagon sides.\n // For each number in the array 1..10, run the given function,\n // which takes a partially-sketched decagon and adds one more edge to it.\n fullDecagon = reduce([1..10], startOfDecagonSketch, fn(i, partialDecagon) {\n // Draw one edge of the decagon.\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n return line(partialDecagon, end = [x, y])\n })\n\n return fullDecagon\n}\n\n/* The `decagon` above is basically like this pseudo-code:\nfn decagon(radius):\n stepAngle = (1/10) * tau()\n plane = startSketchOn('XY')\n startOfDecagonSketch = startProfileAt([(cos(0)*radius), (sin(0) * radius)], plane)\n\n // Here's the reduce part.\n partialDecagon = startOfDecagonSketch\n for i in [1..10]:\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n partialDecagon = line(partialDecagon, end = [x, y])\n fullDecagon = partialDecagon // it's now full\n return fullDecagon */\n\n\n// Use the `decagon` function declared above, to sketch a decagon with radius 5.\ndecagon(5.0)\n |> close()"
|
"// Declare a function that sketches a decagon.\nfn decagon(radius) {\n // Each side of the decagon is turned this many degrees from the previous angle.\n stepAngle = 1 / 10 * TAU\n\n // Start the decagon sketch at this point.\n startOfDecagonSketch = startSketchOn('XY')\n |> startProfileAt([cos(0) * radius, sin(0) * radius], %)\n\n // Use a `reduce` to draw the remaining decagon sides.\n // For each number in the array 1..10, run the given function,\n // which takes a partially-sketched decagon and adds one more edge to it.\n fullDecagon = reduce([1..10], startOfDecagonSketch, fn(i, partialDecagon) {\n // Draw one edge of the decagon.\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n return line(partialDecagon, end = [x, y])\n })\n\n return fullDecagon\n}\n\n/* The `decagon` above is basically like this pseudo-code:\nfn decagon(radius):\n stepAngle = (1/10) * TAU\n plane = startSketchOn('XY')\n startOfDecagonSketch = startProfileAt([(cos(0)*radius), (sin(0) * radius)], plane)\n\n // Here's the reduce part.\n partialDecagon = startOfDecagonSketch\n for i in [1..10]:\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n partialDecagon = line(partialDecagon, end = [x, y])\n fullDecagon = partialDecagon // it's now full\n return fullDecagon */\n\n\n// Use the `decagon` function declared above, to sketch a decagon with radius 5.\ndecagon(5.0)\n |> close()"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -265136,48 +265162,6 @@
|
|||||||
"// Shell sketched on face objects on the end face, include all sketches to shell\n// the entire object.\n\n\nsize = 100\ncase = startSketchOn('XY')\n |> startProfileAt([-size, -size], %)\n |> line(end = [2 * size, 0])\n |> line(end = [0, 2 * size])\n |> tangentialArcTo([-size, size], %)\n |> close()\n |> extrude(length = 65)\n\nthing1 = startSketchOn(case, 'end')\n |> circle({\n center = [-size / 2, -size / 2],\n radius = 25\n }, %)\n |> extrude(length = 50)\n\nthing2 = startSketchOn(case, 'end')\n |> circle({\n center = [size / 2, -size / 2],\n radius = 25\n }, %)\n |> extrude(length = 50)\n\n// We put \"thing1\" and \"thing2\" in the shell function to shell the end face of the object.\nshell([thing1, thing2], faces = ['end'], thickness = 5)"
|
"// Shell sketched on face objects on the end face, include all sketches to shell\n// the entire object.\n\n\nsize = 100\ncase = startSketchOn('XY')\n |> startProfileAt([-size, -size], %)\n |> line(end = [2 * size, 0])\n |> line(end = [0, 2 * size])\n |> tangentialArcTo([-size, size], %)\n |> close()\n |> extrude(length = 65)\n\nthing1 = startSketchOn(case, 'end')\n |> circle({\n center = [-size / 2, -size / 2],\n radius = 25\n }, %)\n |> extrude(length = 50)\n\nthing2 = startSketchOn(case, 'end')\n |> circle({\n center = [size / 2, -size / 2],\n radius = 25\n }, %)\n |> extrude(length = 50)\n\n// We put \"thing1\" and \"thing2\" in the shell function to shell the end face of the object.\nshell([thing1, thing2], faces = ['end'], thickness = 5)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "sin",
|
|
||||||
"summary": "Compute the sine of a number (in radians).",
|
|
||||||
"description": "",
|
|
||||||
"tags": [
|
|
||||||
"math"
|
|
||||||
],
|
|
||||||
"keywordArguments": false,
|
|
||||||
"args": [
|
|
||||||
{
|
|
||||||
"name": "num",
|
|
||||||
"type": "number",
|
|
||||||
"schema": {
|
|
||||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
|
||||||
"title": "double",
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"required": true,
|
|
||||||
"includeInSnippet": true,
|
|
||||||
"labelRequired": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"returnValue": {
|
|
||||||
"name": "",
|
|
||||||
"type": "number",
|
|
||||||
"schema": {
|
|
||||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
|
||||||
"title": "double",
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"required": true,
|
|
||||||
"includeInSnippet": true,
|
|
||||||
"labelRequired": true
|
|
||||||
},
|
|
||||||
"unpublished": false,
|
|
||||||
"deprecated": false,
|
|
||||||
"examples": [
|
|
||||||
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({\n angle = 50,\n length = 15 / sin(toDegrees(135))\n }, %)\n |> yLineTo(0, %)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "sqrt",
|
"name": "sqrt",
|
||||||
"summary": "Compute the square root of a number.",
|
"summary": "Compute the square root of a number.",
|
||||||
@ -285689,48 +285673,6 @@
|
|||||||
"// Create a spring by sweeping around a helix path.\n\n\n// Create a helix around the Z axis.\nhelixPath = helix(\n angleStart = 0,\n ccw = true,\n revolutions = 4,\n length = 10,\n radius = 5,\n axis = 'Z',\n)\n\n// Create a spring by sweeping around the helix path.\nspringSketch = startSketchOn('YZ')\n |> circle({ center = [0, 0], radius = 1 }, %)\n |> sweep(path = helixPath)"
|
"// Create a spring by sweeping around a helix path.\n\n\n// Create a helix around the Z axis.\nhelixPath = helix(\n angleStart = 0,\n ccw = true,\n revolutions = 4,\n length = 10,\n radius = 5,\n axis = 'Z',\n)\n\n// Create a spring by sweeping around the helix path.\nspringSketch = startSketchOn('YZ')\n |> circle({ center = [0, 0], radius = 1 }, %)\n |> sweep(path = helixPath)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "tan",
|
|
||||||
"summary": "Compute the tangent of a number (in radians).",
|
|
||||||
"description": "",
|
|
||||||
"tags": [
|
|
||||||
"math"
|
|
||||||
],
|
|
||||||
"keywordArguments": false,
|
|
||||||
"args": [
|
|
||||||
{
|
|
||||||
"name": "num",
|
|
||||||
"type": "number",
|
|
||||||
"schema": {
|
|
||||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
|
||||||
"title": "double",
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"required": true,
|
|
||||||
"includeInSnippet": true,
|
|
||||||
"labelRequired": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"returnValue": {
|
|
||||||
"name": "",
|
|
||||||
"type": "number",
|
|
||||||
"schema": {
|
|
||||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
|
||||||
"title": "double",
|
|
||||||
"type": "number",
|
|
||||||
"format": "double"
|
|
||||||
},
|
|
||||||
"required": true,
|
|
||||||
"includeInSnippet": true,
|
|
||||||
"labelRequired": true
|
|
||||||
},
|
|
||||||
"unpublished": false,
|
|
||||||
"deprecated": false,
|
|
||||||
"examples": [
|
|
||||||
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 50, length = 50 * tan(1 / 2) }, %)\n |> yLineTo(0, %)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "tangentToEnd",
|
"name": "tangentToEnd",
|
||||||
"summary": "Returns the angle coming out of the end of the segment in degrees.",
|
"summary": "Returns the angle coming out of the end of the segment in degrees.",
|
||||||
@ -301795,7 +301737,7 @@
|
|||||||
{
|
{
|
||||||
"name": "tau",
|
"name": "tau",
|
||||||
"summary": "Return the value of `tau`. The full circle constant (τ). Equal to 2π.",
|
"summary": "Return the value of `tau`. The full circle constant (τ). Equal to 2π.",
|
||||||
"description": "",
|
"description": "**DEPRECATED** use the constant TAU",
|
||||||
"tags": [
|
"tags": [
|
||||||
"math"
|
"math"
|
||||||
],
|
],
|
||||||
@ -301815,7 +301757,7 @@
|
|||||||
"labelRequired": true
|
"labelRequired": true
|
||||||
},
|
},
|
||||||
"unpublished": false,
|
"unpublished": false,
|
||||||
"deprecated": false,
|
"deprecated": true,
|
||||||
"examples": [
|
"examples": [
|
||||||
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 50, length = 10 * tau() }, %)\n |> yLineTo(0, %)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
|
"exampleSketch = startSketchOn(\"XZ\")\n |> startProfileAt([0, 0], %)\n |> angledLine({ angle = 50, length = 10 * tau() }, %)\n |> yLineTo(0, %)\n |> close()\n\nexample = extrude(exampleSketch, length = 5)"
|
||||||
]
|
]
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -4,9 +4,11 @@ excerpt: "Return the value of `tau`. The full circle constant (τ). Equal to 2π
|
|||||||
layout: manual
|
layout: manual
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**WARNING:** This function is deprecated.
|
||||||
|
|
||||||
Return the value of `tau`. The full circle constant (τ). Equal to 2π.
|
Return the value of `tau`. The full circle constant (τ). Equal to 2π.
|
||||||
|
|
||||||
|
**DEPRECATED** use the constant TAU
|
||||||
|
|
||||||
```js
|
```js
|
||||||
tau() -> number
|
tau() -> number
|
||||||
|
|||||||
@ -295,7 +295,7 @@ Data for an imported geometry.
|
|||||||
| Property | Type | Description | Required |
|
| Property | Type | Description | Required |
|
||||||
|----------|------|-------------|----------|
|
|----------|------|-------------|----------|
|
||||||
| `type` |enum: `Function`| | No |
|
| `type` |enum: `Function`| | No |
|
||||||
| `memory` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| Any KCL value. | No |
|
| `memory` |[`EnvironmentRef`](/docs/kcl/types/EnvironmentRef)| | No |
|
||||||
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
| `__meta` |`[` [`Metadata`](/docs/kcl/types/Metadata) `]`| | No |
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -33,11 +33,8 @@ describe('processMemory', () => {
|
|||||||
const output = processMemory(execState.variables)
|
const output = processMemory(execState.variables)
|
||||||
expect(output.myVar).toEqual(5)
|
expect(output.myVar).toEqual(5)
|
||||||
expect(output.otherVar).toEqual(3)
|
expect(output.otherVar).toEqual(3)
|
||||||
expect(output).toEqual({
|
expect(output.myFn).toEqual('__function(a)__')
|
||||||
myVar: 5,
|
expect(output.theExtrude).toEqual([
|
||||||
myFn: '__function(a)__',
|
|
||||||
otherVar: 3,
|
|
||||||
theExtrude: [
|
|
||||||
{
|
{
|
||||||
type: 'extrudePlane',
|
type: 'extrudePlane',
|
||||||
tag: null,
|
tag: null,
|
||||||
@ -52,8 +49,8 @@ describe('processMemory', () => {
|
|||||||
faceId: expect.any(String),
|
faceId: expect.any(String),
|
||||||
sourceRange: [expect.any(Number), expect.any(Number), 0],
|
sourceRange: [expect.any(Number), expect.any(Number), 0],
|
||||||
},
|
},
|
||||||
],
|
])
|
||||||
theSketch: [
|
expect(output.theSketch).toEqual([
|
||||||
{
|
{
|
||||||
type: 'ToPoint',
|
type: 'ToPoint',
|
||||||
to: [-3.35, 0.17],
|
to: [-3.35, 0.17],
|
||||||
@ -75,7 +72,6 @@ describe('processMemory', () => {
|
|||||||
units: { type: 'Mm' },
|
units: { type: 'Mm' },
|
||||||
tag: null,
|
tag: null,
|
||||||
},
|
},
|
||||||
],
|
])
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -57,6 +57,7 @@ export function UnitsMenu() {
|
|||||||
const newCode = changeKclSettings(codeManager.code, {
|
const newCode = changeKclSettings(codeManager.code, {
|
||||||
defaultLengthUnits: unitLengthToUnitLen(unit),
|
defaultLengthUnits: unitLengthToUnitLen(unit),
|
||||||
defaultAngleUnits: { type: 'Degrees' },
|
defaultAngleUnits: { type: 'Degrees' },
|
||||||
|
stdPath: null,
|
||||||
})
|
})
|
||||||
if (err(newCode)) {
|
if (err(newCode)) {
|
||||||
toast.error(
|
toast.error(
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
use std::collections::BTreeMap;
|
use std::collections::{BTreeMap, HashMap};
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use base64::Engine;
|
use base64::Engine;
|
||||||
@ -13,6 +13,8 @@ use crate::{
|
|||||||
std::StdLib,
|
std::StdLib,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use super::kcl_doc::{ConstData, DocData, FnData};
|
||||||
|
|
||||||
const TYPES_DIR: &str = "../../../docs/kcl/types";
|
const TYPES_DIR: &str = "../../../docs/kcl/types";
|
||||||
|
|
||||||
fn init_handlebars() -> Result<handlebars::Handlebars<'static>> {
|
fn init_handlebars() -> Result<handlebars::Handlebars<'static>> {
|
||||||
@ -289,17 +291,19 @@ fn init_handlebars() -> Result<handlebars::Handlebars<'static>> {
|
|||||||
hbs.register_template_string("schema", include_str!("templates/schema.hbs"))?;
|
hbs.register_template_string("schema", include_str!("templates/schema.hbs"))?;
|
||||||
hbs.register_template_string("index", include_str!("templates/index.hbs"))?;
|
hbs.register_template_string("index", include_str!("templates/index.hbs"))?;
|
||||||
hbs.register_template_string("function", include_str!("templates/function.hbs"))?;
|
hbs.register_template_string("function", include_str!("templates/function.hbs"))?;
|
||||||
|
hbs.register_template_string("const", include_str!("templates/const.hbs"))?;
|
||||||
hbs.register_template_string("type", include_str!("templates/type.hbs"))?;
|
hbs.register_template_string("type", include_str!("templates/type.hbs"))?;
|
||||||
|
|
||||||
Ok(hbs)
|
Ok(hbs)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generate_index(combined: &IndexMap<String, Box<dyn StdLibFn>>) -> Result<()> {
|
fn generate_index(combined: &IndexMap<String, Box<dyn StdLibFn>>, kcl_lib: &[DocData]) -> Result<()> {
|
||||||
let hbs = init_handlebars()?;
|
let hbs = init_handlebars()?;
|
||||||
|
|
||||||
let mut functions = Vec::new();
|
let mut functions = HashMap::new();
|
||||||
|
functions.insert("std".to_owned(), Vec::new());
|
||||||
|
|
||||||
for key in combined.keys().sorted() {
|
for key in combined.keys() {
|
||||||
let internal_fn = combined
|
let internal_fn = combined
|
||||||
.get(key)
|
.get(key)
|
||||||
.ok_or_else(|| anyhow::anyhow!("Failed to get internal function: {}", key))?;
|
.ok_or_else(|| anyhow::anyhow!("Failed to get internal function: {}", key))?;
|
||||||
@ -308,13 +312,41 @@ fn generate_index(combined: &IndexMap<String, Box<dyn StdLibFn>>) -> Result<()>
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
functions.push(json!({
|
functions
|
||||||
"name": internal_fn.name(),
|
.get_mut("std")
|
||||||
}));
|
.unwrap()
|
||||||
|
.push((internal_fn.name(), internal_fn.name()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for d in kcl_lib {
|
||||||
|
if d.hide() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
functions.entry(d.mod_name()).or_default().push(match d {
|
||||||
|
DocData::Fn(f) => (f.name.clone(), d.file_name()),
|
||||||
|
DocData::Const(c) => (c.name.clone(), d.file_name()),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut sorted: Vec<_> = functions
|
||||||
|
.into_iter()
|
||||||
|
.map(|(m, mut fns)| {
|
||||||
|
fns.sort();
|
||||||
|
let val = json!({
|
||||||
|
"name": m,
|
||||||
|
"functions": fns.into_iter().map(|(n, f)| json!({
|
||||||
|
"name": n,
|
||||||
|
"file_name": f,
|
||||||
|
})).collect::<Vec<_>>(),
|
||||||
|
});
|
||||||
|
(m, val)
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
sorted.sort_by(|t1, t2| t1.0.cmp(&t2.0));
|
||||||
|
let data: Vec<_> = sorted.into_iter().map(|(_, val)| val).collect();
|
||||||
let data = json!({
|
let data = json!({
|
||||||
"functions": functions,
|
"modules": data,
|
||||||
});
|
});
|
||||||
|
|
||||||
let output = hbs.render("index", &data)?;
|
let output = hbs.render("index", &data)?;
|
||||||
@ -324,6 +356,112 @@ fn generate_index(combined: &IndexMap<String, Box<dyn StdLibFn>>) -> Result<()>
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn generate_function_from_kcl(function: &FnData, file_name: String) -> Result<()> {
|
||||||
|
if function.properties.doc_hidden {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
|
let hbs = init_handlebars()?;
|
||||||
|
|
||||||
|
let name = function.name.clone();
|
||||||
|
|
||||||
|
let examples: Vec<serde_json::Value> = function
|
||||||
|
.examples
|
||||||
|
.iter()
|
||||||
|
.enumerate()
|
||||||
|
.map(|(index, example)| {
|
||||||
|
let image_path = format!(
|
||||||
|
"{}/tests/outputs/serial_test_example_{}{}.png",
|
||||||
|
env!("CARGO_MANIFEST_DIR"),
|
||||||
|
file_name,
|
||||||
|
index
|
||||||
|
);
|
||||||
|
let image_data =
|
||||||
|
std::fs::read(&image_path).unwrap_or_else(|_| panic!("Failed to read image file: {}", image_path));
|
||||||
|
let image_base64 = base64::engine::general_purpose::STANDARD.encode(&image_data);
|
||||||
|
|
||||||
|
json!({
|
||||||
|
"content": example,
|
||||||
|
"image_base64": image_base64,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
let data = json!({
|
||||||
|
"name": function.qual_name,
|
||||||
|
"summary": function.summary,
|
||||||
|
"description": function.description,
|
||||||
|
"deprecated": function.properties.deprecated,
|
||||||
|
"fn_signature": name.clone() + &function.fn_signature(),
|
||||||
|
"tags": [],
|
||||||
|
"examples": examples,
|
||||||
|
"is_utilities": false,
|
||||||
|
"args": function.args.iter().map(|arg| {
|
||||||
|
json!({
|
||||||
|
"name": arg.name,
|
||||||
|
"type_": arg.ty,
|
||||||
|
"description": arg.docs.as_deref().unwrap_or(""),
|
||||||
|
"required": arg.kind.required(),
|
||||||
|
})
|
||||||
|
}).collect::<Vec<_>>(),
|
||||||
|
"return_value": function.return_type.as_ref().map(|t| {
|
||||||
|
json!({
|
||||||
|
"type_": t,
|
||||||
|
"description": "",
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
let output = hbs.render("function", &data)?;
|
||||||
|
expectorate::assert_contents(format!("../../../docs/kcl/{}.md", file_name), &output);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn generate_const_from_kcl(cnst: &ConstData, file_name: String) -> Result<()> {
|
||||||
|
if cnst.properties.doc_hidden {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
let hbs = init_handlebars()?;
|
||||||
|
|
||||||
|
let examples: Vec<serde_json::Value> = cnst
|
||||||
|
.examples
|
||||||
|
.iter()
|
||||||
|
.enumerate()
|
||||||
|
.map(|(index, example)| {
|
||||||
|
let image_path = format!(
|
||||||
|
"{}/tests/outputs/serial_test_example_{}{}.png",
|
||||||
|
env!("CARGO_MANIFEST_DIR"),
|
||||||
|
file_name,
|
||||||
|
index
|
||||||
|
);
|
||||||
|
let image_data =
|
||||||
|
std::fs::read(&image_path).unwrap_or_else(|_| panic!("Failed to read image file: {}", image_path));
|
||||||
|
let image_base64 = base64::engine::general_purpose::STANDARD.encode(&image_data);
|
||||||
|
|
||||||
|
json!({
|
||||||
|
"content": example,
|
||||||
|
"image_base64": image_base64,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
let data = json!({
|
||||||
|
"name": cnst.qual_name,
|
||||||
|
"summary": cnst.summary,
|
||||||
|
"description": cnst.description,
|
||||||
|
"deprecated": cnst.properties.deprecated,
|
||||||
|
"type_": cnst.ty,
|
||||||
|
"examples": examples,
|
||||||
|
"value": cnst.value.as_deref().unwrap_or(""),
|
||||||
|
});
|
||||||
|
|
||||||
|
let output = hbs.render("const", &data)?;
|
||||||
|
expectorate::assert_contents(format!("../../../docs/kcl/const_{}.md", file_name), &output);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn generate_function(internal_fn: Box<dyn StdLibFn>) -> Result<BTreeMap<String, schemars::schema::Schema>> {
|
fn generate_function(internal_fn: Box<dyn StdLibFn>) -> Result<BTreeMap<String, schemars::schema::Schema>> {
|
||||||
let hbs = init_handlebars()?;
|
let hbs = init_handlebars()?;
|
||||||
|
|
||||||
@ -802,9 +940,10 @@ fn recurse_and_create_references(
|
|||||||
fn test_generate_stdlib_markdown_docs() {
|
fn test_generate_stdlib_markdown_docs() {
|
||||||
let stdlib = StdLib::new();
|
let stdlib = StdLib::new();
|
||||||
let combined = stdlib.combined();
|
let combined = stdlib.combined();
|
||||||
|
let kcl_std = crate::docs::kcl_doc::walk_prelude();
|
||||||
|
|
||||||
// Generate the index which is the table of contents.
|
// Generate the index which is the table of contents.
|
||||||
generate_index(&combined).unwrap();
|
generate_index(&combined, &kcl_std).unwrap();
|
||||||
|
|
||||||
let mut types = BTreeMap::new();
|
let mut types = BTreeMap::new();
|
||||||
for key in combined.keys().sorted() {
|
for key in combined.keys().sorted() {
|
||||||
@ -817,6 +956,13 @@ fn test_generate_stdlib_markdown_docs() {
|
|||||||
for (name, schema) in &types {
|
for (name, schema) in &types {
|
||||||
generate_type(name, schema, &types).unwrap();
|
generate_type(name, schema, &types).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for d in &kcl_std {
|
||||||
|
match d {
|
||||||
|
DocData::Fn(f) => generate_function_from_kcl(f, d.file_name()).unwrap(),
|
||||||
|
DocData::Const(c) => generate_const_from_kcl(c, d.file_name()).unwrap(),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
704
src/wasm-lib/kcl/src/docs/kcl_doc.rs
Normal file
704
src/wasm-lib/kcl/src/docs/kcl_doc.rs
Normal file
@ -0,0 +1,704 @@
|
|||||||
|
use tower_lsp::lsp_types::{
|
||||||
|
CompletionItem, CompletionItemKind, CompletionItemLabelDetails, Documentation, InsertTextFormat, MarkupContent,
|
||||||
|
MarkupKind, ParameterInformation, ParameterLabel, SignatureHelp, SignatureInformation,
|
||||||
|
};
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
parsing::{
|
||||||
|
ast::types::{Annotation, Node, NonCodeNode, NonCodeValue, VariableKind},
|
||||||
|
token::NumericSuffix,
|
||||||
|
},
|
||||||
|
ModuleId,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub fn walk_prelude() -> Vec<DocData> {
|
||||||
|
let mut visitor = CollectionVisitor::default();
|
||||||
|
visitor.visit_module("prelude").unwrap();
|
||||||
|
visitor.result
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Default)]
|
||||||
|
struct CollectionVisitor {
|
||||||
|
name: String,
|
||||||
|
result: Vec<DocData>,
|
||||||
|
id: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CollectionVisitor {
|
||||||
|
fn visit_module(&mut self, name: &str) -> Result<(), String> {
|
||||||
|
let old_name = std::mem::replace(&mut self.name, name.to_owned());
|
||||||
|
let source = crate::modules::read_std(name).unwrap();
|
||||||
|
let parsed = crate::parsing::parse_str(source, ModuleId::from_usize(self.id))
|
||||||
|
.parse_errs_as_err()
|
||||||
|
.unwrap();
|
||||||
|
self.id += 1;
|
||||||
|
|
||||||
|
for (i, n) in parsed.body.iter().enumerate() {
|
||||||
|
match n {
|
||||||
|
crate::parsing::ast::types::BodyItem::ImportStatement(import) if !import.visibility.is_default() => {
|
||||||
|
// Only supports glob imports for now.
|
||||||
|
assert!(matches!(
|
||||||
|
import.selector,
|
||||||
|
crate::parsing::ast::types::ImportSelector::Glob(..)
|
||||||
|
));
|
||||||
|
match &import.path {
|
||||||
|
crate::parsing::ast::types::ImportPath::Std { path } => {
|
||||||
|
self.visit_module(&path[1])?;
|
||||||
|
}
|
||||||
|
p => return Err(format!("Unexpected import: `{p}`")),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
crate::parsing::ast::types::BodyItem::VariableDeclaration(var) if !var.visibility.is_default() => {
|
||||||
|
let mut dd = match var.kind {
|
||||||
|
// TODO metadata for args
|
||||||
|
VariableKind::Fn => DocData::Fn(FnData::from_ast(var, format!("std::{}::", self.name))),
|
||||||
|
VariableKind::Const => {
|
||||||
|
DocData::Const(ConstData::from_ast(var, format!("std::{}::", self.name)))
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// FIXME this association of metadata with items is pretty flaky.
|
||||||
|
if i == 0 {
|
||||||
|
dd.with_meta(&parsed.non_code_meta.start_nodes, &var.outer_attrs);
|
||||||
|
} else if let Some(meta) = parsed.non_code_meta.non_code_nodes.get(&(i - 1)) {
|
||||||
|
dd.with_meta(meta, &var.outer_attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
self.result.push(dd);
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.name = old_name;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub enum DocData {
|
||||||
|
Fn(FnData),
|
||||||
|
Const(ConstData),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DocData {
|
||||||
|
pub fn name(&self) -> &str {
|
||||||
|
match self {
|
||||||
|
DocData::Fn(f) => &f.name,
|
||||||
|
DocData::Const(c) => &c.name,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub fn file_name(&self) -> String {
|
||||||
|
match self {
|
||||||
|
DocData::Fn(f) => f.qual_name.replace("::", "-"),
|
||||||
|
DocData::Const(c) => format!("const_{}", c.qual_name.replace("::", "-")),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub fn mod_name(&self) -> String {
|
||||||
|
let q = match self {
|
||||||
|
DocData::Fn(f) => &f.qual_name,
|
||||||
|
DocData::Const(c) => &c.qual_name,
|
||||||
|
};
|
||||||
|
q[0..q.rfind("::").unwrap()].to_owned()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub fn hide(&self) -> bool {
|
||||||
|
match self {
|
||||||
|
DocData::Fn(f) => f.properties.doc_hidden || f.properties.deprecated,
|
||||||
|
DocData::Const(c) => c.properties.doc_hidden || c.properties.deprecated,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn to_completion_item(&self) -> CompletionItem {
|
||||||
|
match self {
|
||||||
|
DocData::Fn(f) => f.to_completion_item(),
|
||||||
|
DocData::Const(c) => c.to_completion_item(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn to_signature_help(&self) -> Option<SignatureHelp> {
|
||||||
|
match self {
|
||||||
|
DocData::Fn(f) => Some(f.to_signature_help()),
|
||||||
|
DocData::Const(_) => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn with_meta(&mut self, meta: &[Node<NonCodeNode>], attrs: &[Node<Annotation>]) {
|
||||||
|
match self {
|
||||||
|
DocData::Fn(f) => f.with_meta(meta, attrs),
|
||||||
|
DocData::Const(c) => c.with_meta(meta, attrs),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
fn examples(&self) -> &[String] {
|
||||||
|
match self {
|
||||||
|
DocData::Fn(f) => &f.examples,
|
||||||
|
DocData::Const(c) => &c.examples,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct ConstData {
|
||||||
|
pub name: String,
|
||||||
|
/// The fully qualified name.
|
||||||
|
pub qual_name: String,
|
||||||
|
pub value: Option<String>,
|
||||||
|
pub ty: Option<String>,
|
||||||
|
pub properties: Properties,
|
||||||
|
|
||||||
|
/// The summary of the function.
|
||||||
|
pub summary: Option<String>,
|
||||||
|
/// The description of the function.
|
||||||
|
pub description: Option<String>,
|
||||||
|
/// Code examples.
|
||||||
|
/// These are tested and we know they compile and execute.
|
||||||
|
pub examples: Vec<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ConstData {
|
||||||
|
fn from_ast(var: &crate::parsing::ast::types::VariableDeclaration, mut qual_name: String) -> Self {
|
||||||
|
assert_eq!(var.kind, crate::parsing::ast::types::VariableKind::Const);
|
||||||
|
|
||||||
|
let (value, ty) = match &var.declaration.init {
|
||||||
|
crate::parsing::ast::types::Expr::Literal(lit) => (
|
||||||
|
Some(lit.raw.clone()),
|
||||||
|
Some(match &lit.value {
|
||||||
|
crate::parsing::ast::types::LiteralValue::Number { suffix, .. } => {
|
||||||
|
if *suffix == NumericSuffix::None || *suffix == NumericSuffix::Count {
|
||||||
|
"number".to_owned()
|
||||||
|
} else {
|
||||||
|
format!("number({suffix})")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
crate::parsing::ast::types::LiteralValue::String { .. } => "string".to_owned(),
|
||||||
|
crate::parsing::ast::types::LiteralValue::Bool { .. } => "boolean".to_owned(),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
_ => (None, None),
|
||||||
|
};
|
||||||
|
|
||||||
|
let name = var.declaration.id.name.clone();
|
||||||
|
qual_name.push_str(&name);
|
||||||
|
ConstData {
|
||||||
|
name,
|
||||||
|
qual_name,
|
||||||
|
value,
|
||||||
|
// TODO use type decl when we have them.
|
||||||
|
ty,
|
||||||
|
properties: Properties {
|
||||||
|
exported: !var.visibility.is_default(),
|
||||||
|
deprecated: false,
|
||||||
|
doc_hidden: false,
|
||||||
|
impl_kind: ImplKind::Kcl,
|
||||||
|
},
|
||||||
|
summary: None,
|
||||||
|
description: None,
|
||||||
|
examples: Vec::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn short_docs(&self) -> Option<String> {
|
||||||
|
match (&self.summary, &self.description) {
|
||||||
|
(None, None) => None,
|
||||||
|
(None, Some(d)) | (Some(d), None) => Some(d.clone()),
|
||||||
|
(Some(s), Some(d)) => Some(format!("{s}\n\n{d}")),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn to_completion_item(&self) -> CompletionItem {
|
||||||
|
let mut detail = self.qual_name.clone();
|
||||||
|
if let Some(ty) = &self.ty {
|
||||||
|
detail.push_str(": ");
|
||||||
|
detail.push_str(ty);
|
||||||
|
}
|
||||||
|
CompletionItem {
|
||||||
|
label: self.name.clone(),
|
||||||
|
label_details: Some(CompletionItemLabelDetails {
|
||||||
|
detail: self.value.clone(),
|
||||||
|
description: None,
|
||||||
|
}),
|
||||||
|
kind: Some(CompletionItemKind::CONSTANT),
|
||||||
|
detail: Some(detail),
|
||||||
|
documentation: self.short_docs().map(|s| {
|
||||||
|
Documentation::MarkupContent(MarkupContent {
|
||||||
|
kind: MarkupKind::Markdown,
|
||||||
|
value: s,
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
deprecated: Some(self.properties.deprecated),
|
||||||
|
preselect: None,
|
||||||
|
sort_text: None,
|
||||||
|
filter_text: None,
|
||||||
|
insert_text: None,
|
||||||
|
insert_text_format: None,
|
||||||
|
insert_text_mode: None,
|
||||||
|
text_edit: None,
|
||||||
|
additional_text_edits: None,
|
||||||
|
command: None,
|
||||||
|
commit_characters: None,
|
||||||
|
data: None,
|
||||||
|
tags: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct FnData {
|
||||||
|
/// The name of the function.
|
||||||
|
pub name: String,
|
||||||
|
/// The fully qualified name.
|
||||||
|
pub qual_name: String,
|
||||||
|
/// The args of the function.
|
||||||
|
pub args: Vec<ArgData>,
|
||||||
|
/// The return value of the function.
|
||||||
|
pub return_type: Option<String>,
|
||||||
|
pub properties: Properties,
|
||||||
|
|
||||||
|
/// The summary of the function.
|
||||||
|
pub summary: Option<String>,
|
||||||
|
/// The description of the function.
|
||||||
|
pub description: Option<String>,
|
||||||
|
/// Code examples.
|
||||||
|
/// These are tested and we know they compile and execute.
|
||||||
|
pub examples: Vec<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FnData {
|
||||||
|
fn from_ast(var: &crate::parsing::ast::types::VariableDeclaration, mut qual_name: String) -> Self {
|
||||||
|
assert_eq!(var.kind, crate::parsing::ast::types::VariableKind::Fn);
|
||||||
|
let crate::parsing::ast::types::Expr::FunctionExpression(expr) = &var.declaration.init else {
|
||||||
|
unreachable!();
|
||||||
|
};
|
||||||
|
let name = var.declaration.id.name.clone();
|
||||||
|
qual_name.push_str(&name);
|
||||||
|
FnData {
|
||||||
|
name,
|
||||||
|
qual_name,
|
||||||
|
args: expr.params.iter().map(ArgData::from_ast).collect(),
|
||||||
|
return_type: expr.return_type.as_ref().map(|t| t.recast(&Default::default(), 0)),
|
||||||
|
properties: Properties {
|
||||||
|
exported: !var.visibility.is_default(),
|
||||||
|
deprecated: false,
|
||||||
|
doc_hidden: false,
|
||||||
|
impl_kind: ImplKind::Kcl,
|
||||||
|
},
|
||||||
|
summary: None,
|
||||||
|
description: None,
|
||||||
|
examples: Vec::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn short_docs(&self) -> Option<String> {
|
||||||
|
match (&self.summary, &self.description) {
|
||||||
|
(None, None) => None,
|
||||||
|
(None, Some(d)) | (Some(d), None) => Some(d.clone()),
|
||||||
|
(Some(s), Some(d)) => Some(format!("{s}\n\n{d}")),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn fn_signature(&self) -> String {
|
||||||
|
let mut signature = String::new();
|
||||||
|
|
||||||
|
signature.push('(');
|
||||||
|
for (i, arg) in self.args.iter().enumerate() {
|
||||||
|
if i > 0 {
|
||||||
|
signature.push_str(", ");
|
||||||
|
}
|
||||||
|
match &arg.kind {
|
||||||
|
ArgKind::Special => signature.push_str(&format!("@{}", arg.name)),
|
||||||
|
ArgKind::Labelled(false) => signature.push_str(&arg.name),
|
||||||
|
ArgKind::Labelled(true) => signature.push_str(&format!("{}?", arg.name)),
|
||||||
|
}
|
||||||
|
if let Some(ty) = &arg.ty {
|
||||||
|
signature.push_str(&format!(": {ty}"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
signature.push(')');
|
||||||
|
if let Some(ty) = &self.return_type {
|
||||||
|
signature.push_str(&format!(": {ty}"));
|
||||||
|
}
|
||||||
|
|
||||||
|
signature
|
||||||
|
}
|
||||||
|
|
||||||
|
fn to_completion_item(&self) -> CompletionItem {
|
||||||
|
CompletionItem {
|
||||||
|
label: self.name.clone(),
|
||||||
|
label_details: Some(CompletionItemLabelDetails {
|
||||||
|
detail: Some(self.fn_signature()),
|
||||||
|
description: None,
|
||||||
|
}),
|
||||||
|
kind: Some(CompletionItemKind::FUNCTION),
|
||||||
|
detail: Some(self.qual_name.clone()),
|
||||||
|
documentation: self.short_docs().map(|s| {
|
||||||
|
Documentation::MarkupContent(MarkupContent {
|
||||||
|
kind: MarkupKind::Markdown,
|
||||||
|
value: s,
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
deprecated: Some(self.properties.deprecated),
|
||||||
|
preselect: None,
|
||||||
|
sort_text: None,
|
||||||
|
filter_text: None,
|
||||||
|
insert_text: Some(self.to_autocomplete_snippet()),
|
||||||
|
insert_text_format: Some(InsertTextFormat::SNIPPET),
|
||||||
|
insert_text_mode: None,
|
||||||
|
text_edit: None,
|
||||||
|
additional_text_edits: None,
|
||||||
|
command: None,
|
||||||
|
commit_characters: None,
|
||||||
|
data: None,
|
||||||
|
tags: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn to_autocomplete_snippet(&self) -> String {
|
||||||
|
if self.name == "loft" {
|
||||||
|
return "loft([${0:sketch000}, ${1:sketch001}])${}".to_owned();
|
||||||
|
} else if self.name == "hole" {
|
||||||
|
return "hole(${0:holeSketch}, ${1:%})${}".to_owned();
|
||||||
|
}
|
||||||
|
let mut args = Vec::new();
|
||||||
|
let mut index = 0;
|
||||||
|
for arg in self.args.iter() {
|
||||||
|
if let Some((i, arg_str)) = arg.get_autocomplete_snippet(index) {
|
||||||
|
index = i + 1;
|
||||||
|
args.push(arg_str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// We end with ${} so you can jump to the end of the snippet.
|
||||||
|
// After the last argument.
|
||||||
|
format!("{}({})${{}}", self.name, args.join(", "))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn to_signature_help(&self) -> SignatureHelp {
|
||||||
|
// TODO Fill this in based on the current position of the cursor.
|
||||||
|
let active_parameter = None;
|
||||||
|
|
||||||
|
SignatureHelp {
|
||||||
|
signatures: vec![SignatureInformation {
|
||||||
|
label: self.name.clone(),
|
||||||
|
documentation: self.short_docs().map(|s| {
|
||||||
|
Documentation::MarkupContent(MarkupContent {
|
||||||
|
kind: MarkupKind::Markdown,
|
||||||
|
value: s,
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
parameters: Some(self.args.iter().map(|arg| arg.to_param_info()).collect()),
|
||||||
|
active_parameter,
|
||||||
|
}],
|
||||||
|
active_signature: Some(0),
|
||||||
|
active_parameter,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct Properties {
|
||||||
|
pub deprecated: bool,
|
||||||
|
pub doc_hidden: bool,
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub exported: bool,
|
||||||
|
pub impl_kind: ImplKind,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub enum ImplKind {
|
||||||
|
Kcl,
|
||||||
|
Rust,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct ArgData {
|
||||||
|
/// The name of the argument.
|
||||||
|
pub name: String,
|
||||||
|
/// The type of the argument.
|
||||||
|
pub ty: Option<String>,
|
||||||
|
/// If the argument is required.
|
||||||
|
pub kind: ArgKind,
|
||||||
|
/// Additional information that could be used instead of the type's description.
|
||||||
|
/// This is helpful if the type is really basic, like "u32" -- that won't tell the user much about
|
||||||
|
/// how this argument is meant to be used.
|
||||||
|
pub docs: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
pub enum ArgKind {
|
||||||
|
Special,
|
||||||
|
// Parameter is whether the arg is optional.
|
||||||
|
// TODO should store default value if present
|
||||||
|
Labelled(bool),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ArgData {
|
||||||
|
fn from_ast(arg: &crate::parsing::ast::types::Parameter) -> Self {
|
||||||
|
ArgData {
|
||||||
|
name: arg.identifier.name.clone(),
|
||||||
|
ty: arg.type_.as_ref().map(|t| t.recast(&Default::default(), 0)),
|
||||||
|
// Doc comments are not yet supported on parameters.
|
||||||
|
docs: None,
|
||||||
|
kind: if arg.labeled {
|
||||||
|
ArgKind::Labelled(arg.optional())
|
||||||
|
} else {
|
||||||
|
ArgKind::Special
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn _with_meta(&mut self, _meta: &[Node<NonCodeNode>]) {
|
||||||
|
// TODO use comments for docs (we can't currently get the comments for an argument)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_autocomplete_snippet(&self, index: usize) -> Option<(usize, String)> {
|
||||||
|
match &self.ty {
|
||||||
|
Some(s)
|
||||||
|
if [
|
||||||
|
"Sketch",
|
||||||
|
"SketchSet",
|
||||||
|
"Solid",
|
||||||
|
"SolidSet",
|
||||||
|
"SketchSurface",
|
||||||
|
"SketchOrSurface",
|
||||||
|
]
|
||||||
|
.contains(&&**s) =>
|
||||||
|
{
|
||||||
|
Some((index, format!("${{{}:{}}}", index, "%")))
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn to_param_info(&self) -> ParameterInformation {
|
||||||
|
ParameterInformation {
|
||||||
|
label: ParameterLabel::Simple(self.name.clone()),
|
||||||
|
documentation: self.docs.as_ref().map(|docs| {
|
||||||
|
Documentation::MarkupContent(MarkupContent {
|
||||||
|
kind: MarkupKind::Markdown,
|
||||||
|
value: docs.clone(),
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ArgKind {
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub fn required(self) -> bool {
|
||||||
|
match self {
|
||||||
|
ArgKind::Special => true,
|
||||||
|
ArgKind::Labelled(opt) => !opt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
trait ApplyMeta {
|
||||||
|
fn apply_docs(&mut self, summary: Option<String>, description: Option<String>, examples: Vec<String>);
|
||||||
|
fn deprecated(&mut self, deprecated: bool);
|
||||||
|
fn doc_hidden(&mut self, doc_hidden: bool);
|
||||||
|
fn impl_kind(&mut self, impl_kind: ImplKind);
|
||||||
|
|
||||||
|
fn with_meta(&mut self, meta: &[Node<NonCodeNode>], attrs: &[Node<Annotation>]) {
|
||||||
|
for attr in attrs {
|
||||||
|
if let Annotation {
|
||||||
|
name: None,
|
||||||
|
properties: Some(props),
|
||||||
|
..
|
||||||
|
} = &attr.inner
|
||||||
|
{
|
||||||
|
for p in props {
|
||||||
|
match &*p.key.name {
|
||||||
|
"impl" => {
|
||||||
|
if let Some(s) = p.value.ident_name() {
|
||||||
|
self.impl_kind(match s {
|
||||||
|
"kcl" => ImplKind::Kcl,
|
||||||
|
"std_rust" => ImplKind::Rust,
|
||||||
|
_ => unreachable!(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"deprecated" => {
|
||||||
|
if let Some(b) = p.value.literal_bool() {
|
||||||
|
self.deprecated(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"doc_hidden" => {
|
||||||
|
if let Some(b) = p.value.literal_bool() {
|
||||||
|
self.doc_hidden(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let mut comments = Vec::new();
|
||||||
|
for m in meta {
|
||||||
|
match &m.value {
|
||||||
|
NonCodeValue::BlockComment { value, .. } | NonCodeValue::NewLineBlockComment { value, .. } => {
|
||||||
|
comments.push(value)
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut summary = None;
|
||||||
|
let mut description = None;
|
||||||
|
let mut example: Option<String> = None;
|
||||||
|
let mut examples = Vec::new();
|
||||||
|
for l in comments.into_iter().filter(|l| l.starts_with('/')).map(|l| {
|
||||||
|
if let Some(ll) = l.strip_prefix("/ ") {
|
||||||
|
ll
|
||||||
|
} else {
|
||||||
|
&l[1..]
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
if description.is_none() && summary.is_none() {
|
||||||
|
summary = Some(l.to_owned());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if description.is_none() {
|
||||||
|
if l.is_empty() {
|
||||||
|
description = Some(String::new());
|
||||||
|
} else {
|
||||||
|
description = summary;
|
||||||
|
summary = None;
|
||||||
|
let d = description.as_mut().unwrap();
|
||||||
|
d.push_str(l);
|
||||||
|
d.push('\n');
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if l.starts_with("```") {
|
||||||
|
if let Some(e) = example {
|
||||||
|
examples.push(e.trim().to_owned());
|
||||||
|
example = None;
|
||||||
|
} else {
|
||||||
|
example = Some(String::new());
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if let Some(e) = &mut example {
|
||||||
|
e.push_str(l);
|
||||||
|
e.push('\n');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
match &mut description {
|
||||||
|
Some(d) => {
|
||||||
|
d.push_str(l);
|
||||||
|
d.push('\n');
|
||||||
|
}
|
||||||
|
None => unreachable!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert!(example.is_none());
|
||||||
|
if let Some(d) = &mut description {
|
||||||
|
if d.is_empty() {
|
||||||
|
description = None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.apply_docs(
|
||||||
|
summary.map(|s| s.trim().to_owned()),
|
||||||
|
description.map(|s| s.trim().to_owned()),
|
||||||
|
examples,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ApplyMeta for ConstData {
|
||||||
|
fn apply_docs(&mut self, summary: Option<String>, description: Option<String>, examples: Vec<String>) {
|
||||||
|
self.summary = summary;
|
||||||
|
self.description = description;
|
||||||
|
self.examples = examples;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn deprecated(&mut self, deprecated: bool) {
|
||||||
|
self.properties.deprecated = deprecated;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn doc_hidden(&mut self, doc_hidden: bool) {
|
||||||
|
self.properties.doc_hidden = doc_hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn impl_kind(&mut self, _impl_kind: ImplKind) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ApplyMeta for FnData {
|
||||||
|
fn apply_docs(&mut self, summary: Option<String>, description: Option<String>, examples: Vec<String>) {
|
||||||
|
self.summary = summary;
|
||||||
|
self.description = description;
|
||||||
|
self.examples = examples;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn deprecated(&mut self, deprecated: bool) {
|
||||||
|
self.properties.deprecated = deprecated;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn doc_hidden(&mut self, doc_hidden: bool) {
|
||||||
|
self.properties.doc_hidden = doc_hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn impl_kind(&mut self, impl_kind: ImplKind) {
|
||||||
|
self.properties.impl_kind = impl_kind;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn smoke() {
|
||||||
|
let result = walk_prelude();
|
||||||
|
for d in result {
|
||||||
|
if let DocData::Const(d) = d {
|
||||||
|
if d.name == "PI" {
|
||||||
|
assert!(d.value.unwrap().starts_with('3'));
|
||||||
|
assert_eq!(d.ty, Some("number".to_owned()));
|
||||||
|
assert_eq!(d.qual_name, "std::math::PI");
|
||||||
|
assert!(d.summary.is_some());
|
||||||
|
assert!(!d.examples.is_empty());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
panic!("didn't find PI");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||||
|
async fn test_examples() -> miette::Result<()> {
|
||||||
|
let std = walk_prelude();
|
||||||
|
for d in std {
|
||||||
|
for (i, eg) in d.examples().iter().enumerate() {
|
||||||
|
let result =
|
||||||
|
match crate::test_server::execute_and_snapshot(eg, crate::settings::types::UnitLength::Mm, None)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
Err(crate::errors::ExecError::Kcl(e)) => {
|
||||||
|
return Err(miette::Report::new(crate::errors::Report {
|
||||||
|
error: e.error,
|
||||||
|
filename: format!("{}{i}", d.name()),
|
||||||
|
kcl_source: eg.to_string(),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
Err(other_err) => panic!("{}", other_err),
|
||||||
|
Ok(img) => img,
|
||||||
|
};
|
||||||
|
twenty_twenty::assert_image(
|
||||||
|
format!("tests/outputs/serial_test_example_{}{i}.png", d.file_name()),
|
||||||
|
&result,
|
||||||
|
0.99,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod gen_std_tests;
|
mod gen_std_tests;
|
||||||
|
pub mod kcl_doc;
|
||||||
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
@ -896,60 +897,6 @@ fn get_autocomplete_string_from_schema(schema: &schemars::schema::Schema) -> Res
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn completion_item_from_enum_schema(
|
|
||||||
schema: &schemars::schema::Schema,
|
|
||||||
kind: CompletionItemKind,
|
|
||||||
) -> Result<CompletionItem> {
|
|
||||||
// Get the docs for the schema.
|
|
||||||
let schemars::schema::Schema::Object(o) = schema else {
|
|
||||||
anyhow::bail!("expected object schema: {:#?}", schema);
|
|
||||||
};
|
|
||||||
let description = get_description_string_from_schema(&schemars::schema::RootSchema {
|
|
||||||
schema: o.clone(),
|
|
||||||
..Default::default()
|
|
||||||
})
|
|
||||||
.unwrap_or_default();
|
|
||||||
let Some(enum_values) = o.enum_values.as_ref() else {
|
|
||||||
anyhow::bail!("expected enum values: {:#?}", o);
|
|
||||||
};
|
|
||||||
|
|
||||||
if enum_values.len() > 1 {
|
|
||||||
anyhow::bail!("expected only one enum value: {:#?}", o);
|
|
||||||
}
|
|
||||||
|
|
||||||
if enum_values.is_empty() {
|
|
||||||
anyhow::bail!("expected at least one enum value: {:#?}", o);
|
|
||||||
}
|
|
||||||
|
|
||||||
let serde_json::Value::String(ref enum_value) = enum_values[0] else {
|
|
||||||
anyhow::bail!("expected string enum value: {:#?}", enum_values[0]);
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(CompletionItem {
|
|
||||||
label: enum_value.to_string(),
|
|
||||||
label_details: None,
|
|
||||||
kind: Some(kind),
|
|
||||||
detail: Some(description.to_string()),
|
|
||||||
documentation: Some(Documentation::MarkupContent(MarkupContent {
|
|
||||||
kind: MarkupKind::Markdown,
|
|
||||||
value: description.to_string(),
|
|
||||||
})),
|
|
||||||
deprecated: Some(false),
|
|
||||||
preselect: None,
|
|
||||||
sort_text: None,
|
|
||||||
filter_text: None,
|
|
||||||
insert_text: None,
|
|
||||||
insert_text_format: None,
|
|
||||||
insert_text_mode: None,
|
|
||||||
text_edit: None,
|
|
||||||
additional_text_edits: None,
|
|
||||||
command: None,
|
|
||||||
commit_characters: None,
|
|
||||||
data: None,
|
|
||||||
tags: None,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use pretty_assertions::assert_eq;
|
use pretty_assertions::assert_eq;
|
||||||
@ -1138,13 +1085,15 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn get_all_stdlib_autocomplete_snippets() {
|
fn get_all_stdlib_autocomplete_snippets() {
|
||||||
let stdlib = crate::std::StdLib::new();
|
let stdlib = crate::std::StdLib::new();
|
||||||
crate::lsp::kcl::get_completions_from_stdlib(&stdlib).unwrap();
|
let kcl_std = crate::docs::kcl_doc::walk_prelude();
|
||||||
|
crate::lsp::kcl::get_completions_from_stdlib(&stdlib, &kcl_std).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
// We want to test the signatures we compile at lsp start.
|
// We want to test the signatures we compile at lsp start.
|
||||||
#[test]
|
#[test]
|
||||||
fn get_all_stdlib_signatures() {
|
fn get_all_stdlib_signatures() {
|
||||||
let stdlib = crate::std::StdLib::new();
|
let stdlib = crate::std::StdLib::new();
|
||||||
crate::lsp::kcl::get_signatures_from_stdlib(&stdlib);
|
let kcl_std = crate::docs::kcl_doc::walk_prelude();
|
||||||
|
crate::lsp::kcl::get_signatures_from_stdlib(&stdlib, &kcl_std);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
33
src/wasm-lib/kcl/src/docs/templates/const.hbs
vendored
Normal file
33
src/wasm-lib/kcl/src/docs/templates/const.hbs
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
title: "{{name}}"
|
||||||
|
excerpt: "{{safe_yaml summary}}"
|
||||||
|
layout: manual
|
||||||
|
---
|
||||||
|
|
||||||
|
{{#if deprecated}}
|
||||||
|
**WARNING:** This function is deprecated.
|
||||||
|
|
||||||
|
{{/if}}
|
||||||
|
{{{summary}}}
|
||||||
|
|
||||||
|
{{{description}}}
|
||||||
|
|
||||||
|
```js
|
||||||
|
{{{name}}}{{#if type_}}: {{{type_}}}{{/if}}{{#if value}} = {{{value}}}{{/if}}
|
||||||
|
```
|
||||||
|
|
||||||
|
{{#if examples}}
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
{{#each examples}}
|
||||||
|
```js
|
||||||
|
{{{this.content}}}
|
||||||
|
```
|
||||||
|
|
||||||
|
{{#unless @root.is_utilities}}
|
||||||
|

|
||||||
|
|
||||||
|
{{/unless}}
|
||||||
|
{{/each}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
@ -9,6 +9,9 @@ layout: manual
|
|||||||
* [Types](kcl/types)
|
* [Types](kcl/types)
|
||||||
* [Modules](kcl/modules)
|
* [Modules](kcl/modules)
|
||||||
* [Known Issues](kcl/KNOWN-ISSUES)
|
* [Known Issues](kcl/KNOWN-ISSUES)
|
||||||
|
{{#each modules}}
|
||||||
|
* **`{{name}}`**
|
||||||
{{#each functions}}
|
{{#each functions}}
|
||||||
* [`{{name}}`](kcl/{{name}})
|
* [`{{name}}`](kcl/{{file_name}})
|
||||||
|
{{/each}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|||||||
@ -12,8 +12,7 @@ use crate::{
|
|||||||
kcl_value::NumericType,
|
kcl_value::NumericType,
|
||||||
memory,
|
memory,
|
||||||
state::ModuleState,
|
state::ModuleState,
|
||||||
BodyType, EnvironmentRef, ExecState, ExecutorContext, KclValue, MemoryFunction, Metadata, TagEngineInfo,
|
BodyType, EnvironmentRef, ExecState, ExecutorContext, KclValue, Metadata, TagEngineInfo, TagIdentifier,
|
||||||
TagIdentifier,
|
|
||||||
},
|
},
|
||||||
modules::{ModuleId, ModulePath, ModuleRepr},
|
modules::{ModuleId, ModulePath, ModuleRepr},
|
||||||
parsing::ast::types::{
|
parsing::ast::types::{
|
||||||
@ -34,7 +33,17 @@ enum StatementKind<'a> {
|
|||||||
Expression,
|
Expression,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a> StatementKind<'a> {
|
||||||
|
fn expect_name(&self) -> &'a str {
|
||||||
|
match self {
|
||||||
|
StatementKind::Declaration { name } => name,
|
||||||
|
StatementKind::Expression => unreachable!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl ExecutorContext {
|
impl ExecutorContext {
|
||||||
|
/// Returns true if importing the prelude should be skipped.
|
||||||
async fn handle_annotations(
|
async fn handle_annotations(
|
||||||
&self,
|
&self,
|
||||||
annotations: impl Iterator<Item = &Node<Annotation>>,
|
annotations: impl Iterator<Item = &Node<Annotation>>,
|
||||||
@ -83,14 +92,41 @@ impl ExecutorContext {
|
|||||||
exec_state: &mut ExecState,
|
exec_state: &mut ExecState,
|
||||||
body_type: BodyType,
|
body_type: BodyType,
|
||||||
) -> Result<Option<KclValue>, KclError> {
|
) -> Result<Option<KclValue>, KclError> {
|
||||||
if body_type == BodyType::Root {
|
if let BodyType::Root(init_mem) = body_type {
|
||||||
let _no_prelude = self
|
let no_prelude = self
|
||||||
.handle_annotations(
|
.handle_annotations(
|
||||||
program.inner_attrs.iter(),
|
program.inner_attrs.iter(),
|
||||||
annotations::AnnotationScope::Module,
|
annotations::AnnotationScope::Module,
|
||||||
exec_state,
|
exec_state,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
if !no_prelude && init_mem {
|
||||||
|
// Import std::prelude
|
||||||
|
let prelude_range = SourceRange::from(program).start_as_range();
|
||||||
|
let id = self
|
||||||
|
.open_module(
|
||||||
|
&ImportPath::Std {
|
||||||
|
path: vec!["std".to_owned(), "prelude".to_owned()],
|
||||||
|
},
|
||||||
|
&[],
|
||||||
|
exec_state,
|
||||||
|
prelude_range,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
let (module_memory, module_exports) = self
|
||||||
|
.exec_module_for_items(id, exec_state, ExecutionKind::Isolated, prelude_range)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
for name in module_exports {
|
||||||
|
let item = exec_state
|
||||||
|
.memory()
|
||||||
|
.get_from(&name, module_memory, prelude_range)
|
||||||
|
.cloned()
|
||||||
|
.unwrap();
|
||||||
|
exec_state.mut_memory().add(name, item, prelude_range)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut last_expr = None;
|
let mut last_expr = None;
|
||||||
@ -98,7 +134,7 @@ impl ExecutorContext {
|
|||||||
for statement in &program.body {
|
for statement in &program.body {
|
||||||
match statement {
|
match statement {
|
||||||
BodyItem::ImportStatement(import_stmt) => {
|
BodyItem::ImportStatement(import_stmt) => {
|
||||||
if body_type != BodyType::Root {
|
if !matches!(body_type, BodyType::Root(_)) {
|
||||||
return Err(KclError::Semantic(KclErrorDetails {
|
return Err(KclError::Semantic(KclErrorDetails {
|
||||||
message: "Imports are only supported at the top-level of a file.".to_owned(),
|
message: "Imports are only supported at the top-level of a file.".to_owned(),
|
||||||
source_ranges: vec![import_stmt.into()],
|
source_ranges: vec![import_stmt.into()],
|
||||||
@ -194,6 +230,7 @@ impl ExecutorContext {
|
|||||||
&expression_statement.expression,
|
&expression_statement.expression,
|
||||||
exec_state,
|
exec_state,
|
||||||
&metadata,
|
&metadata,
|
||||||
|
&[],
|
||||||
StatementKind::Expression,
|
StatementKind::Expression,
|
||||||
)
|
)
|
||||||
.await?,
|
.await?,
|
||||||
@ -204,13 +241,14 @@ impl ExecutorContext {
|
|||||||
let source_range = SourceRange::from(&variable_declaration.declaration.init);
|
let source_range = SourceRange::from(&variable_declaration.declaration.init);
|
||||||
let metadata = Metadata { source_range };
|
let metadata = Metadata { source_range };
|
||||||
|
|
||||||
let _annotations = &variable_declaration.outer_attrs;
|
let annotations = &variable_declaration.outer_attrs;
|
||||||
|
|
||||||
let memory_item = self
|
let memory_item = self
|
||||||
.execute_expr(
|
.execute_expr(
|
||||||
&variable_declaration.declaration.init,
|
&variable_declaration.declaration.init,
|
||||||
exec_state,
|
exec_state,
|
||||||
&metadata,
|
&metadata,
|
||||||
|
annotations,
|
||||||
StatementKind::Declaration { name: &var_name },
|
StatementKind::Declaration { name: &var_name },
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
@ -227,7 +265,7 @@ impl ExecutorContext {
|
|||||||
BodyItem::ReturnStatement(return_statement) => {
|
BodyItem::ReturnStatement(return_statement) => {
|
||||||
let metadata = Metadata::from(return_statement);
|
let metadata = Metadata::from(return_statement);
|
||||||
|
|
||||||
if body_type == BodyType::Root {
|
if matches!(body_type, BodyType::Root(_)) {
|
||||||
return Err(KclError::Semantic(KclErrorDetails {
|
return Err(KclError::Semantic(KclErrorDetails {
|
||||||
message: "Cannot return from outside a function.".to_owned(),
|
message: "Cannot return from outside a function.".to_owned(),
|
||||||
source_ranges: vec![metadata.source_range],
|
source_ranges: vec![metadata.source_range],
|
||||||
@ -239,6 +277,7 @@ impl ExecutorContext {
|
|||||||
&return_statement.argument,
|
&return_statement.argument,
|
||||||
exec_state,
|
exec_state,
|
||||||
&metadata,
|
&metadata,
|
||||||
|
&[],
|
||||||
StatementKind::Expression,
|
StatementKind::Expression,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
@ -256,7 +295,7 @@ impl ExecutorContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if BodyType::Root == body_type {
|
if matches!(body_type, BodyType::Root(_)) {
|
||||||
// Flush the batch queue.
|
// Flush the batch queue.
|
||||||
self.engine
|
self.engine
|
||||||
.flush_batch(
|
.flush_batch(
|
||||||
@ -389,14 +428,14 @@ impl ExecutorContext {
|
|||||||
source_range: SourceRange,
|
source_range: SourceRange,
|
||||||
) -> Result<(Option<KclValue>, EnvironmentRef, Vec<String>), KclError> {
|
) -> Result<(Option<KclValue>, EnvironmentRef, Vec<String>), KclError> {
|
||||||
let old_units = exec_state.length_unit();
|
let old_units = exec_state.length_unit();
|
||||||
let mut local_state = ModuleState::new(&self.settings);
|
let mut local_state = ModuleState::new(&self.settings, path.std_path());
|
||||||
exec_state.global.mod_loader.enter_module(path);
|
exec_state.global.mod_loader.enter_module(path);
|
||||||
std::mem::swap(&mut exec_state.mod_local, &mut local_state);
|
std::mem::swap(&mut exec_state.mod_local, &mut local_state);
|
||||||
exec_state.mut_memory().push_new_root_env();
|
exec_state.mut_memory().push_new_root_env();
|
||||||
let original_execution = self.engine.replace_execution_kind(exec_kind).await;
|
let original_execution = self.engine.replace_execution_kind(exec_kind).await;
|
||||||
|
|
||||||
let result = self
|
let result = self
|
||||||
.exec_program(program, exec_state, crate::execution::BodyType::Root)
|
.exec_program(program, exec_state, crate::execution::BodyType::Root(true))
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let new_units = exec_state.length_unit();
|
let new_units = exec_state.length_unit();
|
||||||
@ -433,6 +472,7 @@ impl ExecutorContext {
|
|||||||
init: &Expr,
|
init: &Expr,
|
||||||
exec_state: &mut ExecState,
|
exec_state: &mut ExecState,
|
||||||
metadata: &Metadata,
|
metadata: &Metadata,
|
||||||
|
annotations: &[Node<Annotation>],
|
||||||
statement_kind: StatementKind<'a>,
|
statement_kind: StatementKind<'a>,
|
||||||
) -> Result<KclValue, KclError> {
|
) -> Result<KclValue, KclError> {
|
||||||
let item = match init {
|
let item = match init {
|
||||||
@ -463,12 +503,50 @@ impl ExecutorContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Expr::BinaryExpression(binary_expression) => binary_expression.get_result(exec_state, self).await?,
|
Expr::BinaryExpression(binary_expression) => binary_expression.get_result(exec_state, self).await?,
|
||||||
Expr::FunctionExpression(function_expression) => KclValue::Function {
|
Expr::FunctionExpression(function_expression) => {
|
||||||
|
let mut rust_impl = false;
|
||||||
|
for attr in annotations {
|
||||||
|
if attr.name.is_some() || attr.properties.is_none() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for p in attr.properties.as_ref().unwrap() {
|
||||||
|
if &*p.key.name == "impl" {
|
||||||
|
if let Some(s) = p.value.ident_name() {
|
||||||
|
if s == "std_rust" {
|
||||||
|
rust_impl = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if rust_impl {
|
||||||
|
if let Some(std_path) = &exec_state.mod_local.settings.std_path {
|
||||||
|
KclValue::Function {
|
||||||
|
expression: function_expression.clone(),
|
||||||
|
meta: vec![metadata.to_owned()],
|
||||||
|
func: Some(crate::std::std_fn(std_path, statement_kind.expect_name())),
|
||||||
|
memory: None,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return Err(KclError::Semantic(KclErrorDetails {
|
||||||
|
message: "Rust implementation of functions is restricted to the standard library"
|
||||||
|
.to_owned(),
|
||||||
|
source_ranges: vec![metadata.source_range],
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Cloning memory here is crucial for semantics so that we close
|
||||||
|
// over variables. Variables defined lexically later shouldn't
|
||||||
|
// be available to the function body.
|
||||||
|
KclValue::Function {
|
||||||
expression: function_expression.clone(),
|
expression: function_expression.clone(),
|
||||||
meta: vec![metadata.to_owned()],
|
meta: vec![metadata.to_owned()],
|
||||||
func: None,
|
func: None,
|
||||||
memory: exec_state.mut_memory().snapshot(),
|
memory: Some(exec_state.mut_memory().snapshot()),
|
||||||
},
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Expr::CallExpression(call_expression) => call_expression.execute(exec_state, self).await?,
|
Expr::CallExpression(call_expression) => call_expression.execute(exec_state, self).await?,
|
||||||
Expr::CallExpressionKw(call_expression) => call_expression.execute(exec_state, self).await?,
|
Expr::CallExpressionKw(call_expression) => call_expression.execute(exec_state, self).await?,
|
||||||
Expr::PipeExpression(pipe_expression) => pipe_expression.get_result(exec_state, self).await?,
|
Expr::PipeExpression(pipe_expression) => pipe_expression.get_result(exec_state, self).await?,
|
||||||
@ -501,7 +579,7 @@ impl ExecutorContext {
|
|||||||
Expr::IfExpression(expr) => expr.get_result(exec_state, self).await?,
|
Expr::IfExpression(expr) => expr.get_result(exec_state, self).await?,
|
||||||
Expr::LabelledExpression(expr) => {
|
Expr::LabelledExpression(expr) => {
|
||||||
let result = self
|
let result = self
|
||||||
.execute_expr(&expr.expr, exec_state, metadata, statement_kind)
|
.execute_expr(&expr.expr, exec_state, metadata, &[], statement_kind)
|
||||||
.await?;
|
.await?;
|
||||||
exec_state
|
exec_state
|
||||||
.mut_memory()
|
.mut_memory()
|
||||||
@ -836,7 +914,7 @@ pub(crate) async fn execute_pipe_body(
|
|||||||
source_range: SourceRange::from(first),
|
source_range: SourceRange::from(first),
|
||||||
};
|
};
|
||||||
let output = ctx
|
let output = ctx
|
||||||
.execute_expr(first, exec_state, &meta, StatementKind::Expression)
|
.execute_expr(first, exec_state, &meta, &[], StatementKind::Expression)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
// Now that we've evaluated the first child expression in the pipeline, following child expressions
|
// Now that we've evaluated the first child expression in the pipeline, following child expressions
|
||||||
@ -870,7 +948,7 @@ async fn inner_execute_pipe_body(
|
|||||||
source_range: SourceRange::from(expression),
|
source_range: SourceRange::from(expression),
|
||||||
};
|
};
|
||||||
let output = ctx
|
let output = ctx
|
||||||
.execute_expr(expression, exec_state, &metadata, StatementKind::Expression)
|
.execute_expr(expression, exec_state, &metadata, &[], StatementKind::Expression)
|
||||||
.await?;
|
.await?;
|
||||||
exec_state.mod_local.pipe_value = Some(output);
|
exec_state.mod_local.pipe_value = Some(output);
|
||||||
}
|
}
|
||||||
@ -891,7 +969,7 @@ impl Node<CallExpressionKw> {
|
|||||||
let source_range = SourceRange::from(arg_expr.arg.clone());
|
let source_range = SourceRange::from(arg_expr.arg.clone());
|
||||||
let metadata = Metadata { source_range };
|
let metadata = Metadata { source_range };
|
||||||
let value = ctx
|
let value = ctx
|
||||||
.execute_expr(&arg_expr.arg, exec_state, &metadata, StatementKind::Expression)
|
.execute_expr(&arg_expr.arg, exec_state, &metadata, &[], StatementKind::Expression)
|
||||||
.await?;
|
.await?;
|
||||||
fn_args.insert(arg_expr.label.name.clone(), Arg::new(value, source_range));
|
fn_args.insert(arg_expr.label.name.clone(), Arg::new(value, source_range));
|
||||||
}
|
}
|
||||||
@ -902,7 +980,7 @@ impl Node<CallExpressionKw> {
|
|||||||
let source_range = SourceRange::from(arg_expr.clone());
|
let source_range = SourceRange::from(arg_expr.clone());
|
||||||
let metadata = Metadata { source_range };
|
let metadata = Metadata { source_range };
|
||||||
let value = ctx
|
let value = ctx
|
||||||
.execute_expr(arg_expr, exec_state, &metadata, StatementKind::Expression)
|
.execute_expr(arg_expr, exec_state, &metadata, &[], StatementKind::Expression)
|
||||||
.await?;
|
.await?;
|
||||||
Some(Arg::new(value, source_range))
|
Some(Arg::new(value, source_range))
|
||||||
} else {
|
} else {
|
||||||
@ -1029,7 +1107,7 @@ impl Node<CallExpression> {
|
|||||||
source_range: SourceRange::from(arg_expr),
|
source_range: SourceRange::from(arg_expr),
|
||||||
};
|
};
|
||||||
let value = ctx
|
let value = ctx
|
||||||
.execute_expr(arg_expr, exec_state, &metadata, StatementKind::Expression)
|
.execute_expr(arg_expr, exec_state, &metadata, &[], StatementKind::Expression)
|
||||||
.await?;
|
.await?;
|
||||||
let arg = Arg::new(value, SourceRange::from(arg_expr));
|
let arg = Arg::new(value, SourceRange::from(arg_expr));
|
||||||
fn_args.push(arg);
|
fn_args.push(arg);
|
||||||
@ -1104,7 +1182,10 @@ impl Node<CallExpression> {
|
|||||||
source_range: callsite,
|
source_range: callsite,
|
||||||
});
|
});
|
||||||
|
|
||||||
let return_value = func.call_fn(fn_args, exec_state, ctx.clone()).await.map_err(|e| {
|
let return_value = func
|
||||||
|
.call_fn(fn_args, exec_state, ctx.clone(), source_range)
|
||||||
|
.await
|
||||||
|
.map_err(|e| {
|
||||||
// Add the call expression to the source ranges.
|
// Add the call expression to the source ranges.
|
||||||
// TODO currently ignored by the frontend
|
// TODO currently ignored by the frontend
|
||||||
e.add_source_ranges(vec![source_range])
|
e.add_source_ranges(vec![source_range])
|
||||||
@ -1251,7 +1332,7 @@ impl Node<ArrayExpression> {
|
|||||||
// TODO: Carry statement kind here so that we know if we're
|
// TODO: Carry statement kind here so that we know if we're
|
||||||
// inside a variable declaration.
|
// inside a variable declaration.
|
||||||
let value = ctx
|
let value = ctx
|
||||||
.execute_expr(element, exec_state, &metadata, StatementKind::Expression)
|
.execute_expr(element, exec_state, &metadata, &[], StatementKind::Expression)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
results.push(value);
|
results.push(value);
|
||||||
@ -1269,7 +1350,13 @@ impl Node<ArrayRangeExpression> {
|
|||||||
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
pub async fn execute(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||||
let metadata = Metadata::from(&self.start_element);
|
let metadata = Metadata::from(&self.start_element);
|
||||||
let start = ctx
|
let start = ctx
|
||||||
.execute_expr(&self.start_element, exec_state, &metadata, StatementKind::Expression)
|
.execute_expr(
|
||||||
|
&self.start_element,
|
||||||
|
exec_state,
|
||||||
|
&metadata,
|
||||||
|
&[],
|
||||||
|
StatementKind::Expression,
|
||||||
|
)
|
||||||
.await?;
|
.await?;
|
||||||
let start = start.as_int().ok_or(KclError::Semantic(KclErrorDetails {
|
let start = start.as_int().ok_or(KclError::Semantic(KclErrorDetails {
|
||||||
source_ranges: vec![self.into()],
|
source_ranges: vec![self.into()],
|
||||||
@ -1277,7 +1364,7 @@ impl Node<ArrayRangeExpression> {
|
|||||||
}))?;
|
}))?;
|
||||||
let metadata = Metadata::from(&self.end_element);
|
let metadata = Metadata::from(&self.end_element);
|
||||||
let end = ctx
|
let end = ctx
|
||||||
.execute_expr(&self.end_element, exec_state, &metadata, StatementKind::Expression)
|
.execute_expr(&self.end_element, exec_state, &metadata, &[], StatementKind::Expression)
|
||||||
.await?;
|
.await?;
|
||||||
let end = end.as_int().ok_or(KclError::Semantic(KclErrorDetails {
|
let end = end.as_int().ok_or(KclError::Semantic(KclErrorDetails {
|
||||||
source_ranges: vec![self.into()],
|
source_ranges: vec![self.into()],
|
||||||
@ -1321,7 +1408,7 @@ impl Node<ObjectExpression> {
|
|||||||
for property in &self.properties {
|
for property in &self.properties {
|
||||||
let metadata = Metadata::from(&property.value);
|
let metadata = Metadata::from(&property.value);
|
||||||
let result = ctx
|
let result = ctx
|
||||||
.execute_expr(&property.value, exec_state, &metadata, StatementKind::Expression)
|
.execute_expr(&property.value, exec_state, &metadata, &[], StatementKind::Expression)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
object.insert(property.key.name.clone(), result);
|
object.insert(property.key.name.clone(), result);
|
||||||
@ -1366,7 +1453,13 @@ impl Node<IfExpression> {
|
|||||||
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
pub async fn get_result(&self, exec_state: &mut ExecState, ctx: &ExecutorContext) -> Result<KclValue, KclError> {
|
||||||
// Check the `if` branch.
|
// Check the `if` branch.
|
||||||
let cond = ctx
|
let cond = ctx
|
||||||
.execute_expr(&self.cond, exec_state, &Metadata::from(self), StatementKind::Expression)
|
.execute_expr(
|
||||||
|
&self.cond,
|
||||||
|
exec_state,
|
||||||
|
&Metadata::from(self),
|
||||||
|
&[],
|
||||||
|
StatementKind::Expression,
|
||||||
|
)
|
||||||
.await?
|
.await?
|
||||||
.get_bool()?;
|
.get_bool()?;
|
||||||
if cond {
|
if cond {
|
||||||
@ -1384,6 +1477,7 @@ impl Node<IfExpression> {
|
|||||||
&else_if.cond,
|
&else_if.cond,
|
||||||
exec_state,
|
exec_state,
|
||||||
&Metadata::from(self),
|
&Metadata::from(self),
|
||||||
|
&[],
|
||||||
StatementKind::Expression,
|
StatementKind::Expression,
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
@ -1682,27 +1776,30 @@ pub(crate) async fn call_user_defined_function_kw(
|
|||||||
/// A function being used as a parameter into a stdlib function. This is a
|
/// A function being used as a parameter into a stdlib function. This is a
|
||||||
/// closure, plus everything needed to execute it.
|
/// closure, plus everything needed to execute it.
|
||||||
pub struct FunctionParam<'a> {
|
pub struct FunctionParam<'a> {
|
||||||
pub inner: Option<&'a MemoryFunction>,
|
pub inner: Option<&'a crate::std::StdFn>,
|
||||||
pub memory: EnvironmentRef,
|
pub memory: Option<EnvironmentRef>,
|
||||||
pub fn_expr: crate::parsing::ast::types::BoxNode<FunctionExpression>,
|
pub fn_expr: crate::parsing::ast::types::BoxNode<FunctionExpression>,
|
||||||
pub meta: Vec<Metadata>,
|
|
||||||
pub ctx: ExecutorContext,
|
pub ctx: ExecutorContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FunctionParam<'_> {
|
impl FunctionParam<'_> {
|
||||||
pub async fn call(&self, exec_state: &mut ExecState, args: Vec<Arg>) -> Result<Option<KclValue>, KclError> {
|
pub async fn call(
|
||||||
|
&self,
|
||||||
|
exec_state: &mut ExecState,
|
||||||
|
args: Vec<Arg>,
|
||||||
|
source_range: SourceRange,
|
||||||
|
) -> Result<Option<KclValue>, KclError> {
|
||||||
if let Some(inner) = self.inner {
|
if let Some(inner) = self.inner {
|
||||||
inner(
|
let args = crate::std::Args::new(
|
||||||
args,
|
args,
|
||||||
self.memory,
|
source_range,
|
||||||
self.fn_expr.clone(),
|
|
||||||
self.meta.clone(),
|
|
||||||
exec_state,
|
|
||||||
self.ctx.clone(),
|
self.ctx.clone(),
|
||||||
)
|
exec_state.mod_local.pipe_value.clone().map(Arg::synthetic),
|
||||||
.await
|
);
|
||||||
|
|
||||||
|
inner(exec_state, args).await.map(Some)
|
||||||
} else {
|
} else {
|
||||||
call_user_defined_function(args, self.memory, self.fn_expr.as_ref(), exec_state, &self.ctx).await
|
call_user_defined_function(args, self.memory.unwrap(), self.fn_expr.as_ref(), exec_state, &self.ctx).await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,10 +6,9 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
errors::KclErrorDetails,
|
errors::KclErrorDetails,
|
||||||
exec::Sketch,
|
|
||||||
execution::{
|
execution::{
|
||||||
ExecState, Face, Helix, ImportedGeometry, MemoryFunction, Metadata, Plane, SketchSet, Solid, SolidSet,
|
state::MetaSettings, EnvironmentRef, ExecState, ExecutorContext, Face, Helix, ImportedGeometry, Metadata,
|
||||||
TagIdentifier,
|
Plane, Sketch, SketchSet, Solid, SolidSet, TagIdentifier,
|
||||||
},
|
},
|
||||||
parsing::{
|
parsing::{
|
||||||
ast::types::{
|
ast::types::{
|
||||||
@ -18,11 +17,9 @@ use crate::{
|
|||||||
token::NumericSuffix,
|
token::NumericSuffix,
|
||||||
},
|
},
|
||||||
std::{args::Arg, FnAsArg},
|
std::{args::Arg, FnAsArg},
|
||||||
ExecutorContext, KclError, ModuleId, SourceRange,
|
KclError, ModuleId, SourceRange,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{memory::EnvironmentRef, MetaSettings};
|
|
||||||
|
|
||||||
pub type KclObjectFields = HashMap<String, KclValue>;
|
pub type KclObjectFields = HashMap<String, KclValue>;
|
||||||
|
|
||||||
/// Any KCL value.
|
/// Any KCL value.
|
||||||
@ -87,15 +84,12 @@ pub enum KclValue {
|
|||||||
ImportedGeometry(ImportedGeometry),
|
ImportedGeometry(ImportedGeometry),
|
||||||
#[ts(skip)]
|
#[ts(skip)]
|
||||||
Function {
|
Function {
|
||||||
/// Adam Chalmers speculation:
|
|
||||||
/// Reference to a KCL stdlib function (written in Rust).
|
|
||||||
/// Some if the KCL value is an alias of a stdlib function,
|
|
||||||
/// None if it's a KCL function written/declared in KCL.
|
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
func: Option<MemoryFunction>,
|
func: Option<crate::std::StdFn>,
|
||||||
#[schemars(skip)]
|
#[schemars(skip)]
|
||||||
expression: crate::parsing::ast::types::BoxNode<FunctionExpression>,
|
expression: crate::parsing::ast::types::BoxNode<FunctionExpression>,
|
||||||
memory: EnvironmentRef,
|
// Invariant: Always Some except for std lib functions
|
||||||
|
memory: Option<EnvironmentRef>,
|
||||||
#[serde(rename = "__meta")]
|
#[serde(rename = "__meta")]
|
||||||
meta: Vec<Metadata>,
|
meta: Vec<Metadata>,
|
||||||
},
|
},
|
||||||
@ -326,7 +320,11 @@ impl KclValue {
|
|||||||
|
|
||||||
pub(crate) fn map_env_ref(&self, env_map: &HashMap<EnvironmentRef, EnvironmentRef>) -> Self {
|
pub(crate) fn map_env_ref(&self, env_map: &HashMap<EnvironmentRef, EnvironmentRef>) -> Self {
|
||||||
let mut result = self.clone();
|
let mut result = self.clone();
|
||||||
if let KclValue::Function { ref mut memory, .. } = result {
|
if let KclValue::Function {
|
||||||
|
memory: Some(ref mut memory),
|
||||||
|
..
|
||||||
|
} = result
|
||||||
|
{
|
||||||
if let Some(new) = env_map.get(memory) {
|
if let Some(new) = env_map.get(memory) {
|
||||||
*memory = *new;
|
*memory = *new;
|
||||||
}
|
}
|
||||||
@ -555,12 +553,13 @@ impl KclValue {
|
|||||||
args: Vec<Arg>,
|
args: Vec<Arg>,
|
||||||
exec_state: &mut ExecState,
|
exec_state: &mut ExecState,
|
||||||
ctx: ExecutorContext,
|
ctx: ExecutorContext,
|
||||||
|
source_range: SourceRange,
|
||||||
) -> Result<Option<KclValue>, KclError> {
|
) -> Result<Option<KclValue>, KclError> {
|
||||||
let KclValue::Function {
|
let KclValue::Function {
|
||||||
func,
|
func,
|
||||||
expression,
|
expression,
|
||||||
memory: closure_memory,
|
memory: closure_memory,
|
||||||
meta,
|
..
|
||||||
} = &self
|
} = &self
|
||||||
else {
|
else {
|
||||||
return Err(KclError::Semantic(KclErrorDetails {
|
return Err(KclError::Semantic(KclErrorDetails {
|
||||||
@ -569,14 +568,20 @@ impl KclValue {
|
|||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
if let Some(func) = func {
|
if let Some(func) = func {
|
||||||
exec_state.mut_memory().push_new_env_for_call(*closure_memory);
|
exec_state.mut_memory().push_new_env_for_rust_call();
|
||||||
let result = func(args, *closure_memory, expression.clone(), meta.clone(), exec_state, ctx).await;
|
let args = crate::std::Args::new(
|
||||||
|
args,
|
||||||
|
source_range,
|
||||||
|
ctx.clone(),
|
||||||
|
exec_state.mod_local.pipe_value.clone().map(Arg::synthetic),
|
||||||
|
);
|
||||||
|
let result = func(exec_state, args).await.map(Some);
|
||||||
exec_state.mut_memory().pop_env();
|
exec_state.mut_memory().pop_env();
|
||||||
result
|
result
|
||||||
} else {
|
} else {
|
||||||
crate::execution::exec_ast::call_user_defined_function(
|
crate::execution::exec_ast::call_user_defined_function(
|
||||||
args,
|
args,
|
||||||
*closure_memory,
|
closure_memory.unwrap(),
|
||||||
expression.as_ref(),
|
expression.as_ref(),
|
||||||
exec_state,
|
exec_state,
|
||||||
&ctx,
|
&ctx,
|
||||||
@ -611,7 +616,7 @@ impl KclValue {
|
|||||||
} else {
|
} else {
|
||||||
crate::execution::exec_ast::call_user_defined_function_kw(
|
crate::execution::exec_ast::call_user_defined_function_kw(
|
||||||
args.kw_args,
|
args.kw_args,
|
||||||
*closure_memory,
|
closure_memory.unwrap(),
|
||||||
expression.as_ref(),
|
expression.as_ref(),
|
||||||
exec_state,
|
exec_state,
|
||||||
&ctx,
|
&ctx,
|
||||||
|
|||||||
@ -144,7 +144,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
errors::{KclError, KclErrorDetails},
|
errors::{KclError, KclErrorDetails},
|
||||||
execution::{KclValue, Metadata},
|
execution::KclValue,
|
||||||
source_range::SourceRange,
|
source_range::SourceRange,
|
||||||
};
|
};
|
||||||
use env::Environment;
|
use env::Environment;
|
||||||
@ -626,16 +626,8 @@ mod env {
|
|||||||
impl Environment {
|
impl Environment {
|
||||||
/// Create a new root environment (new program or module)
|
/// Create a new root environment (new program or module)
|
||||||
pub(super) fn new_root() -> Self {
|
pub(super) fn new_root() -> Self {
|
||||||
const NO_META: Vec<Metadata> = Vec::new();
|
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
// Prelude
|
bindings: IndexMap::new(),
|
||||||
bindings: IndexMap::from([
|
|
||||||
("ZERO".to_string(), KclValue::from_number(0.0, NO_META)),
|
|
||||||
("QUARTER_TURN".to_string(), KclValue::from_number(90.0, NO_META)),
|
|
||||||
("HALF_TURN".to_string(), KclValue::from_number(180.0, NO_META)),
|
|
||||||
("THREE_QUARTER_TURN".to_string(), KclValue::from_number(270.0, NO_META)),
|
|
||||||
]),
|
|
||||||
snapshots: Vec::new(),
|
snapshots: Vec::new(),
|
||||||
parent: None,
|
parent: None,
|
||||||
}
|
}
|
||||||
@ -1217,7 +1209,7 @@ mod test {
|
|||||||
KclValue::Function {
|
KclValue::Function {
|
||||||
func: None,
|
func: None,
|
||||||
expression: crate::parsing::ast::types::FunctionExpression::dummy(),
|
expression: crate::parsing::ast::types::FunctionExpression::dummy(),
|
||||||
memory: sn2,
|
memory: Some(sn2),
|
||||||
meta: Vec::new(),
|
meta: Vec::new(),
|
||||||
},
|
},
|
||||||
sr(),
|
sr(),
|
||||||
@ -1228,7 +1220,7 @@ mod test {
|
|||||||
assert_get(mem, "a", 1);
|
assert_get(mem, "a", 1);
|
||||||
assert_get(mem, "b", 2);
|
assert_get(mem, "b", 2);
|
||||||
match mem.get("f", SourceRange::default()).unwrap() {
|
match mem.get("f", SourceRange::default()).unwrap() {
|
||||||
KclValue::Function { memory, .. } if *memory == sn1 => {}
|
KclValue::Function { memory, .. } if memory.unwrap() == sn1 => {}
|
||||||
v => panic!("{v:#?}"),
|
v => panic!("{v:#?}"),
|
||||||
}
|
}
|
||||||
assert_eq!(mem.environments.len(), 1);
|
assert_eq!(mem.environments.len(), 1);
|
||||||
|
|||||||
@ -21,12 +21,13 @@ use crate::{
|
|||||||
execution::{
|
execution::{
|
||||||
artifact::build_artifact_graph,
|
artifact::build_artifact_graph,
|
||||||
cache::{CacheInformation, CacheResult},
|
cache::{CacheInformation, CacheResult},
|
||||||
|
memory::ProgramMemory,
|
||||||
},
|
},
|
||||||
fs::FileManager,
|
fs::FileManager,
|
||||||
parsing::ast::types::{Expr, FunctionExpression, Node, NodeRef, Program},
|
parsing::ast::types::{Expr, Node, NodeRef, Program},
|
||||||
settings::types::UnitLength,
|
settings::types::UnitLength,
|
||||||
source_range::SourceRange,
|
source_range::SourceRange,
|
||||||
std::{args::Arg, StdLib},
|
std::StdLib,
|
||||||
ExecError, KclErrorWithOutputs,
|
ExecError, KclErrorWithOutputs,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -131,16 +132,6 @@ impl std::hash::Hash for TagIdentifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type MemoryFunction =
|
|
||||||
fn(
|
|
||||||
s: Vec<Arg>,
|
|
||||||
memory: EnvironmentRef,
|
|
||||||
expression: crate::parsing::ast::types::BoxNode<FunctionExpression>,
|
|
||||||
metadata: Vec<Metadata>,
|
|
||||||
exec_state: &ExecState,
|
|
||||||
ctx: ExecutorContext,
|
|
||||||
) -> std::pin::Pin<Box<dyn std::future::Future<Output = Result<Option<KclValue>, KclError>> + Send>>;
|
|
||||||
|
|
||||||
/// Engine information for a tag.
|
/// Engine information for a tag.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
@ -156,11 +147,9 @@ pub struct TagEngineInfo {
|
|||||||
pub surface: Option<ExtrudeSurface>,
|
pub surface: Option<ExtrudeSurface>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
|
||||||
#[ts(export)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub enum BodyType {
|
pub enum BodyType {
|
||||||
Root,
|
Root(bool),
|
||||||
Block,
|
Block,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,18 +496,18 @@ impl ExecutorContext {
|
|||||||
assert!(self.is_mock());
|
assert!(self.is_mock());
|
||||||
|
|
||||||
let mut exec_state = ExecState::new(&self.settings);
|
let mut exec_state = ExecState::new(&self.settings);
|
||||||
let mut mem = if use_prev_memory {
|
let (mut mem, init_mem) = if use_prev_memory {
|
||||||
cache::read_old_memory()
|
cache::read_old_memory()
|
||||||
.await
|
.await
|
||||||
.unwrap_or_else(|| exec_state.memory().clone())
|
.map(|m| (m, false))
|
||||||
|
.unwrap_or_else(|| (ProgramMemory::new(), true))
|
||||||
} else {
|
} else {
|
||||||
exec_state.memory().clone()
|
(ProgramMemory::new(), true)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Add any extra variables to memory
|
// Add any extra variables to memory
|
||||||
let mut to_restore = Vec::new();
|
let mut to_restore = Vec::new();
|
||||||
for (k, v) in variables {
|
for (k, v) in variables {
|
||||||
crate::log::log(format!("add var: {k}"));
|
|
||||||
to_restore.push((k.clone(), mem.get(&k, SourceRange::default()).ok().cloned()));
|
to_restore.push((k.clone(), mem.get(&k, SourceRange::default()).ok().cloned()));
|
||||||
mem.add(k, v, SourceRange::synthetic())
|
mem.add(k, v, SourceRange::synthetic())
|
||||||
.map_err(KclErrorWithOutputs::no_outputs)?;
|
.map_err(KclErrorWithOutputs::no_outputs)?;
|
||||||
@ -530,7 +519,7 @@ impl ExecutorContext {
|
|||||||
|
|
||||||
*exec_state.mut_memory() = mem;
|
*exec_state.mut_memory() = mem;
|
||||||
|
|
||||||
self.inner_run(&program.ast, &mut exec_state).await?;
|
self.inner_run(&program.ast, &mut exec_state, init_mem).await?;
|
||||||
|
|
||||||
// Restore any temporary variables, then save any newly created variables back to
|
// Restore any temporary variables, then save any newly created variables back to
|
||||||
// memory in case another run wants to use them. Note this is just saved to the preserved
|
// memory in case another run wants to use them. Note this is just saved to the preserved
|
||||||
@ -549,14 +538,13 @@ impl ExecutorContext {
|
|||||||
cache::write_old_memory(mem).await;
|
cache::write_old_memory(mem).await;
|
||||||
|
|
||||||
let outcome = exec_state.to_mock_wasm_outcome();
|
let outcome = exec_state.to_mock_wasm_outcome();
|
||||||
crate::log::log(format!("return mock {:#?}", outcome.variables));
|
|
||||||
Ok(outcome)
|
Ok(outcome)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn run_with_caching(&self, program: crate::Program) -> Result<ExecOutcome, KclErrorWithOutputs> {
|
pub async fn run_with_caching(&self, program: crate::Program) -> Result<ExecOutcome, KclErrorWithOutputs> {
|
||||||
assert!(!self.is_mock());
|
assert!(!self.is_mock());
|
||||||
|
|
||||||
let (program, mut exec_state) = if let Some(OldAstState {
|
let (program, mut exec_state, init_mem) = if let Some(OldAstState {
|
||||||
ast: old_ast,
|
ast: old_ast,
|
||||||
exec_state: old_state,
|
exec_state: old_state,
|
||||||
settings: old_settings,
|
settings: old_settings,
|
||||||
@ -620,16 +608,16 @@ impl ExecutorContext {
|
|||||||
old_state
|
old_state
|
||||||
};
|
};
|
||||||
|
|
||||||
(program, exec_state)
|
(program, exec_state, clear_scene)
|
||||||
} else {
|
} else {
|
||||||
let mut exec_state = ExecState::new(&self.settings);
|
let mut exec_state = ExecState::new(&self.settings);
|
||||||
self.send_clear_scene(&mut exec_state, Default::default())
|
self.send_clear_scene(&mut exec_state, Default::default())
|
||||||
.await
|
.await
|
||||||
.map_err(KclErrorWithOutputs::no_outputs)?;
|
.map_err(KclErrorWithOutputs::no_outputs)?;
|
||||||
(program.ast, exec_state)
|
(program.ast, exec_state, true)
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = self.inner_run(&program, &mut exec_state).await;
|
let result = self.inner_run(&program, &mut exec_state, init_mem).await;
|
||||||
|
|
||||||
if result.is_err() {
|
if result.is_err() {
|
||||||
cache::bust_cache().await;
|
cache::bust_cache().await;
|
||||||
@ -678,7 +666,7 @@ impl ExecutorContext {
|
|||||||
self.send_clear_scene(exec_state, Default::default())
|
self.send_clear_scene(exec_state, Default::default())
|
||||||
.await
|
.await
|
||||||
.map_err(KclErrorWithOutputs::no_outputs)?;
|
.map_err(KclErrorWithOutputs::no_outputs)?;
|
||||||
self.inner_run(&program.ast, exec_state).await
|
self.inner_run(&program.ast, exec_state, true).await
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Perform the execution of a program. Accept all possible parameters and
|
/// Perform the execution of a program. Accept all possible parameters and
|
||||||
@ -687,6 +675,7 @@ impl ExecutorContext {
|
|||||||
&self,
|
&self,
|
||||||
program: &Node<Program>,
|
program: &Node<Program>,
|
||||||
exec_state: &mut ExecState,
|
exec_state: &mut ExecState,
|
||||||
|
init_mem: bool,
|
||||||
) -> Result<Option<ModelingSessionData>, KclErrorWithOutputs> {
|
) -> Result<Option<ModelingSessionData>, KclErrorWithOutputs> {
|
||||||
let _stats = crate::log::LogPerfStats::new("Interpretation");
|
let _stats = crate::log::LogPerfStats::new("Interpretation");
|
||||||
|
|
||||||
@ -696,7 +685,9 @@ impl ExecutorContext {
|
|||||||
.await
|
.await
|
||||||
.map_err(KclErrorWithOutputs::no_outputs)?;
|
.map_err(KclErrorWithOutputs::no_outputs)?;
|
||||||
|
|
||||||
self.execute_and_build_graph(program, exec_state).await.map_err(|e| {
|
self.execute_and_build_graph(program, exec_state, init_mem)
|
||||||
|
.await
|
||||||
|
.map_err(|e| {
|
||||||
KclErrorWithOutputs::new(
|
KclErrorWithOutputs::new(
|
||||||
e,
|
e,
|
||||||
exec_state.mod_local.operations.clone(),
|
exec_state.mod_local.operations.clone(),
|
||||||
@ -723,12 +714,11 @@ impl ExecutorContext {
|
|||||||
&self,
|
&self,
|
||||||
program: NodeRef<'_, crate::parsing::ast::types::Program>,
|
program: NodeRef<'_, crate::parsing::ast::types::Program>,
|
||||||
exec_state: &mut ExecState,
|
exec_state: &mut ExecState,
|
||||||
|
init_mem: bool,
|
||||||
) -> Result<Option<KclValue>, KclError> {
|
) -> Result<Option<KclValue>, KclError> {
|
||||||
// Don't early return! We need to build other outputs regardless of
|
// Don't early return! We need to build other outputs regardless of
|
||||||
// whether execution failed.
|
// whether execution failed.
|
||||||
let exec_result = self
|
let exec_result = self.exec_program(program, exec_state, BodyType::Root(init_mem)).await;
|
||||||
.exec_program(program, exec_state, crate::execution::BodyType::Root)
|
|
||||||
.await;
|
|
||||||
// Move the artifact commands and responses to simplify cache management
|
// Move the artifact commands and responses to simplify cache management
|
||||||
// and error creation.
|
// and error creation.
|
||||||
exec_state
|
exec_state
|
||||||
@ -1282,7 +1272,7 @@ let shape = layer() |> patternTransform(instances = 10, transform = transform)
|
|||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread")]
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
async fn test_math_execute_with_pi() {
|
async fn test_math_execute_with_pi() {
|
||||||
let ast = r#"const myVar = pi() * 2"#;
|
let ast = r#"const myVar = PI * 2"#;
|
||||||
let (_, _, exec_state) = parse_execute(ast).await.unwrap();
|
let (_, _, exec_state) = parse_execute(ast).await.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
std::f64::consts::TAU,
|
std::f64::consts::TAU,
|
||||||
|
|||||||
@ -68,7 +68,7 @@ impl ExecState {
|
|||||||
pub fn new(exec_settings: &ExecutorSettings) -> Self {
|
pub fn new(exec_settings: &ExecutorSettings) -> Self {
|
||||||
ExecState {
|
ExecState {
|
||||||
global: GlobalState::new(exec_settings),
|
global: GlobalState::new(exec_settings),
|
||||||
mod_local: ModuleState::new(exec_settings),
|
mod_local: ModuleState::new(exec_settings, None),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ impl ExecState {
|
|||||||
|
|
||||||
*self = ExecState {
|
*self = ExecState {
|
||||||
global,
|
global,
|
||||||
mod_local: ModuleState::new(exec_settings),
|
mod_local: ModuleState::new(exec_settings, None),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ impl GlobalState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ModuleState {
|
impl ModuleState {
|
||||||
pub(super) fn new(exec_settings: &ExecutorSettings) -> Self {
|
pub(super) fn new(exec_settings: &ExecutorSettings, std_path: Option<String>) -> Self {
|
||||||
ModuleState {
|
ModuleState {
|
||||||
pipe_value: Default::default(),
|
pipe_value: Default::default(),
|
||||||
module_exports: Default::default(),
|
module_exports: Default::default(),
|
||||||
@ -220,6 +220,7 @@ impl ModuleState {
|
|||||||
settings: MetaSettings {
|
settings: MetaSettings {
|
||||||
default_length_units: exec_settings.units.into(),
|
default_length_units: exec_settings.units.into(),
|
||||||
default_angle_units: Default::default(),
|
default_angle_units: Default::default(),
|
||||||
|
std_path,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -231,6 +232,7 @@ impl ModuleState {
|
|||||||
pub struct MetaSettings {
|
pub struct MetaSettings {
|
||||||
pub default_length_units: kcl_value::UnitLen,
|
pub default_length_units: kcl_value::UnitLen,
|
||||||
pub default_angle_units: kcl_value::UnitAngle,
|
pub default_angle_units: kcl_value::UnitAngle,
|
||||||
|
pub std_path: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetaSettings {
|
impl MetaSettings {
|
||||||
|
|||||||
@ -42,6 +42,7 @@ use tower_lsp::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
docs::kcl_doc::DocData,
|
||||||
errors::Suggestion,
|
errors::Suggestion,
|
||||||
lsp::{backend::Backend as _, util::IntoDiagnostic},
|
lsp::{backend::Backend as _, util::IntoDiagnostic},
|
||||||
parsing::{
|
parsing::{
|
||||||
@ -164,8 +165,9 @@ impl Backend {
|
|||||||
can_send_telemetry: bool,
|
can_send_telemetry: bool,
|
||||||
) -> Result<Self, String> {
|
) -> Result<Self, String> {
|
||||||
let stdlib = crate::std::StdLib::new();
|
let stdlib = crate::std::StdLib::new();
|
||||||
let stdlib_completions = get_completions_from_stdlib(&stdlib).map_err(|e| e.to_string())?;
|
let kcl_std = crate::docs::kcl_doc::walk_prelude();
|
||||||
let stdlib_signatures = get_signatures_from_stdlib(&stdlib);
|
let stdlib_completions = get_completions_from_stdlib(&stdlib, &kcl_std).map_err(|e| e.to_string())?;
|
||||||
|
let stdlib_signatures = get_signatures_from_stdlib(&stdlib, &kcl_std);
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
client,
|
client,
|
||||||
@ -1402,7 +1404,10 @@ impl LanguageServer for Backend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get completions from our stdlib.
|
/// Get completions from our stdlib.
|
||||||
pub fn get_completions_from_stdlib(stdlib: &crate::std::StdLib) -> Result<HashMap<String, CompletionItem>> {
|
pub fn get_completions_from_stdlib(
|
||||||
|
stdlib: &crate::std::StdLib,
|
||||||
|
kcl_std: &[DocData],
|
||||||
|
) -> Result<HashMap<String, CompletionItem>> {
|
||||||
let mut completions = HashMap::new();
|
let mut completions = HashMap::new();
|
||||||
let combined = stdlib.combined();
|
let combined = stdlib.combined();
|
||||||
|
|
||||||
@ -1410,7 +1415,11 @@ pub fn get_completions_from_stdlib(stdlib: &crate::std::StdLib) -> Result<HashMa
|
|||||||
completions.insert(internal_fn.name(), internal_fn.to_completion_item()?);
|
completions.insert(internal_fn.name(), internal_fn.to_completion_item()?);
|
||||||
}
|
}
|
||||||
|
|
||||||
let variable_kinds = VariableKind::to_completion_items()?;
|
for d in kcl_std {
|
||||||
|
completions.insert(d.name().to_owned(), d.to_completion_item());
|
||||||
|
}
|
||||||
|
|
||||||
|
let variable_kinds = VariableKind::to_completion_items();
|
||||||
for variable_kind in variable_kinds {
|
for variable_kind in variable_kinds {
|
||||||
completions.insert(variable_kind.label.clone(), variable_kind);
|
completions.insert(variable_kind.label.clone(), variable_kind);
|
||||||
}
|
}
|
||||||
@ -1419,7 +1428,7 @@ pub fn get_completions_from_stdlib(stdlib: &crate::std::StdLib) -> Result<HashMa
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get signatures from our stdlib.
|
/// Get signatures from our stdlib.
|
||||||
pub fn get_signatures_from_stdlib(stdlib: &crate::std::StdLib) -> HashMap<String, SignatureHelp> {
|
pub fn get_signatures_from_stdlib(stdlib: &crate::std::StdLib, kcl_std: &[DocData]) -> HashMap<String, SignatureHelp> {
|
||||||
let mut signatures = HashMap::new();
|
let mut signatures = HashMap::new();
|
||||||
let combined = stdlib.combined();
|
let combined = stdlib.combined();
|
||||||
|
|
||||||
@ -1427,6 +1436,12 @@ pub fn get_signatures_from_stdlib(stdlib: &crate::std::StdLib) -> HashMap<String
|
|||||||
signatures.insert(internal_fn.name(), internal_fn.to_signature_help());
|
signatures.insert(internal_fn.name(), internal_fn.to_signature_help());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for d in kcl_std {
|
||||||
|
if let Some(sig) = d.to_signature_help() {
|
||||||
|
signatures.insert(d.name().to_owned(), sig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
signatures
|
signatures
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,9 @@ use tower_lsp::LanguageServer;
|
|||||||
// Create a fake kcl lsp server for testing.
|
// Create a fake kcl lsp server for testing.
|
||||||
pub async fn kcl_lsp_server(execute: bool) -> Result<crate::lsp::kcl::Backend> {
|
pub async fn kcl_lsp_server(execute: bool) -> Result<crate::lsp::kcl::Backend> {
|
||||||
let stdlib = crate::std::StdLib::new();
|
let stdlib = crate::std::StdLib::new();
|
||||||
let stdlib_completions = crate::lsp::kcl::get_completions_from_stdlib(&stdlib)?;
|
let kcl_std = crate::docs::kcl_doc::walk_prelude();
|
||||||
let stdlib_signatures = crate::lsp::kcl::get_signatures_from_stdlib(&stdlib);
|
let stdlib_completions = crate::lsp::kcl::get_completions_from_stdlib(&stdlib, &kcl_std)?;
|
||||||
|
let stdlib_signatures = crate::lsp::kcl::get_signatures_from_stdlib(&stdlib, &kcl_std);
|
||||||
|
|
||||||
let zoo_client = crate::engine::new_zoo_client(None, None)?;
|
let zoo_client = crate::engine::new_zoo_client(None, None)?;
|
||||||
|
|
||||||
|
|||||||
@ -807,11 +807,8 @@ async fn test_kcl_lsp_completions_const_raw() {
|
|||||||
// Check the completions.
|
// Check the completions.
|
||||||
if let tower_lsp::lsp_types::CompletionResponse::Array(completions) = completions {
|
if let tower_lsp::lsp_types::CompletionResponse::Array(completions) = completions {
|
||||||
assert!(completions.len() > 10);
|
assert!(completions.len() > 10);
|
||||||
// Find the one with label "const".
|
// Find the one with label "fn".
|
||||||
let const_completion = completions
|
let const_completion = completions.iter().find(|completion| completion.label == "fn").unwrap();
|
||||||
.iter()
|
|
||||||
.find(|completion| completion.label == "const")
|
|
||||||
.unwrap();
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
const_completion.kind,
|
const_completion.kind,
|
||||||
Some(tower_lsp::lsp_types::CompletionItemKind::KEYWORD)
|
Some(tower_lsp::lsp_types::CompletionItemKind::KEYWORD)
|
||||||
|
|||||||
@ -43,7 +43,13 @@ pub(crate) struct ModuleLoader {
|
|||||||
impl ModuleLoader {
|
impl ModuleLoader {
|
||||||
pub(crate) fn cycle_check(&self, path: &ModulePath, source_range: SourceRange) -> Result<(), KclError> {
|
pub(crate) fn cycle_check(&self, path: &ModulePath, source_range: SourceRange) -> Result<(), KclError> {
|
||||||
if self.import_stack.contains(path.expect_path()) {
|
if self.import_stack.contains(path.expect_path()) {
|
||||||
return Err(KclError::ImportCycle(KclErrorDetails {
|
return Err(self.import_cycle_error(path, source_range));
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn import_cycle_error(&self, path: &ModulePath, source_range: SourceRange) -> KclError {
|
||||||
|
KclError::ImportCycle(KclErrorDetails {
|
||||||
message: format!(
|
message: format!(
|
||||||
"circular import of modules is not allowed: {} -> {}",
|
"circular import of modules is not allowed: {} -> {}",
|
||||||
self.import_stack
|
self.import_stack
|
||||||
@ -54,9 +60,7 @@ impl ModuleLoader {
|
|||||||
path,
|
path,
|
||||||
),
|
),
|
||||||
source_ranges: vec![source_range],
|
source_ranges: vec![source_range],
|
||||||
}));
|
})
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn enter_module(&mut self, path: &ModulePath) {
|
pub(crate) fn enter_module(&mut self, path: &ModulePath) {
|
||||||
@ -73,8 +77,12 @@ impl ModuleLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn read_std(_mod_name: &str) -> Option<&'static str> {
|
pub(crate) fn read_std(mod_name: &str) -> Option<&'static str> {
|
||||||
None
|
match mod_name {
|
||||||
|
"prelude" => Some(include_str!("../std/prelude.kcl")),
|
||||||
|
"math" => Some(include_str!("../std/math.kcl")),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Info about a module.
|
/// Info about a module.
|
||||||
@ -125,6 +133,13 @@ impl ModulePath {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn std_path(&self) -> Option<String> {
|
||||||
|
match self {
|
||||||
|
ModulePath::Local(_) => None,
|
||||||
|
ModulePath::Std(p) => Some(p.clone()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) async fn source(&self, fs: &FileManager, source_range: SourceRange) -> Result<String, KclError> {
|
pub(crate) async fn source(&self, fs: &FileManager, source_range: SourceRange) -> Result<String, KclError> {
|
||||||
match self {
|
match self {
|
||||||
ModulePath::Local(p) => fs.read_to_string(p, source_range).await,
|
ModulePath::Local(p) => fs.read_to_string(p, source_range).await,
|
||||||
|
|||||||
@ -26,8 +26,7 @@ use crate::{
|
|||||||
docs::StdLibFn,
|
docs::StdLibFn,
|
||||||
errors::KclError,
|
errors::KclError,
|
||||||
execution::{annotations, KclValue, Metadata, TagIdentifier},
|
execution::{annotations, KclValue, Metadata, TagIdentifier},
|
||||||
parsing::{ast::digest::Digest, PIPE_OPERATOR},
|
parsing::{ast::digest::Digest, token::NumericSuffix, PIPE_OPERATOR},
|
||||||
pretty::NumericSuffix,
|
|
||||||
source_range::SourceRange,
|
source_range::SourceRange,
|
||||||
ModuleId,
|
ModuleId,
|
||||||
};
|
};
|
||||||
@ -887,6 +886,34 @@ impl Expr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Describe this expression's type for a human, for typechecking.
|
||||||
|
/// This is a best-effort function, it's OK to give a shitty string here (but we should work on improving it)
|
||||||
|
pub fn human_friendly_type(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
Expr::Literal(node) => match node.inner.value {
|
||||||
|
LiteralValue::Number { .. } => "number",
|
||||||
|
LiteralValue::String(_) => "string (text)",
|
||||||
|
LiteralValue::Bool(_) => "boolean (true/false value)",
|
||||||
|
},
|
||||||
|
Expr::Identifier(_) => "named constant",
|
||||||
|
Expr::TagDeclarator(_) => "tag declarator",
|
||||||
|
Expr::BinaryExpression(_) => "expression",
|
||||||
|
Expr::FunctionExpression(_) => "function definition",
|
||||||
|
Expr::CallExpression(_) => "function call",
|
||||||
|
Expr::CallExpressionKw(_) => "function call",
|
||||||
|
Expr::PipeExpression(_) => "pipeline of function calls",
|
||||||
|
Expr::PipeSubstitution(_) => "left-hand side of a |> pipeline",
|
||||||
|
Expr::ArrayExpression(_) => "array",
|
||||||
|
Expr::ArrayRangeExpression(_) => "array",
|
||||||
|
Expr::ObjectExpression(_) => "object",
|
||||||
|
Expr::MemberExpression(_) => "property of an object/array",
|
||||||
|
Expr::UnaryExpression(_) => "expression",
|
||||||
|
Expr::IfExpression(_) => "if expression",
|
||||||
|
Expr::LabelledExpression(_) => "labelled expression",
|
||||||
|
Expr::None(_) => "none",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn literal_bool(&self) -> Option<bool> {
|
pub fn literal_bool(&self) -> Option<bool> {
|
||||||
match self {
|
match self {
|
||||||
Expr::Literal(lit) => match lit.value {
|
Expr::Literal(lit) => match lit.value {
|
||||||
@ -923,34 +950,6 @@ impl Expr {
|
|||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Describe this expression's type for a human, for typechecking.
|
|
||||||
/// This is a best-effort function, it's OK to give a shitty string here (but we should work on improving it)
|
|
||||||
pub fn human_friendly_type(&self) -> &'static str {
|
|
||||||
match self {
|
|
||||||
Expr::Literal(node) => match node.inner.value {
|
|
||||||
LiteralValue::Number { .. } => "number",
|
|
||||||
LiteralValue::String(_) => "string (text)",
|
|
||||||
LiteralValue::Bool(_) => "boolean (true/false value)",
|
|
||||||
},
|
|
||||||
Expr::Identifier(_) => "named constant",
|
|
||||||
Expr::TagDeclarator(_) => "tag declarator",
|
|
||||||
Expr::BinaryExpression(_) => "expression",
|
|
||||||
Expr::FunctionExpression(_) => "function definition",
|
|
||||||
Expr::CallExpression(_) => "function call",
|
|
||||||
Expr::CallExpressionKw(_) => "function call",
|
|
||||||
Expr::PipeExpression(_) => "pipeline of function calls",
|
|
||||||
Expr::PipeSubstitution(_) => "left-hand side of a |> pipeline",
|
|
||||||
Expr::ArrayExpression(_) => "array",
|
|
||||||
Expr::ArrayRangeExpression(_) => "array",
|
|
||||||
Expr::ObjectExpression(_) => "object",
|
|
||||||
Expr::MemberExpression(_) => "property of an object/array",
|
|
||||||
Expr::UnaryExpression(_) => "expression",
|
|
||||||
Expr::IfExpression(_) => "if expression",
|
|
||||||
Expr::LabelledExpression(_) => "labelled expression",
|
|
||||||
Expr::None(_) => "none",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Expr> for SourceRange {
|
impl From<Expr> for SourceRange {
|
||||||
@ -1519,7 +1518,7 @@ impl ImportStatement {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
path.rsplit('/').next().map(str::to_owned)
|
path.rsplit(&['/', '\\']).next().map(str::to_owned)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1996,31 +1995,36 @@ pub enum VariableKind {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl VariableKind {
|
impl VariableKind {
|
||||||
pub fn to_completion_items() -> Result<Vec<CompletionItem>> {
|
pub fn to_completion_items() -> Vec<CompletionItem> {
|
||||||
let mut settings = schemars::gen::SchemaSettings::openapi3();
|
fn completion_item(keyword: &str, description: &str) -> CompletionItem {
|
||||||
settings.inline_subschemas = true;
|
CompletionItem {
|
||||||
let mut generator = schemars::gen::SchemaGenerator::new(settings);
|
label: keyword.to_owned(),
|
||||||
let schema = VariableKind::json_schema(&mut generator);
|
label_details: None,
|
||||||
let schemars::schema::Schema::Object(o) = &schema else {
|
kind: Some(CompletionItemKind::KEYWORD),
|
||||||
anyhow::bail!("expected object schema: {:#?}", schema);
|
detail: Some(description.to_owned()),
|
||||||
};
|
documentation: Some(tower_lsp::lsp_types::Documentation::MarkupContent(
|
||||||
let Some(subschemas) = &o.subschemas else {
|
tower_lsp::lsp_types::MarkupContent {
|
||||||
anyhow::bail!("expected subschemas: {:#?}", schema);
|
kind: tower_lsp::lsp_types::MarkupKind::Markdown,
|
||||||
};
|
value: description.to_owned(),
|
||||||
let Some(one_ofs) = &subschemas.one_of else {
|
},
|
||||||
anyhow::bail!("expected one_of: {:#?}", schema);
|
)),
|
||||||
};
|
deprecated: Some(false),
|
||||||
|
preselect: None,
|
||||||
// Iterate over all the VariableKinds and create a completion for each.
|
sort_text: None,
|
||||||
let mut completions = vec![];
|
filter_text: None,
|
||||||
for one_of in one_ofs {
|
insert_text: None,
|
||||||
completions.push(crate::docs::completion_item_from_enum_schema(
|
insert_text_format: None,
|
||||||
one_of,
|
insert_text_mode: None,
|
||||||
CompletionItemKind::KEYWORD,
|
text_edit: None,
|
||||||
)?);
|
additional_text_edits: None,
|
||||||
|
command: None,
|
||||||
|
commit_characters: None,
|
||||||
|
data: None,
|
||||||
|
tags: None,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(completions)
|
vec![completion_item("fn", "Declare a function.")]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3461,7 +3465,7 @@ mod tests {
|
|||||||
// We have this as a test so we can ensure it never panics with an unwrap in the server.
|
// We have this as a test so we can ensure it never panics with an unwrap in the server.
|
||||||
#[test]
|
#[test]
|
||||||
fn test_variable_kind_to_completion() {
|
fn test_variable_kind_to_completion() {
|
||||||
let completions = VariableKind::to_completion_items().unwrap();
|
let completions = VariableKind::to_completion_items();
|
||||||
assert!(!completions.is_empty());
|
assert!(!completions.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -342,7 +342,9 @@ fn non_code_node_no_leading_whitespace(i: &mut TokenSlice) -> PResult<Node<NonCo
|
|||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
let value = match token.token_type {
|
let value = match token.token_type {
|
||||||
TokenType::Whitespace if token.value.contains("\n\n") => NonCodeValue::NewLine,
|
TokenType::Whitespace if token.value.contains("\n\n") || token.value.contains("\n\r\n") => {
|
||||||
|
NonCodeValue::NewLine
|
||||||
|
}
|
||||||
TokenType::LineComment => NonCodeValue::BlockComment {
|
TokenType::LineComment => NonCodeValue::BlockComment {
|
||||||
value: token.value.trim_start_matches("//").trim().to_owned(),
|
value: token.value.trim_start_matches("//").trim().to_owned(),
|
||||||
style: CommentStyle::Line,
|
style: CommentStyle::Line,
|
||||||
@ -1402,7 +1404,7 @@ fn function_body(i: &mut TokenSlice) -> PResult<Node<Program>> {
|
|||||||
// if it has an empty line, it should be considered a noncode token, because the user
|
// if it has an empty line, it should be considered a noncode token, because the user
|
||||||
// deliberately put an empty line there. We should track this and preserve it.
|
// deliberately put an empty line there. We should track this and preserve it.
|
||||||
if let Ok(ref ws_token) = found_ws {
|
if let Ok(ref ws_token) = found_ws {
|
||||||
if ws_token.value.contains("\n\n") {
|
if ws_token.value.contains("\n\n") || ws_token.value.contains("\n\r\n") {
|
||||||
things_within_body.push(WithinFunction::NonCode(Node::new(
|
things_within_body.push(WithinFunction::NonCode(Node::new(
|
||||||
NonCodeNode {
|
NonCodeNode {
|
||||||
value: NonCodeValue::NewLine,
|
value: NonCodeValue::NewLine,
|
||||||
@ -1735,6 +1737,7 @@ fn validate_path_string(path_string: String, var_name: bool, path_range: SourceR
|
|||||||
|
|
||||||
ImportPath::Std { path: segments }
|
ImportPath::Std { path: segments }
|
||||||
} else if path_string.contains('.') {
|
} else if path_string.contains('.') {
|
||||||
|
// TODO should allow other extensions if there is a format attribute.
|
||||||
let extn = &path_string[path_string.rfind('.').unwrap() + 1..];
|
let extn = &path_string[path_string.rfind('.').unwrap() + 1..];
|
||||||
if !FOREIGN_IMPORT_EXTENSIONS.contains(&extn) {
|
if !FOREIGN_IMPORT_EXTENSIONS.contains(&extn) {
|
||||||
ParseContext::warn(CompilationError::err(
|
ParseContext::warn(CompilationError::err(
|
||||||
|
|||||||
@ -99,7 +99,7 @@ pub(super) fn token(i: &mut Input<'_>) -> PResult<Token> {
|
|||||||
'#' => hash,
|
'#' => hash,
|
||||||
'$' => dollar,
|
'$' => dollar,
|
||||||
'!' => alt((operator, bang)),
|
'!' => alt((operator, bang)),
|
||||||
' ' | '\t' | '\n' => whitespace,
|
' ' | '\t' | '\n' | '\r' => whitespace,
|
||||||
_ => alt((operator, keyword_type_or_word))
|
_ => alt((operator, keyword_type_or_word))
|
||||||
}
|
}
|
||||||
.parse_next(i)
|
.parse_next(i)
|
||||||
|
|||||||
@ -17,7 +17,6 @@ pub async fn map(exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kcl
|
|||||||
let map_fn = FunctionParam {
|
let map_fn = FunctionParam {
|
||||||
inner: f.func,
|
inner: f.func,
|
||||||
fn_expr: f.expr,
|
fn_expr: f.expr,
|
||||||
meta: meta.clone(),
|
|
||||||
ctx: args.ctx.clone(),
|
ctx: args.ctx.clone(),
|
||||||
memory: f.memory,
|
memory: f.memory,
|
||||||
};
|
};
|
||||||
@ -78,7 +77,9 @@ async fn call_map_closure(
|
|||||||
source_range: SourceRange,
|
source_range: SourceRange,
|
||||||
exec_state: &mut ExecState,
|
exec_state: &mut ExecState,
|
||||||
) -> Result<KclValue, KclError> {
|
) -> Result<KclValue, KclError> {
|
||||||
let output = map_fn.call(exec_state, vec![Arg::synthetic(input)]).await?;
|
let output = map_fn
|
||||||
|
.call(exec_state, vec![Arg::synthetic(input)], source_range)
|
||||||
|
.await?;
|
||||||
let source_ranges = vec![source_range];
|
let source_ranges = vec![source_range];
|
||||||
let output = output.ok_or_else(|| {
|
let output = output.ok_or_else(|| {
|
||||||
KclError::Semantic(KclErrorDetails {
|
KclError::Semantic(KclErrorDetails {
|
||||||
@ -95,7 +96,6 @@ pub async fn reduce(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
|||||||
let reduce_fn = FunctionParam {
|
let reduce_fn = FunctionParam {
|
||||||
inner: f.func,
|
inner: f.func,
|
||||||
fn_expr: f.expr,
|
fn_expr: f.expr,
|
||||||
meta: vec![args.source_range.into()],
|
|
||||||
ctx: args.ctx.clone(),
|
ctx: args.ctx.clone(),
|
||||||
memory: f.memory,
|
memory: f.memory,
|
||||||
};
|
};
|
||||||
@ -141,7 +141,7 @@ pub async fn reduce(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
|||||||
/// // Declare a function that sketches a decagon.
|
/// // Declare a function that sketches a decagon.
|
||||||
/// fn decagon(radius) {
|
/// fn decagon(radius) {
|
||||||
/// // Each side of the decagon is turned this many degrees from the previous angle.
|
/// // Each side of the decagon is turned this many degrees from the previous angle.
|
||||||
/// stepAngle = (1/10) * tau()
|
/// stepAngle = (1/10) * TAU
|
||||||
///
|
///
|
||||||
/// // Start the decagon sketch at this point.
|
/// // Start the decagon sketch at this point.
|
||||||
/// startOfDecagonSketch = startSketchOn('XY')
|
/// startOfDecagonSketch = startSketchOn('XY')
|
||||||
@ -164,7 +164,7 @@ pub async fn reduce(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
|||||||
/// /*
|
/// /*
|
||||||
/// The `decagon` above is basically like this pseudo-code:
|
/// The `decagon` above is basically like this pseudo-code:
|
||||||
/// fn decagon(radius):
|
/// fn decagon(radius):
|
||||||
/// stepAngle = (1/10) * tau()
|
/// stepAngle = (1/10) * TAU
|
||||||
/// plane = startSketchOn('XY')
|
/// plane = startSketchOn('XY')
|
||||||
/// startOfDecagonSketch = startProfileAt([(cos(0)*radius), (sin(0) * radius)], plane)
|
/// startOfDecagonSketch = startProfileAt([(cos(0)*radius), (sin(0) * radius)], plane)
|
||||||
///
|
///
|
||||||
@ -208,7 +208,7 @@ async fn call_reduce_closure(
|
|||||||
) -> Result<KclValue, KclError> {
|
) -> Result<KclValue, KclError> {
|
||||||
// Call the reduce fn for this repetition.
|
// Call the reduce fn for this repetition.
|
||||||
let reduce_fn_args = vec![Arg::synthetic(elem), Arg::synthetic(start)];
|
let reduce_fn_args = vec![Arg::synthetic(elem), Arg::synthetic(start)];
|
||||||
let transform_fn_return = reduce_fn.call(exec_state, reduce_fn_args).await?;
|
let transform_fn_return = reduce_fn.call(exec_state, reduce_fn_args, source_range).await?;
|
||||||
|
|
||||||
// Unpack the returned transform object.
|
// Unpack the returned transform object.
|
||||||
let source_ranges = vec![source_range];
|
let source_ranges = vec![source_range];
|
||||||
|
|||||||
@ -48,91 +48,19 @@ fn inner_rem(num: f64, divisor: f64) -> f64 {
|
|||||||
/// Compute the cosine of a number (in radians).
|
/// Compute the cosine of a number (in radians).
|
||||||
pub async fn cos(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn cos(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let num = args.get_number()?;
|
let num = args.get_number()?;
|
||||||
let result = inner_cos(num)?;
|
Ok(args.make_user_val_from_f64_with_type(num.cos(), NumericType::count()))
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64_with_type(result, NumericType::count()))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Compute the cosine of a number (in radians).
|
|
||||||
///
|
|
||||||
/// ```no_run
|
|
||||||
/// exampleSketch = startSketchOn("XZ")
|
|
||||||
/// |> startProfileAt([0, 0], %)
|
|
||||||
/// |> angledLine({
|
|
||||||
/// angle = 30,
|
|
||||||
/// length = 3 / cos(toRadians(30)),
|
|
||||||
/// }, %)
|
|
||||||
/// |> yLineTo(0, %)
|
|
||||||
/// |> close()
|
|
||||||
///
|
|
||||||
/// example = extrude(exampleSketch, length = 5)
|
|
||||||
/// ```
|
|
||||||
#[stdlib {
|
|
||||||
name = "cos",
|
|
||||||
tags = ["math"],
|
|
||||||
}]
|
|
||||||
fn inner_cos(num: f64) -> Result<f64, KclError> {
|
|
||||||
Ok(num.cos())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the sine of a number (in radians).
|
/// Compute the sine of a number (in radians).
|
||||||
pub async fn sin(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn sin(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let num = args.get_number()?;
|
let num = args.get_number()?;
|
||||||
let result = inner_sin(num)?;
|
Ok(args.make_user_val_from_f64_with_type(num.sin(), NumericType::count()))
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64_with_type(result, NumericType::count()))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Compute the sine of a number (in radians).
|
|
||||||
///
|
|
||||||
/// ```no_run
|
|
||||||
/// exampleSketch = startSketchOn("XZ")
|
|
||||||
/// |> startProfileAt([0, 0], %)
|
|
||||||
/// |> angledLine({
|
|
||||||
/// angle = 50,
|
|
||||||
/// length = 15 / sin(toDegrees(135)),
|
|
||||||
/// }, %)
|
|
||||||
/// |> yLineTo(0, %)
|
|
||||||
/// |> close()
|
|
||||||
///
|
|
||||||
/// example = extrude(exampleSketch, length = 5)
|
|
||||||
/// ```
|
|
||||||
#[stdlib {
|
|
||||||
name = "sin",
|
|
||||||
tags = ["math"],
|
|
||||||
}]
|
|
||||||
fn inner_sin(num: f64) -> Result<f64, KclError> {
|
|
||||||
Ok(num.sin())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the tangent of a number (in radians).
|
/// Compute the tangent of a number (in radians).
|
||||||
pub async fn tan(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn tan(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let num = args.get_number()?;
|
let num = args.get_number()?;
|
||||||
let result = inner_tan(num)?;
|
Ok(args.make_user_val_from_f64_with_type(num.tan(), NumericType::count()))
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64_with_type(result, NumericType::count()))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Compute the tangent of a number (in radians).
|
|
||||||
///
|
|
||||||
/// ```no_run
|
|
||||||
/// exampleSketch = startSketchOn("XZ")
|
|
||||||
/// |> startProfileAt([0, 0], %)
|
|
||||||
/// |> angledLine({
|
|
||||||
/// angle = 50,
|
|
||||||
/// length = 50 * tan(1/2),
|
|
||||||
/// }, %)
|
|
||||||
/// |> yLineTo(0, %)
|
|
||||||
/// |> close()
|
|
||||||
///
|
|
||||||
/// example = extrude(exampleSketch, length = 5)
|
|
||||||
/// ```
|
|
||||||
#[stdlib {
|
|
||||||
name = "tan",
|
|
||||||
tags = ["math"],
|
|
||||||
}]
|
|
||||||
fn inner_tan(num: f64) -> Result<f64, KclError> {
|
|
||||||
Ok(num.tan())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the value of `pi`. Archimedes’ constant (π).
|
/// Return the value of `pi`. Archimedes’ constant (π).
|
||||||
@ -144,6 +72,8 @@ pub async fn pi(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kcl
|
|||||||
|
|
||||||
/// Return the value of `pi`. Archimedes’ constant (π).
|
/// Return the value of `pi`. Archimedes’ constant (π).
|
||||||
///
|
///
|
||||||
|
/// **DEPRECATED** use the constant PI
|
||||||
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// circumference = 70
|
/// circumference = 70
|
||||||
///
|
///
|
||||||
@ -155,6 +85,7 @@ pub async fn pi(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kcl
|
|||||||
#[stdlib {
|
#[stdlib {
|
||||||
name = "pi",
|
name = "pi",
|
||||||
tags = ["math"],
|
tags = ["math"],
|
||||||
|
deprecated = true,
|
||||||
}]
|
}]
|
||||||
fn inner_pi() -> Result<f64, KclError> {
|
fn inner_pi() -> Result<f64, KclError> {
|
||||||
Ok(std::f64::consts::PI)
|
Ok(std::f64::consts::PI)
|
||||||
@ -692,6 +623,8 @@ pub async fn e(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclE
|
|||||||
|
|
||||||
/// Return the value of Euler’s number `e`.
|
/// Return the value of Euler’s number `e`.
|
||||||
///
|
///
|
||||||
|
/// **DEPRECATED** use the constant E
|
||||||
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// exampleSketch = startSketchOn("XZ")
|
/// exampleSketch = startSketchOn("XZ")
|
||||||
/// |> startProfileAt([0, 0], %)
|
/// |> startProfileAt([0, 0], %)
|
||||||
@ -707,6 +640,7 @@ pub async fn e(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclE
|
|||||||
#[stdlib {
|
#[stdlib {
|
||||||
name = "e",
|
name = "e",
|
||||||
tags = ["math"],
|
tags = ["math"],
|
||||||
|
deprecated = true,
|
||||||
}]
|
}]
|
||||||
fn inner_e() -> Result<f64, KclError> {
|
fn inner_e() -> Result<f64, KclError> {
|
||||||
Ok(std::f64::consts::E)
|
Ok(std::f64::consts::E)
|
||||||
@ -721,6 +655,8 @@ pub async fn tau(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
|||||||
|
|
||||||
/// Return the value of `tau`. The full circle constant (τ). Equal to 2π.
|
/// Return the value of `tau`. The full circle constant (τ). Equal to 2π.
|
||||||
///
|
///
|
||||||
|
/// **DEPRECATED** use the constant TAU
|
||||||
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// exampleSketch = startSketchOn("XZ")
|
/// exampleSketch = startSketchOn("XZ")
|
||||||
/// |> startProfileAt([0, 0], %)
|
/// |> startProfileAt([0, 0], %)
|
||||||
@ -736,6 +672,7 @@ pub async fn tau(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
|||||||
#[stdlib {
|
#[stdlib {
|
||||||
name = "tau",
|
name = "tau",
|
||||||
tags = ["math"],
|
tags = ["math"],
|
||||||
|
deprecated = true,
|
||||||
}]
|
}]
|
||||||
fn inner_tau() -> Result<f64, KclError> {
|
fn inner_tau() -> Result<f64, KclError> {
|
||||||
Ok(std::f64::consts::TAU)
|
Ok(std::f64::consts::TAU)
|
||||||
|
|||||||
@ -122,9 +122,6 @@ lazy_static! {
|
|||||||
Box::new(crate::std::loft::Loft),
|
Box::new(crate::std::loft::Loft),
|
||||||
Box::new(crate::std::planes::OffsetPlane),
|
Box::new(crate::std::planes::OffsetPlane),
|
||||||
Box::new(crate::std::import::Import),
|
Box::new(crate::std::import::Import),
|
||||||
Box::new(crate::std::math::Cos),
|
|
||||||
Box::new(crate::std::math::Sin),
|
|
||||||
Box::new(crate::std::math::Tan),
|
|
||||||
Box::new(crate::std::math::Acos),
|
Box::new(crate::std::math::Acos),
|
||||||
Box::new(crate::std::math::Asin),
|
Box::new(crate::std::math::Asin),
|
||||||
Box::new(crate::std::math::Atan),
|
Box::new(crate::std::math::Atan),
|
||||||
@ -171,6 +168,15 @@ pub fn get_stdlib_fn(name: &str) -> Option<Box<dyn StdLibFn>> {
|
|||||||
CORE_FNS.iter().find(|f| f.name() == name).cloned()
|
CORE_FNS.iter().find(|f| f.name() == name).cloned()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn std_fn(path: &str, fn_name: &str) -> crate::std::StdFn {
|
||||||
|
match (path, fn_name) {
|
||||||
|
("math", "cos") => |e, a| Box::pin(crate::std::math::cos(e, a)),
|
||||||
|
("math", "sin") => |e, a| Box::pin(crate::std::math::sin(e, a)),
|
||||||
|
("math", "tan") => |e, a| Box::pin(crate::std::math::tan(e, a)),
|
||||||
|
_ => unreachable!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct StdLib {
|
pub struct StdLib {
|
||||||
pub fns: IndexMap<String, Box<dyn StdLibFn>>,
|
pub fns: IndexMap<String, Box<dyn StdLibFn>>,
|
||||||
}
|
}
|
||||||
@ -303,7 +309,7 @@ pub enum Primitive {
|
|||||||
|
|
||||||
/// A closure used as an argument to a stdlib function.
|
/// A closure used as an argument to a stdlib function.
|
||||||
pub struct FnAsArg<'a> {
|
pub struct FnAsArg<'a> {
|
||||||
pub func: Option<&'a crate::execution::MemoryFunction>,
|
pub func: Option<&'a crate::std::StdFn>,
|
||||||
pub expr: crate::parsing::ast::types::BoxNode<FunctionExpression>,
|
pub expr: crate::parsing::ast::types::BoxNode<FunctionExpression>,
|
||||||
pub memory: EnvironmentRef,
|
pub memory: Option<EnvironmentRef>,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,7 +58,6 @@ pub async fn pattern_transform(exec_state: &mut ExecState, args: Args) -> Result
|
|||||||
FunctionParam {
|
FunctionParam {
|
||||||
inner: transform.func,
|
inner: transform.func,
|
||||||
fn_expr: transform.expr,
|
fn_expr: transform.expr,
|
||||||
meta: vec![args.source_range.into()],
|
|
||||||
ctx: args.ctx.clone(),
|
ctx: args.ctx.clone(),
|
||||||
memory: transform.memory,
|
memory: transform.memory,
|
||||||
},
|
},
|
||||||
@ -83,7 +82,6 @@ pub async fn pattern_transform_2d(exec_state: &mut ExecState, args: Args) -> Res
|
|||||||
FunctionParam {
|
FunctionParam {
|
||||||
inner: transform.func,
|
inner: transform.func,
|
||||||
fn_expr: transform.expr,
|
fn_expr: transform.expr,
|
||||||
meta: vec![args.source_range.into()],
|
|
||||||
ctx: args.ctx.clone(),
|
ctx: args.ctx.clone(),
|
||||||
memory: transform.memory,
|
memory: transform.memory,
|
||||||
},
|
},
|
||||||
@ -452,7 +450,7 @@ async fn make_transform<T: GeometryTrait>(
|
|||||||
meta: vec![source_range.into()],
|
meta: vec![source_range.into()],
|
||||||
};
|
};
|
||||||
let transform_fn_args = vec![Arg::synthetic(repetition_num)];
|
let transform_fn_args = vec![Arg::synthetic(repetition_num)];
|
||||||
let transform_fn_return = transform.call(exec_state, transform_fn_args).await?;
|
let transform_fn_return = transform.call(exec_state, transform_fn_args, source_range).await?;
|
||||||
|
|
||||||
// Unpack the returned transform object.
|
// Unpack the returned transform object.
|
||||||
let source_ranges = vec![source_range];
|
let source_ranges = vec![source_range];
|
||||||
|
|||||||
96
src/wasm-lib/kcl/std/math.kcl
Normal file
96
src/wasm-lib/kcl/std/math.kcl
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
@no_prelude
|
||||||
|
|
||||||
|
/// The value of `pi`, Archimedes’ constant (π).
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// circumference = 70
|
||||||
|
///
|
||||||
|
/// exampleSketch = startSketchOn("XZ")
|
||||||
|
/// |> circle({ center = [0, 0], radius = circumference/ (2 * PI) }, %)
|
||||||
|
///
|
||||||
|
/// example = extrude(exampleSketch, length = 5)
|
||||||
|
/// ```
|
||||||
|
export PI = 3.14159265358979323846264338327950288_
|
||||||
|
|
||||||
|
/// The value of Euler’s number `e`.
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// exampleSketch = startSketchOn("XZ")
|
||||||
|
/// |> startProfileAt([0, 0], %)
|
||||||
|
/// |> angledLine({
|
||||||
|
/// angle = 30,
|
||||||
|
/// length = 2 * E ^ 2,
|
||||||
|
/// }, %)
|
||||||
|
/// |> yLineTo(0, %)
|
||||||
|
/// |> close()
|
||||||
|
///
|
||||||
|
/// example = extrude(exampleSketch, length = 10)
|
||||||
|
/// ```
|
||||||
|
export E = 2.71828182845904523536028747135266250_
|
||||||
|
|
||||||
|
/// The value of `tau`, the full circle constant (τ). Equal to 2π.
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// exampleSketch = startSketchOn("XZ")
|
||||||
|
/// |> startProfileAt([0, 0], %)
|
||||||
|
/// |> angledLine({
|
||||||
|
/// angle = 50,
|
||||||
|
/// length = 10 * TAU,
|
||||||
|
/// }, %)
|
||||||
|
/// |> yLineTo(0, %)
|
||||||
|
/// |> close()
|
||||||
|
///
|
||||||
|
/// example = extrude(exampleSketch, length = 5)
|
||||||
|
/// ```
|
||||||
|
export TAU = 6.28318530717958647692528676655900577_
|
||||||
|
|
||||||
|
/// Compute the cosine of a number (in radians).
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// exampleSketch = startSketchOn("XZ")
|
||||||
|
/// |> startProfileAt([0, 0], %)
|
||||||
|
/// |> angledLine({
|
||||||
|
/// angle = 30,
|
||||||
|
/// length = 3 / cos(toRadians(30)),
|
||||||
|
/// }, %)
|
||||||
|
/// |> yLineTo(0, %)
|
||||||
|
/// |> close()
|
||||||
|
///
|
||||||
|
/// example = extrude(exampleSketch, length = 5)
|
||||||
|
/// ```
|
||||||
|
@(impl = std_rust)
|
||||||
|
export fn cos(num: number(rad)): number(_) {}
|
||||||
|
|
||||||
|
/// Compute the sine of a number (in radians).
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// exampleSketch = startSketchOn("XZ")
|
||||||
|
/// |> startProfileAt([0, 0], %)
|
||||||
|
/// |> angledLine({
|
||||||
|
/// angle = 50,
|
||||||
|
/// length = 15 / sin(toDegrees(135)),
|
||||||
|
/// }, %)
|
||||||
|
/// |> yLineTo(0, %)
|
||||||
|
/// |> close()
|
||||||
|
///
|
||||||
|
/// example = extrude(exampleSketch, length = 5)
|
||||||
|
/// ```
|
||||||
|
@(impl = std_rust)
|
||||||
|
export fn sin(num: number(rad)): number(_) {}
|
||||||
|
|
||||||
|
/// Compute the tangent of a number (in radians).
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// exampleSketch = startSketchOn("XZ")
|
||||||
|
/// |> startProfileAt([0, 0], %)
|
||||||
|
/// |> angledLine({
|
||||||
|
/// angle = 50,
|
||||||
|
/// length = 50 * tan(1/2),
|
||||||
|
/// }, %)
|
||||||
|
/// |> yLineTo(0, %)
|
||||||
|
/// |> close()
|
||||||
|
///
|
||||||
|
/// example = extrude(exampleSketch, length = 5)
|
||||||
|
/// ```
|
||||||
|
@(impl = std_rust)
|
||||||
|
export fn tan(num: number(rad)): number(_) {}
|
||||||
7
src/wasm-lib/kcl/std/prelude.kcl
Normal file
7
src/wasm-lib/kcl/std/prelude.kcl
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
@no_prelude
|
||||||
|
export import * from "std::math"
|
||||||
|
|
||||||
|
export ZERO = 0
|
||||||
|
export QUARTER_TURN = 90deg
|
||||||
|
export HALF_TURN = 180deg
|
||||||
|
export THREE_QUARTER_TURN = 270deg
|
||||||
@ -3,37 +3,169 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing add_lots.kcl
|
description: Variables in memory after executing add_lots.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"f": {
|
"f": {
|
||||||
"type": "Function",
|
"type": "Function",
|
||||||
@ -104,6 +236,80 @@ description: Variables in memory after executing add_lots.kcl
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"x": {
|
"x": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 10100.0,
|
"value": 10100.0,
|
||||||
|
|||||||
@ -3,37 +3,169 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing angled_line.kcl
|
description: Variables in memory after executing angled_line.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"part001": {
|
"part001": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
@ -472,5 +604,79 @@ description: Variables in memory after executing angled_line.kcl
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,37 +3,132 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing array_elem_pop.kcl
|
description: Variables in memory after executing array_elem_pop.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"arr": {
|
"arr": {
|
||||||
"type": "Array",
|
"type": "Array",
|
||||||
@ -115,6 +210,43 @@ description: Variables in memory after executing array_elem_pop.kcl
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"new_arr1": {
|
"new_arr1": {
|
||||||
"type": "Array",
|
"type": "Array",
|
||||||
"value": [
|
"value": [
|
||||||
@ -221,5 +353,79 @@ description: Variables in memory after executing array_elem_pop.kcl
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,37 +3,132 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing array_elem_push.kcl
|
description: Variables in memory after executing array_elem_push.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"arr": {
|
"arr": {
|
||||||
"type": "Array",
|
"type": "Array",
|
||||||
@ -115,6 +210,43 @@ description: Variables in memory after executing array_elem_push.kcl
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"new_arr1": {
|
"new_arr1": {
|
||||||
"type": "Array",
|
"type": "Array",
|
||||||
"value": [
|
"value": [
|
||||||
@ -340,5 +472,79 @@ description: Variables in memory after executing array_elem_push.kcl
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,37 +3,169 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing array_range_expr.kcl
|
description: Variables in memory after executing array_range_expr.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"five": {
|
"five": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
@ -475,6 +607,80 @@ description: Variables in memory after executing array_range_expr.kcl
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"zero": {
|
"zero": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
|
|||||||
@ -3,37 +3,243 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing array_range_negative_expr.kcl
|
description: Variables in memory after executing array_range_negative_expr.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"xs": {
|
"xs": {
|
||||||
"type": "Array",
|
"type": "Array",
|
||||||
|
|||||||
@ -3,37 +3,169 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing artifact_graph_example_code1.kcl
|
description: Variables in memory after executing artifact_graph_example_code1.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"extrude001": {
|
"extrude001": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
@ -1205,6 +1337,43 @@ description: Variables in memory after executing artifact_graph_example_code1.kc
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"sketch001": {
|
"sketch001": {
|
||||||
"type": "Sketch",
|
"type": "Sketch",
|
||||||
"value": {
|
"value": {
|
||||||
@ -2108,5 +2277,42 @@ description: Variables in memory after executing artifact_graph_example_code1.kc
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,37 +3,169 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing artifact_graph_example_code_no_3d.kcl
|
description: Variables in memory after executing artifact_graph_example_code_no_3d.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"rectangleSegmentA001": {
|
"rectangleSegmentA001": {
|
||||||
"type": "TagIdentifier",
|
"type": "TagIdentifier",
|
||||||
@ -179,6 +311,43 @@ description: Variables in memory after executing artifact_graph_example_code_no_
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"sketch003": {
|
"sketch003": {
|
||||||
"type": "Sketch",
|
"type": "Sketch",
|
||||||
"value": {
|
"value": {
|
||||||
@ -680,5 +849,42 @@ description: Variables in memory after executing artifact_graph_example_code_no_
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,37 +3,169 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing artifact_graph_example_code_offset_planes.kcl
|
description: Variables in memory after executing artifact_graph_example_code_offset_planes.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"offsetPlane001": {
|
"offsetPlane001": {
|
||||||
"type": "Plane",
|
"type": "Plane",
|
||||||
@ -131,6 +263,43 @@ description: Variables in memory after executing artifact_graph_example_code_off
|
|||||||
"__meta": []
|
"__meta": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"sketch002": {
|
"sketch002": {
|
||||||
"type": "Sketch",
|
"type": "Sketch",
|
||||||
"value": {
|
"value": {
|
||||||
@ -228,5 +397,42 @@ description: Variables in memory after executing artifact_graph_example_code_off
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,37 +3,169 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing artifact_graph_sketch_on_face_etc.kcl
|
description: Variables in memory after executing artifact_graph_sketch_on_face_etc.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"extrude001": {
|
"extrude001": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
@ -2825,6 +2957,43 @@ description: Variables in memory after executing artifact_graph_sketch_on_face_e
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"sketch001": {
|
"sketch001": {
|
||||||
"type": "Sketch",
|
"type": "Sketch",
|
||||||
"value": {
|
"value": {
|
||||||
@ -5258,5 +5427,42 @@ description: Variables in memory after executing artifact_graph_sketch_on_face_e
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -298,7 +298,7 @@ description: Artifact commands assembly_non_default_units.kcl
|
|||||||
"range": [
|
"range": [
|
||||||
0,
|
0,
|
||||||
33,
|
33,
|
||||||
1
|
3
|
||||||
],
|
],
|
||||||
"command": {
|
"command": {
|
||||||
"type": "set_scene_units",
|
"type": "set_scene_units",
|
||||||
@ -310,7 +310,7 @@ description: Artifact commands assembly_non_default_units.kcl
|
|||||||
"range": [
|
"range": [
|
||||||
172,
|
172,
|
||||||
191,
|
191,
|
||||||
1
|
3
|
||||||
],
|
],
|
||||||
"command": {
|
"command": {
|
||||||
"type": "make_plane",
|
"type": "make_plane",
|
||||||
@ -339,7 +339,7 @@ description: Artifact commands assembly_non_default_units.kcl
|
|||||||
"range": [
|
"range": [
|
||||||
197,
|
197,
|
||||||
239,
|
239,
|
||||||
1
|
3
|
||||||
],
|
],
|
||||||
"command": {
|
"command": {
|
||||||
"type": "enable_sketch_mode",
|
"type": "enable_sketch_mode",
|
||||||
@ -359,7 +359,7 @@ description: Artifact commands assembly_non_default_units.kcl
|
|||||||
"range": [
|
"range": [
|
||||||
197,
|
197,
|
||||||
239,
|
239,
|
||||||
1
|
3
|
||||||
],
|
],
|
||||||
"command": {
|
"command": {
|
||||||
"type": "start_path"
|
"type": "start_path"
|
||||||
@ -370,7 +370,7 @@ description: Artifact commands assembly_non_default_units.kcl
|
|||||||
"range": [
|
"range": [
|
||||||
197,
|
197,
|
||||||
239,
|
239,
|
||||||
1
|
3
|
||||||
],
|
],
|
||||||
"command": {
|
"command": {
|
||||||
"type": "move_path_pen",
|
"type": "move_path_pen",
|
||||||
@ -387,7 +387,7 @@ description: Artifact commands assembly_non_default_units.kcl
|
|||||||
"range": [
|
"range": [
|
||||||
197,
|
197,
|
||||||
239,
|
239,
|
||||||
1
|
3
|
||||||
],
|
],
|
||||||
"command": {
|
"command": {
|
||||||
"type": "extend_path",
|
"type": "extend_path",
|
||||||
@ -416,7 +416,7 @@ description: Artifact commands assembly_non_default_units.kcl
|
|||||||
"range": [
|
"range": [
|
||||||
197,
|
197,
|
||||||
239,
|
239,
|
||||||
1
|
3
|
||||||
],
|
],
|
||||||
"command": {
|
"command": {
|
||||||
"type": "close_path",
|
"type": "close_path",
|
||||||
@ -428,7 +428,7 @@ description: Artifact commands assembly_non_default_units.kcl
|
|||||||
"range": [
|
"range": [
|
||||||
0,
|
0,
|
||||||
33,
|
33,
|
||||||
2
|
4
|
||||||
],
|
],
|
||||||
"command": {
|
"command": {
|
||||||
"type": "set_scene_units",
|
"type": "set_scene_units",
|
||||||
@ -440,7 +440,7 @@ description: Artifact commands assembly_non_default_units.kcl
|
|||||||
"range": [
|
"range": [
|
||||||
89,
|
89,
|
||||||
108,
|
108,
|
||||||
2
|
4
|
||||||
],
|
],
|
||||||
"command": {
|
"command": {
|
||||||
"type": "make_plane",
|
"type": "make_plane",
|
||||||
@ -469,7 +469,7 @@ description: Artifact commands assembly_non_default_units.kcl
|
|||||||
"range": [
|
"range": [
|
||||||
114,
|
114,
|
||||||
156,
|
156,
|
||||||
2
|
4
|
||||||
],
|
],
|
||||||
"command": {
|
"command": {
|
||||||
"type": "enable_sketch_mode",
|
"type": "enable_sketch_mode",
|
||||||
@ -489,7 +489,7 @@ description: Artifact commands assembly_non_default_units.kcl
|
|||||||
"range": [
|
"range": [
|
||||||
114,
|
114,
|
||||||
156,
|
156,
|
||||||
2
|
4
|
||||||
],
|
],
|
||||||
"command": {
|
"command": {
|
||||||
"type": "start_path"
|
"type": "start_path"
|
||||||
@ -500,7 +500,7 @@ description: Artifact commands assembly_non_default_units.kcl
|
|||||||
"range": [
|
"range": [
|
||||||
114,
|
114,
|
||||||
156,
|
156,
|
||||||
2
|
4
|
||||||
],
|
],
|
||||||
"command": {
|
"command": {
|
||||||
"type": "move_path_pen",
|
"type": "move_path_pen",
|
||||||
@ -517,7 +517,7 @@ description: Artifact commands assembly_non_default_units.kcl
|
|||||||
"range": [
|
"range": [
|
||||||
114,
|
114,
|
||||||
156,
|
156,
|
||||||
2
|
4
|
||||||
],
|
],
|
||||||
"command": {
|
"command": {
|
||||||
"type": "extend_path",
|
"type": "extend_path",
|
||||||
@ -546,7 +546,7 @@ description: Artifact commands assembly_non_default_units.kcl
|
|||||||
"range": [
|
"range": [
|
||||||
114,
|
114,
|
||||||
156,
|
156,
|
||||||
2
|
4
|
||||||
],
|
],
|
||||||
"command": {
|
"command": {
|
||||||
"type": "close_path",
|
"type": "close_path",
|
||||||
|
|||||||
@ -1,17 +1,17 @@
|
|||||||
```mermaid
|
```mermaid
|
||||||
flowchart LR
|
flowchart LR
|
||||||
subgraph path2 [Path]
|
subgraph path2 [Path]
|
||||||
2["Path<br>[197, 239, 1]"]
|
2["Path<br>[197, 239, 3]"]
|
||||||
3["Segment<br>[197, 239, 1]"]
|
3["Segment<br>[197, 239, 3]"]
|
||||||
4[Solid2d]
|
4[Solid2d]
|
||||||
end
|
end
|
||||||
subgraph path6 [Path]
|
subgraph path6 [Path]
|
||||||
6["Path<br>[114, 156, 2]"]
|
6["Path<br>[114, 156, 4]"]
|
||||||
7["Segment<br>[114, 156, 2]"]
|
7["Segment<br>[114, 156, 4]"]
|
||||||
8[Solid2d]
|
8[Solid2d]
|
||||||
end
|
end
|
||||||
1["Plane<br>[172, 191, 1]"]
|
1["Plane<br>[172, 191, 3]"]
|
||||||
5["Plane<br>[89, 108, 2]"]
|
5["Plane<br>[89, 108, 4]"]
|
||||||
1 --- 2
|
1 --- 2
|
||||||
2 --- 3
|
2 --- 3
|
||||||
2 --- 4
|
2 --- 4
|
||||||
|
|||||||
@ -3,41 +3,173 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing assembly_non_default_units.kcl
|
description: Variables in memory after executing assembly_non_default_units.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"other1": {
|
"other1": {
|
||||||
"type": "Module",
|
"type": "Module",
|
||||||
"value": 1,
|
"value": 3,
|
||||||
"__meta": [
|
"__meta": [
|
||||||
{
|
{
|
||||||
"sourceRange": [
|
"sourceRange": [
|
||||||
@ -50,7 +182,7 @@ description: Variables in memory after executing assembly_non_default_units.kcl
|
|||||||
},
|
},
|
||||||
"other2": {
|
"other2": {
|
||||||
"type": "Module",
|
"type": "Module",
|
||||||
"value": 2,
|
"value": 4,
|
||||||
"__meta": [
|
"__meta": [
|
||||||
{
|
{
|
||||||
"sourceRange": [
|
"sourceRange": [
|
||||||
@ -60,5 +192,79 @@ description: Variables in memory after executing assembly_non_default_units.kcl
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,37 +3,169 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing basic_fillet_cube_close_opposite.kcl
|
description: Variables in memory after executing basic_fillet_cube_close_opposite.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"part001": {
|
"part001": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
@ -502,6 +634,80 @@ description: Variables in memory after executing basic_fillet_cube_close_opposit
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"thing": {
|
"thing": {
|
||||||
"type": "TagIdentifier",
|
"type": "TagIdentifier",
|
||||||
"type": "TagIdentifier",
|
"type": "TagIdentifier",
|
||||||
|
|||||||
@ -3,37 +3,169 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing basic_fillet_cube_end.kcl
|
description: Variables in memory after executing basic_fillet_cube_end.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"part001": {
|
"part001": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
@ -430,6 +562,80 @@ description: Variables in memory after executing basic_fillet_cube_end.kcl
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"thing": {
|
"thing": {
|
||||||
"type": "TagIdentifier",
|
"type": "TagIdentifier",
|
||||||
"type": "TagIdentifier",
|
"type": "TagIdentifier",
|
||||||
|
|||||||
@ -3,37 +3,169 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing basic_fillet_cube_next_adjacent.kcl
|
description: Variables in memory after executing basic_fillet_cube_next_adjacent.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"part001": {
|
"part001": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
@ -567,6 +699,80 @@ description: Variables in memory after executing basic_fillet_cube_next_adjacent
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"thing": {
|
"thing": {
|
||||||
"type": "TagIdentifier",
|
"type": "TagIdentifier",
|
||||||
"type": "TagIdentifier",
|
"type": "TagIdentifier",
|
||||||
|
|||||||
@ -3,37 +3,169 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing basic_fillet_cube_previous_adjacent.kcl
|
description: Variables in memory after executing basic_fillet_cube_previous_adjacent.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"part001": {
|
"part001": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
@ -567,6 +699,80 @@ description: Variables in memory after executing basic_fillet_cube_previous_adja
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"thing": {
|
"thing": {
|
||||||
"type": "TagIdentifier",
|
"type": "TagIdentifier",
|
||||||
"type": "TagIdentifier",
|
"type": "TagIdentifier",
|
||||||
|
|||||||
@ -3,37 +3,169 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing basic_fillet_cube_start.kcl
|
description: Variables in memory after executing basic_fillet_cube_start.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"part001": {
|
"part001": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
@ -430,6 +562,80 @@ description: Variables in memory after executing basic_fillet_cube_start.kcl
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"thing": {
|
"thing": {
|
||||||
"type": "TagIdentifier",
|
"type": "TagIdentifier",
|
||||||
"type": "TagIdentifier",
|
"type": "TagIdentifier",
|
||||||
|
|||||||
@ -3,37 +3,169 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing big_number_angle_to_match_length_x.kcl
|
description: Variables in memory after executing big_number_angle_to_match_length_x.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"part001": {
|
"part001": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
@ -370,5 +502,79 @@ description: Variables in memory after executing big_number_angle_to_match_lengt
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,37 +3,169 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing big_number_angle_to_match_length_y.kcl
|
description: Variables in memory after executing big_number_angle_to_match_length_y.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"part001": {
|
"part001": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
@ -370,5 +502,79 @@ description: Variables in memory after executing big_number_angle_to_match_lengt
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,37 +3,132 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing boolean_logical_and.kcl
|
description: Variables in memory after executing boolean_logical_and.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"a": {
|
"a": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
@ -161,6 +256,43 @@ description: Variables in memory after executing boolean_logical_and.kcl
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"d": {
|
"d": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 2.0,
|
"value": 2.0,
|
||||||
@ -202,5 +334,79 @@ description: Variables in memory after executing boolean_logical_and.kcl
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,37 +3,169 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing boolean_logical_multiple.kcl
|
description: Variables in memory after executing boolean_logical_multiple.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"i": {
|
"i": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
@ -146,5 +278,79 @@ description: Variables in memory after executing boolean_logical_multiple.kcl
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,37 +3,132 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing boolean_logical_or.kcl
|
description: Variables in memory after executing boolean_logical_or.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"a": {
|
"a": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
@ -161,6 +256,43 @@ description: Variables in memory after executing boolean_logical_or.kcl
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"d": {
|
"d": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 2.0,
|
"value": 2.0,
|
||||||
@ -202,5 +334,79 @@ description: Variables in memory after executing boolean_logical_or.kcl
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,37 +3,206 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing circle_three_point.kcl
|
description: Variables in memory after executing circle_three_point.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"sketch001": {
|
"sketch001": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
@ -177,5 +346,42 @@ description: Variables in memory after executing circle_three_point.kcl
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,37 +3,169 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing circular_pattern3d_a_pattern.kcl
|
description: Variables in memory after executing circular_pattern3d_a_pattern.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"exampleSketch": {
|
"exampleSketch": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
@ -67897,5 +68029,79 @@ description: Variables in memory after executing circular_pattern3d_a_pattern.kc
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,36 +3,242 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing comparisons.kcl
|
description: Variables in memory after executing comparisons.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -391,9 +391,180 @@ description: Result of parsing computed_var.kcl
|
|||||||
"start": 168,
|
"start": 168,
|
||||||
"type": "ExpressionStatement",
|
"type": "ExpressionStatement",
|
||||||
"type": "ExpressionStatement"
|
"type": "ExpressionStatement"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"end": 242,
|
||||||
|
"expression": {
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"end": 222,
|
||||||
|
"name": "PI",
|
||||||
|
"start": 220,
|
||||||
|
"type": "Identifier",
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"end": 225,
|
||||||
|
"raw": "3",
|
||||||
|
"start": 224,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 3.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"end": 230,
|
||||||
|
"raw": "0.2",
|
||||||
|
"start": 227,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.2,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"end": 241,
|
||||||
|
"raw": "\"oops pi\"",
|
||||||
|
"start": 232,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": "oops pi"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"end": 207,
|
"callee": {
|
||||||
|
"end": 219,
|
||||||
|
"name": "assertEqual",
|
||||||
|
"start": 208,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"end": 242,
|
||||||
|
"start": 208,
|
||||||
|
"type": "CallExpression",
|
||||||
|
"type": "CallExpression"
|
||||||
|
},
|
||||||
|
"start": 208,
|
||||||
|
"type": "ExpressionStatement",
|
||||||
|
"type": "ExpressionStatement"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"declaration": {
|
||||||
|
"end": 258,
|
||||||
|
"id": {
|
||||||
|
"end": 244,
|
||||||
|
"name": "x",
|
||||||
|
"start": 243,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"init": {
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"end": 257,
|
||||||
|
"left": {
|
||||||
|
"end": 252,
|
||||||
|
"raw": "2",
|
||||||
|
"start": 251,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 2.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"operator": "*",
|
||||||
|
"right": {
|
||||||
|
"end": 257,
|
||||||
|
"name": "PI",
|
||||||
|
"start": 255,
|
||||||
|
"type": "Identifier",
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"start": 251,
|
||||||
|
"type": "BinaryExpression",
|
||||||
|
"type": "BinaryExpression"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"end": 250,
|
||||||
|
"name": "cos",
|
||||||
|
"start": 247,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"end": 258,
|
||||||
|
"start": 247,
|
||||||
|
"type": "CallExpression",
|
||||||
|
"type": "CallExpression"
|
||||||
|
},
|
||||||
|
"start": 243,
|
||||||
|
"type": "VariableDeclarator"
|
||||||
|
},
|
||||||
|
"end": 258,
|
||||||
|
"kind": "const",
|
||||||
|
"start": 243,
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"type": "VariableDeclaration"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"end": 298,
|
||||||
|
"expression": {
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"end": 272,
|
||||||
|
"name": "x",
|
||||||
|
"start": 271,
|
||||||
|
"type": "Identifier",
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"end": 275,
|
||||||
|
"raw": "1",
|
||||||
|
"start": 274,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 1.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"end": 285,
|
||||||
|
"raw": "0.000001",
|
||||||
|
"start": 277,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.000001,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"end": 297,
|
||||||
|
"raw": "\"oops cos\"",
|
||||||
|
"start": 287,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": "oops cos"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"end": 270,
|
||||||
|
"name": "assertEqual",
|
||||||
|
"start": 259,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"end": 298,
|
||||||
|
"start": 259,
|
||||||
|
"type": "CallExpression",
|
||||||
|
"type": "CallExpression"
|
||||||
|
},
|
||||||
|
"start": 259,
|
||||||
|
"type": "ExpressionStatement",
|
||||||
|
"type": "ExpressionStatement"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"end": 299,
|
||||||
"nonCodeMeta": {
|
"nonCodeMeta": {
|
||||||
"nonCodeNodes": {
|
"nonCodeNodes": {
|
||||||
"2": [
|
"2": [
|
||||||
@ -425,6 +596,16 @@ description: Result of parsing computed_var.kcl
|
|||||||
"type": "newLine"
|
"type": "newLine"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"7": [
|
||||||
|
{
|
||||||
|
"end": 208,
|
||||||
|
"start": 206,
|
||||||
|
"type": "NonCodeNode",
|
||||||
|
"value": {
|
||||||
|
"type": "newLine"
|
||||||
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"startNodes": [
|
"startNodes": [
|
||||||
|
|||||||
@ -12,3 +12,7 @@ obj = { foo = 1, bar = 0 }
|
|||||||
one = obj[p]
|
one = obj[p]
|
||||||
|
|
||||||
assertEqual(one, 1, 0.0000001, "oops")
|
assertEqual(one, 1, 0.0000001, "oops")
|
||||||
|
|
||||||
|
assertEqual(PI, 3, 0.2, "oops pi")
|
||||||
|
x = cos(2 * PI)
|
||||||
|
assertEqual(x, 1, 0.000001, "oops cos")
|
||||||
|
|||||||
@ -1,6 +1,25 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/simulation_tests.rs
|
source: kcl/src/simulation_tests.rs
|
||||||
description: Operations executed computed_var.kcl
|
description: Operations executed computed_var.kcl
|
||||||
snapshot_kind: text
|
|
||||||
---
|
---
|
||||||
[]
|
[
|
||||||
|
{
|
||||||
|
"type": "UserDefinedFunctionCall",
|
||||||
|
"name": "cos",
|
||||||
|
"functionSourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
],
|
||||||
|
"unlabeledArg": null,
|
||||||
|
"labeledArgs": {},
|
||||||
|
"sourceRange": [
|
||||||
|
247,
|
||||||
|
258,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "UserDefinedFunctionReturn"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|||||||
@ -3,37 +3,132 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing computed_var.kcl
|
description: Variables in memory after executing computed_var.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"arr": {
|
"arr": {
|
||||||
"type": "Array",
|
"type": "Array",
|
||||||
@ -137,6 +232,43 @@ description: Variables in memory after executing computed_var.kcl
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"i": {
|
"i": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 3.0,
|
"value": 3.0,
|
||||||
@ -252,6 +384,80 @@ description: Variables in memory after executing computed_var.kcl
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"ten": {
|
"ten": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 10.0,
|
"value": 10.0,
|
||||||
@ -273,5 +479,22 @@ description: Variables in memory after executing computed_var.kcl
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"x": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 1.0,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
247,
|
||||||
|
258,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,37 +3,169 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing cube.kcl
|
description: Variables in memory after executing cube.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"cube": {
|
"cube": {
|
||||||
"type": "Function",
|
"type": "Function",
|
||||||
@ -974,5 +1106,79 @@ description: Variables in memory after executing cube.kcl
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,37 +3,169 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing double_map_fn.kcl
|
description: Variables in memory after executing double_map_fn.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"increment": {
|
"increment": {
|
||||||
"type": "Function",
|
"type": "Function",
|
||||||
@ -104,6 +236,80 @@ description: Variables in memory after executing double_map_fn.kcl
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"xs": {
|
"xs": {
|
||||||
"type": "Array",
|
"type": "Array",
|
||||||
"value": [
|
"value": [
|
||||||
|
|||||||
@ -3,37 +3,132 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing fillet-and-shell.kcl
|
description: Variables in memory after executing fillet-and-shell.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"border": {
|
"border": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
@ -736,6 +831,43 @@ description: Variables in memory after executing fillet-and-shell.kcl
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"edge1": {
|
"edge1": {
|
||||||
"type": "TagIdentifier",
|
"type": "TagIdentifier",
|
||||||
"type": "TagIdentifier",
|
"type": "TagIdentifier",
|
||||||
@ -1736,6 +1868,80 @@ description: Variables in memory after executing fillet-and-shell.kcl
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"widthBetweenScrews": {
|
"widthBetweenScrews": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 23.0,
|
"value": 23.0,
|
||||||
|
|||||||
@ -3,37 +3,132 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing function_sketch.kcl
|
description: Variables in memory after executing function_sketch.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"box": {
|
"box": {
|
||||||
"type": "Function",
|
"type": "Function",
|
||||||
@ -417,6 +512,43 @@ description: Variables in memory after executing function_sketch.kcl
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"fnBox": {
|
"fnBox": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
"value": {
|
"value": {
|
||||||
@ -649,5 +781,79 @@ description: Variables in memory after executing function_sketch.kcl
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,37 +3,132 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing function_sketch_with_position.kcl
|
description: Variables in memory after executing function_sketch_with_position.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"box": {
|
"box": {
|
||||||
"type": "Function",
|
"type": "Function",
|
||||||
@ -403,6 +498,117 @@ description: Variables in memory after executing function_sketch_with_position.k
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"thing": {
|
"thing": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
"value": {
|
"value": {
|
||||||
|
|||||||
@ -3,37 +3,169 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing helix_ccw.kcl
|
description: Variables in memory after executing helix_ccw.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"part001": {
|
"part001": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
@ -171,5 +303,79 @@ description: Variables in memory after executing helix_ccw.kcl
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,37 +3,169 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing helix_simple.kcl
|
description: Variables in memory after executing helix_simple.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"edge001": {
|
"edge001": {
|
||||||
"type": "TagIdentifier",
|
"type": "TagIdentifier",
|
||||||
@ -256,5 +388,79 @@ description: Variables in memory after executing helix_simple.kcl
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,37 +3,132 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing i_shape.kcl
|
description: Variables in memory after executing i_shape.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"brace_base": {
|
"brace_base": {
|
||||||
"type": "Sketch",
|
"type": "Sketch",
|
||||||
@ -767,6 +862,43 @@ description: Variables in memory after executing i_shape.kcl
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"d_wrist_circumference": {
|
"d_wrist_circumference": {
|
||||||
"type": "Array",
|
"type": "Array",
|
||||||
"value": [
|
"value": [
|
||||||
@ -2211,6 +2343,80 @@ description: Variables in memory after executing i_shape.kcl
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"width": {
|
"width": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 68.4,
|
"value": 68.4,
|
||||||
|
|||||||
@ -3,37 +3,132 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing if_else.kcl
|
description: Variables in memory after executing if_else.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"a": {
|
"a": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
@ -100,5 +195,116 @@ description: Variables in memory after executing if_else.kcl
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,37 +3,243 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing import_constant.kcl
|
description: Variables in memory after executing import_constant.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"three": {
|
"three": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
@ -52,7 +258,7 @@ description: Variables in memory after executing import_constant.kcl
|
|||||||
"sourceRange": [
|
"sourceRange": [
|
||||||
15,
|
15,
|
||||||
16,
|
16,
|
||||||
1
|
3
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/simulation_tests.rs
|
source: kcl/src/simulation_tests.rs
|
||||||
description: Artifact commands import_cycle1.kcl
|
description: Artifact commands import_cycle1.kcl
|
||||||
snapshot_kind: text
|
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@ -281,5 +280,17 @@ snapshot_kind: text
|
|||||||
"object_id": "[uuid]",
|
"object_id": "[uuid]",
|
||||||
"hidden": true
|
"hidden": true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [
|
||||||
|
0,
|
||||||
|
33,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"command": {
|
||||||
|
"type": "set_scene_units",
|
||||||
|
"unit": "in"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -3,37 +3,243 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing import_export.kcl
|
description: Variables in memory after executing import_export.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"three": {
|
"three": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
@ -52,7 +258,7 @@ description: Variables in memory after executing import_export.kcl
|
|||||||
"sourceRange": [
|
"sourceRange": [
|
||||||
15,
|
15,
|
||||||
16,
|
16,
|
||||||
2
|
4
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -3,41 +3,173 @@ source: kcl/src/simulation_tests.rs
|
|||||||
description: Variables in memory after executing import_foreign.kcl
|
description: Variables in memory after executing import_foreign.kcl
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
|
"E": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 2.718281828459045,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
651,
|
||||||
|
689,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"HALF_TURN": {
|
"HALF_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 180.0,
|
"value": 180.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
109,
|
||||||
|
115,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"PI": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 3.141592653589793,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
290,
|
||||||
|
328,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"QUARTER_TURN": {
|
"QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 90.0,
|
"value": 90.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
84,
|
||||||
|
89,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"TAU": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 6.283185307179586,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1042,
|
||||||
|
1080,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"THREE_QUARTER_TURN": {
|
"THREE_QUARTER_TURN": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 270.0,
|
"value": 270.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Degrees"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
144,
|
||||||
|
150,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"ZERO": {
|
"ZERO": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.0,
|
"value": 0.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
},
|
},
|
||||||
"__meta": []
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
61,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cos": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1477,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1477
|
||||||
|
},
|
||||||
|
"end": 1478,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1450,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1447,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1446,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1446,
|
||||||
|
1478,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"cube": {
|
"cube": {
|
||||||
"type": "Module",
|
"type": "Module",
|
||||||
"value": 1,
|
"value": 3,
|
||||||
"__meta": [
|
"__meta": [
|
||||||
{
|
{
|
||||||
"sourceRange": [
|
"sourceRange": [
|
||||||
@ -63,5 +195,79 @@ description: Variables in memory after executing import_foreign.kcl
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"sin": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 1875,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 1875
|
||||||
|
},
|
||||||
|
"end": 1876,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 1848,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 1845,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 1844,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
1844,
|
||||||
|
1876,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tan": {
|
||||||
|
"type": "Function",
|
||||||
|
"expression": {
|
||||||
|
"body": {
|
||||||
|
"body": [],
|
||||||
|
"end": 2265,
|
||||||
|
"moduleId": 2,
|
||||||
|
"start": 2265
|
||||||
|
},
|
||||||
|
"end": 2266,
|
||||||
|
"moduleId": 2,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "Parameter",
|
||||||
|
"identifier": {
|
||||||
|
"end": 2238,
|
||||||
|
"moduleId": 2,
|
||||||
|
"name": "num",
|
||||||
|
"start": 2235,
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start": 2234,
|
||||||
|
"type": "FunctionExpression"
|
||||||
|
},
|
||||||
|
"memory": null,
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
2234,
|
||||||
|
2266,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
source: kcl/src/simulation_tests.rs
|
source: kcl/src/simulation_tests.rs
|
||||||
|
assertion_line: 189
|
||||||
description: Artifact graph flowchart import_function_not_sketch.kcl
|
description: Artifact graph flowchart import_function_not_sketch.kcl
|
||||||
extension: md
|
extension: md
|
||||||
snapshot_kind: binary
|
snapshot_kind: binary
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user