* KCL test for rectangle * Rectangle function * Rectangle helper tests * Rectangle helper * Fix clippy lints * Update docs * fmt * Fix bug * fmt * Fix doc comments * Update generated docs --------- Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
702 lines
24 KiB
Plaintext
702 lines
24 KiB
Plaintext
---
|
|
source: kcl-lib/src/simulation_tests.rs
|
|
description: Result of parsing rect.kcl
|
|
---
|
|
{
|
|
"Ok": {
|
|
"body": [
|
|
{
|
|
"commentStart": 0,
|
|
"declaration": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"id": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "x",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"init": {
|
|
"body": [
|
|
{
|
|
"arguments": [],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "startSketchOn",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"start": 0,
|
|
"type": "CallExpressionKw",
|
|
"type": "CallExpressionKw",
|
|
"unlabeled": {
|
|
"abs_path": false,
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "XY",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name",
|
|
"type": "Name"
|
|
}
|
|
},
|
|
{
|
|
"arguments": [
|
|
{
|
|
"type": "LabeledArg",
|
|
"label": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "at",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"arg": {
|
|
"commentStart": 0,
|
|
"elements": [
|
|
{
|
|
"argument": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"raw": "2",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 2.0,
|
|
"suffix": "None"
|
|
}
|
|
},
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"operator": "-",
|
|
"start": 0,
|
|
"type": "UnaryExpression",
|
|
"type": "UnaryExpression"
|
|
},
|
|
{
|
|
"argument": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"raw": "1",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 1.0,
|
|
"suffix": "None"
|
|
}
|
|
},
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"operator": "-",
|
|
"start": 0,
|
|
"type": "UnaryExpression",
|
|
"type": "UnaryExpression"
|
|
}
|
|
],
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"start": 0,
|
|
"type": "ArrayExpression",
|
|
"type": "ArrayExpression"
|
|
}
|
|
}
|
|
],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "startProfile",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"start": 0,
|
|
"type": "CallExpressionKw",
|
|
"type": "CallExpressionKw",
|
|
"unlabeled": null
|
|
},
|
|
{
|
|
"arguments": [
|
|
{
|
|
"type": "LabeledArg",
|
|
"label": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "angle",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"arg": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"raw": "0",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 0.0,
|
|
"suffix": "None"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "LabeledArg",
|
|
"label": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "length",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"arg": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"raw": "3",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 3.0,
|
|
"suffix": "None"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "LabeledArg",
|
|
"label": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "tag",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"arg": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"start": 0,
|
|
"type": "TagDeclarator",
|
|
"type": "TagDeclarator",
|
|
"value": "a"
|
|
}
|
|
}
|
|
],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "angledLine",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"start": 0,
|
|
"type": "CallExpressionKw",
|
|
"type": "CallExpressionKw",
|
|
"unlabeled": null
|
|
},
|
|
{
|
|
"arguments": [
|
|
{
|
|
"type": "LabeledArg",
|
|
"label": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "angle",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"arg": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"left": {
|
|
"arguments": [],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "segAng",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"start": 0,
|
|
"type": "CallExpressionKw",
|
|
"type": "CallExpressionKw",
|
|
"unlabeled": {
|
|
"abs_path": false,
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "a",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name",
|
|
"type": "Name"
|
|
}
|
|
},
|
|
"moduleId": 0,
|
|
"operator": "+",
|
|
"right": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"raw": "90",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 90.0,
|
|
"suffix": "None"
|
|
}
|
|
},
|
|
"start": 0,
|
|
"type": "BinaryExpression",
|
|
"type": "BinaryExpression"
|
|
}
|
|
},
|
|
{
|
|
"type": "LabeledArg",
|
|
"label": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "length",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"arg": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"raw": "2",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 2.0,
|
|
"suffix": "None"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "angledLine",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"start": 0,
|
|
"type": "CallExpressionKw",
|
|
"type": "CallExpressionKw",
|
|
"unlabeled": null
|
|
},
|
|
{
|
|
"arguments": [
|
|
{
|
|
"type": "LabeledArg",
|
|
"label": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "angle",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"arg": {
|
|
"arguments": [],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "segAng",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"start": 0,
|
|
"type": "CallExpressionKw",
|
|
"type": "CallExpressionKw",
|
|
"unlabeled": {
|
|
"abs_path": false,
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "a",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name",
|
|
"type": "Name"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "LabeledArg",
|
|
"label": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "length",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"arg": {
|
|
"argument": {
|
|
"arguments": [],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "segLen",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"start": 0,
|
|
"type": "CallExpressionKw",
|
|
"type": "CallExpressionKw",
|
|
"unlabeled": {
|
|
"abs_path": false,
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "a",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name",
|
|
"type": "Name"
|
|
}
|
|
},
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"operator": "-",
|
|
"start": 0,
|
|
"type": "UnaryExpression",
|
|
"type": "UnaryExpression"
|
|
}
|
|
}
|
|
],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "angledLine",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"start": 0,
|
|
"type": "CallExpressionKw",
|
|
"type": "CallExpressionKw",
|
|
"unlabeled": null
|
|
},
|
|
{
|
|
"arguments": [
|
|
{
|
|
"type": "LabeledArg",
|
|
"label": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "endAbsolute",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"arg": {
|
|
"commentStart": 0,
|
|
"elements": [
|
|
{
|
|
"arguments": [],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "profileStartX",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"start": 0,
|
|
"type": "CallExpressionKw",
|
|
"type": "CallExpressionKw",
|
|
"unlabeled": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"start": 0,
|
|
"type": "PipeSubstitution",
|
|
"type": "PipeSubstitution"
|
|
}
|
|
},
|
|
{
|
|
"arguments": [],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "profileStartY",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"start": 0,
|
|
"type": "CallExpressionKw",
|
|
"type": "CallExpressionKw",
|
|
"unlabeled": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"start": 0,
|
|
"type": "PipeSubstitution",
|
|
"type": "PipeSubstitution"
|
|
}
|
|
}
|
|
],
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"start": 0,
|
|
"type": "ArrayExpression",
|
|
"type": "ArrayExpression"
|
|
}
|
|
}
|
|
],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "line",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"start": 0,
|
|
"type": "CallExpressionKw",
|
|
"type": "CallExpressionKw",
|
|
"unlabeled": null
|
|
},
|
|
{
|
|
"arguments": [],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": {
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"name": "close",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"start": 0,
|
|
"type": "CallExpressionKw",
|
|
"type": "CallExpressionKw",
|
|
"unlabeled": null
|
|
}
|
|
],
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"start": 0,
|
|
"type": "PipeExpression",
|
|
"type": "PipeExpression"
|
|
},
|
|
"moduleId": 0,
|
|
"start": 0,
|
|
"type": "VariableDeclarator"
|
|
},
|
|
"end": 0,
|
|
"kind": "const",
|
|
"moduleId": 0,
|
|
"start": 0,
|
|
"type": "VariableDeclaration",
|
|
"type": "VariableDeclaration"
|
|
}
|
|
],
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"moduleId": 0,
|
|
"start": 0
|
|
}
|
|
}
|