* Support paths to names rather than just raw idents Signed-off-by: Nick Cameron <nrc@ncameron.org> * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 --------- Signed-off-by: Nick Cameron <nrc@ncameron.org> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
650 lines
24 KiB
Plaintext
650 lines
24 KiB
Plaintext
---
|
|
source: kcl-lib/src/simulation_tests.rs
|
|
description: Result of parsing function_sketch.kcl
|
|
---
|
|
{
|
|
"Ok": {
|
|
"body": [
|
|
{
|
|
"commentStart": 0,
|
|
"declaration": {
|
|
"commentStart": 3,
|
|
"end": 0,
|
|
"id": {
|
|
"commentStart": 3,
|
|
"end": 0,
|
|
"name": "box",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"init": {
|
|
"body": {
|
|
"body": [
|
|
{
|
|
"commentStart": 20,
|
|
"declaration": {
|
|
"commentStart": 20,
|
|
"end": 0,
|
|
"id": {
|
|
"commentStart": 20,
|
|
"end": 0,
|
|
"name": "myBox",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"init": {
|
|
"body": [
|
|
{
|
|
"arguments": [
|
|
{
|
|
"commentStart": 42,
|
|
"end": 0,
|
|
"raw": "'XY'",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": "XY"
|
|
}
|
|
],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 28,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 28,
|
|
"end": 0,
|
|
"name": "startSketchOn",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 28,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "CallExpression",
|
|
"type": "CallExpression"
|
|
},
|
|
{
|
|
"arguments": [
|
|
{
|
|
"commentStart": 70,
|
|
"elements": [
|
|
{
|
|
"commentStart": 71,
|
|
"end": 0,
|
|
"raw": "0",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 0.0,
|
|
"suffix": "None"
|
|
}
|
|
},
|
|
{
|
|
"commentStart": 74,
|
|
"end": 0,
|
|
"raw": "0",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 0.0,
|
|
"suffix": "None"
|
|
}
|
|
}
|
|
],
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "ArrayExpression",
|
|
"type": "ArrayExpression"
|
|
},
|
|
{
|
|
"commentStart": 78,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "PipeSubstitution",
|
|
"type": "PipeSubstitution"
|
|
}
|
|
],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 55,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 55,
|
|
"end": 0,
|
|
"name": "startProfileAt",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 55,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "CallExpression",
|
|
"type": "CallExpression"
|
|
},
|
|
{
|
|
"arguments": [
|
|
{
|
|
"type": "LabeledArg",
|
|
"label": {
|
|
"commentStart": 93,
|
|
"end": 0,
|
|
"name": "end",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"arg": {
|
|
"commentStart": 99,
|
|
"elements": [
|
|
{
|
|
"commentStart": 100,
|
|
"end": 0,
|
|
"raw": "0",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 0.0,
|
|
"suffix": "None"
|
|
}
|
|
},
|
|
{
|
|
"abs_path": false,
|
|
"commentStart": 103,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 103,
|
|
"end": 0,
|
|
"name": "l",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name",
|
|
"type": "Name"
|
|
}
|
|
],
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "ArrayExpression",
|
|
"type": "ArrayExpression"
|
|
}
|
|
}
|
|
],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 88,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 88,
|
|
"end": 0,
|
|
"name": "line",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 88,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "CallExpressionKw",
|
|
"type": "CallExpressionKw",
|
|
"unlabeled": null
|
|
},
|
|
{
|
|
"arguments": [
|
|
{
|
|
"type": "LabeledArg",
|
|
"label": {
|
|
"commentStart": 119,
|
|
"end": 0,
|
|
"name": "end",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"arg": {
|
|
"commentStart": 125,
|
|
"elements": [
|
|
{
|
|
"abs_path": false,
|
|
"commentStart": 126,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 126,
|
|
"end": 0,
|
|
"name": "w",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name",
|
|
"type": "Name"
|
|
},
|
|
{
|
|
"commentStart": 129,
|
|
"end": 0,
|
|
"raw": "0",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 0.0,
|
|
"suffix": "None"
|
|
}
|
|
}
|
|
],
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "ArrayExpression",
|
|
"type": "ArrayExpression"
|
|
}
|
|
}
|
|
],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 114,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 114,
|
|
"end": 0,
|
|
"name": "line",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 114,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "CallExpressionKw",
|
|
"type": "CallExpressionKw",
|
|
"unlabeled": null
|
|
},
|
|
{
|
|
"arguments": [
|
|
{
|
|
"type": "LabeledArg",
|
|
"label": {
|
|
"commentStart": 145,
|
|
"end": 0,
|
|
"name": "end",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"arg": {
|
|
"commentStart": 151,
|
|
"elements": [
|
|
{
|
|
"commentStart": 152,
|
|
"end": 0,
|
|
"raw": "0",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 0.0,
|
|
"suffix": "None"
|
|
}
|
|
},
|
|
{
|
|
"argument": {
|
|
"abs_path": false,
|
|
"commentStart": 156,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 156,
|
|
"end": 0,
|
|
"name": "l",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name",
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 155,
|
|
"end": 0,
|
|
"operator": "-",
|
|
"start": 0,
|
|
"type": "UnaryExpression",
|
|
"type": "UnaryExpression"
|
|
}
|
|
],
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "ArrayExpression",
|
|
"type": "ArrayExpression"
|
|
}
|
|
}
|
|
],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 140,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 140,
|
|
"end": 0,
|
|
"name": "line",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 140,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "CallExpressionKw",
|
|
"type": "CallExpressionKw",
|
|
"unlabeled": null
|
|
},
|
|
{
|
|
"arguments": [
|
|
{
|
|
"commentStart": 173,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "PipeSubstitution",
|
|
"type": "PipeSubstitution"
|
|
}
|
|
],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 167,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 167,
|
|
"end": 0,
|
|
"name": "close",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 167,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "CallExpression",
|
|
"type": "CallExpression"
|
|
},
|
|
{
|
|
"arguments": [
|
|
{
|
|
"type": "LabeledArg",
|
|
"label": {
|
|
"commentStart": 191,
|
|
"end": 0,
|
|
"name": "length",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"arg": {
|
|
"abs_path": false,
|
|
"commentStart": 200,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 200,
|
|
"end": 0,
|
|
"name": "h",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name",
|
|
"type": "Name"
|
|
}
|
|
}
|
|
],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 183,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 183,
|
|
"end": 0,
|
|
"name": "extrude",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 183,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "CallExpressionKw",
|
|
"type": "CallExpressionKw",
|
|
"unlabeled": null
|
|
}
|
|
],
|
|
"commentStart": 28,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "PipeExpression",
|
|
"type": "PipeExpression"
|
|
},
|
|
"start": 0,
|
|
"type": "VariableDeclarator"
|
|
},
|
|
"end": 0,
|
|
"kind": "const",
|
|
"start": 0,
|
|
"type": "VariableDeclaration",
|
|
"type": "VariableDeclaration"
|
|
},
|
|
{
|
|
"argument": {
|
|
"abs_path": false,
|
|
"commentStart": 213,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 213,
|
|
"end": 0,
|
|
"name": "myBox",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name",
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 202,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "ReturnStatement",
|
|
"type": "ReturnStatement"
|
|
}
|
|
],
|
|
"commentStart": 16,
|
|
"end": 0,
|
|
"nonCodeMeta": {
|
|
"nonCodeNodes": {
|
|
"0": [
|
|
{
|
|
"commentStart": 202,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "NonCodeNode",
|
|
"value": {
|
|
"type": "newLine"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"startNodes": []
|
|
},
|
|
"start": 0
|
|
},
|
|
"commentStart": 6,
|
|
"end": 0,
|
|
"params": [
|
|
{
|
|
"type": "Parameter",
|
|
"identifier": {
|
|
"commentStart": 7,
|
|
"end": 0,
|
|
"name": "h",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
}
|
|
},
|
|
{
|
|
"type": "Parameter",
|
|
"identifier": {
|
|
"commentStart": 10,
|
|
"end": 0,
|
|
"name": "l",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
}
|
|
},
|
|
{
|
|
"type": "Parameter",
|
|
"identifier": {
|
|
"commentStart": 13,
|
|
"end": 0,
|
|
"name": "w",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
}
|
|
}
|
|
],
|
|
"start": 0,
|
|
"type": "FunctionExpression",
|
|
"type": "FunctionExpression"
|
|
},
|
|
"start": 0,
|
|
"type": "VariableDeclarator"
|
|
},
|
|
"end": 0,
|
|
"kind": "fn",
|
|
"start": 0,
|
|
"type": "VariableDeclaration",
|
|
"type": "VariableDeclaration"
|
|
},
|
|
{
|
|
"commentStart": 220,
|
|
"declaration": {
|
|
"commentStart": 222,
|
|
"end": 0,
|
|
"id": {
|
|
"commentStart": 222,
|
|
"end": 0,
|
|
"name": "fnBox",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"init": {
|
|
"arguments": [
|
|
{
|
|
"commentStart": 234,
|
|
"end": 0,
|
|
"raw": "3",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 3.0,
|
|
"suffix": "None"
|
|
}
|
|
},
|
|
{
|
|
"commentStart": 237,
|
|
"end": 0,
|
|
"raw": "6",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 6.0,
|
|
"suffix": "None"
|
|
}
|
|
},
|
|
{
|
|
"commentStart": 240,
|
|
"end": 0,
|
|
"raw": "10",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 10.0,
|
|
"suffix": "None"
|
|
}
|
|
}
|
|
],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 230,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 230,
|
|
"end": 0,
|
|
"name": "box",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 230,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "CallExpression",
|
|
"type": "CallExpression"
|
|
},
|
|
"start": 0,
|
|
"type": "VariableDeclarator"
|
|
},
|
|
"end": 0,
|
|
"kind": "const",
|
|
"start": 0,
|
|
"type": "VariableDeclaration",
|
|
"type": "VariableDeclaration"
|
|
}
|
|
],
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"nonCodeMeta": {
|
|
"nonCodeNodes": {
|
|
"0": [
|
|
{
|
|
"commentStart": 220,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "NonCodeNode",
|
|
"value": {
|
|
"type": "newLine"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"startNodes": []
|
|
},
|
|
"start": 0
|
|
}
|
|
}
|