* 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>
646 lines
22 KiB
Plaintext
646 lines
22 KiB
Plaintext
---
|
|
source: kcl-lib/src/simulation_tests.rs
|
|
description: Result of parsing multi_transform.kcl
|
|
---
|
|
{
|
|
"Ok": {
|
|
"body": [
|
|
{
|
|
"commentStart": 0,
|
|
"declaration": {
|
|
"commentStart": 3,
|
|
"end": 0,
|
|
"id": {
|
|
"commentStart": 3,
|
|
"end": 0,
|
|
"name": "transform",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"init": {
|
|
"body": {
|
|
"body": [
|
|
{
|
|
"argument": {
|
|
"commentStart": 27,
|
|
"elements": [
|
|
{
|
|
"commentStart": 33,
|
|
"end": 0,
|
|
"properties": [
|
|
{
|
|
"commentStart": 35,
|
|
"end": 0,
|
|
"key": {
|
|
"commentStart": 35,
|
|
"end": 0,
|
|
"name": "translate",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"start": 0,
|
|
"type": "ObjectProperty",
|
|
"value": {
|
|
"commentStart": 47,
|
|
"elements": [
|
|
{
|
|
"commentStart": 48,
|
|
"end": 0,
|
|
"left": {
|
|
"commentStart": 48,
|
|
"end": 0,
|
|
"raw": "30",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 30.0,
|
|
"suffix": "None"
|
|
}
|
|
},
|
|
"operator": "*",
|
|
"right": {
|
|
"abs_path": false,
|
|
"commentStart": 53,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 53,
|
|
"end": 0,
|
|
"name": "i",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name",
|
|
"type": "Name"
|
|
},
|
|
"start": 0,
|
|
"type": "BinaryExpression",
|
|
"type": "BinaryExpression"
|
|
},
|
|
{
|
|
"commentStart": 56,
|
|
"end": 0,
|
|
"raw": "0",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 0.0,
|
|
"suffix": "None"
|
|
}
|
|
},
|
|
{
|
|
"commentStart": 59,
|
|
"end": 0,
|
|
"raw": "0",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 0.0,
|
|
"suffix": "None"
|
|
}
|
|
}
|
|
],
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "ArrayExpression",
|
|
"type": "ArrayExpression"
|
|
}
|
|
}
|
|
],
|
|
"start": 0,
|
|
"type": "ObjectExpression",
|
|
"type": "ObjectExpression"
|
|
},
|
|
{
|
|
"commentStart": 69,
|
|
"end": 0,
|
|
"properties": [
|
|
{
|
|
"commentStart": 71,
|
|
"end": 0,
|
|
"key": {
|
|
"commentStart": 71,
|
|
"end": 0,
|
|
"name": "rotation",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"start": 0,
|
|
"type": "ObjectProperty",
|
|
"value": {
|
|
"commentStart": 82,
|
|
"end": 0,
|
|
"properties": [
|
|
{
|
|
"commentStart": 84,
|
|
"end": 0,
|
|
"key": {
|
|
"commentStart": 84,
|
|
"end": 0,
|
|
"name": "angle",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"start": 0,
|
|
"type": "ObjectProperty",
|
|
"value": {
|
|
"commentStart": 92,
|
|
"end": 0,
|
|
"left": {
|
|
"commentStart": 92,
|
|
"end": 0,
|
|
"raw": "45",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 45.0,
|
|
"suffix": "None"
|
|
}
|
|
},
|
|
"operator": "*",
|
|
"right": {
|
|
"abs_path": false,
|
|
"commentStart": 97,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 97,
|
|
"end": 0,
|
|
"name": "i",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name",
|
|
"type": "Name"
|
|
},
|
|
"start": 0,
|
|
"type": "BinaryExpression",
|
|
"type": "BinaryExpression"
|
|
}
|
|
}
|
|
],
|
|
"start": 0,
|
|
"type": "ObjectExpression",
|
|
"type": "ObjectExpression"
|
|
}
|
|
}
|
|
],
|
|
"start": 0,
|
|
"type": "ObjectExpression",
|
|
"type": "ObjectExpression"
|
|
}
|
|
],
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "ArrayExpression",
|
|
"type": "ArrayExpression"
|
|
},
|
|
"commentStart": 20,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "ReturnStatement",
|
|
"type": "ReturnStatement"
|
|
}
|
|
],
|
|
"commentStart": 16,
|
|
"end": 0,
|
|
"start": 0
|
|
},
|
|
"commentStart": 12,
|
|
"end": 0,
|
|
"params": [
|
|
{
|
|
"type": "Parameter",
|
|
"identifier": {
|
|
"commentStart": 13,
|
|
"end": 0,
|
|
"name": "i",
|
|
"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": 109,
|
|
"end": 0,
|
|
"expression": {
|
|
"body": [
|
|
{
|
|
"arguments": [
|
|
{
|
|
"abs_path": false,
|
|
"commentStart": 123,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 123,
|
|
"end": 0,
|
|
"name": "XY",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name",
|
|
"type": "Name"
|
|
}
|
|
],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 109,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 109,
|
|
"end": 0,
|
|
"name": "startSketchOn",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 109,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "CallExpression",
|
|
"type": "CallExpression"
|
|
},
|
|
{
|
|
"arguments": [
|
|
{
|
|
"commentStart": 147,
|
|
"elements": [
|
|
{
|
|
"commentStart": 148,
|
|
"end": 0,
|
|
"raw": "0",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 0.0,
|
|
"suffix": "None"
|
|
}
|
|
},
|
|
{
|
|
"commentStart": 151,
|
|
"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": 155,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "PipeSubstitution",
|
|
"type": "PipeSubstitution"
|
|
}
|
|
],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 132,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 132,
|
|
"end": 0,
|
|
"name": "startProfileAt",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 132,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "CallExpression",
|
|
"type": "CallExpression"
|
|
},
|
|
{
|
|
"arguments": [
|
|
{
|
|
"commentStart": 171,
|
|
"end": 0,
|
|
"properties": [
|
|
{
|
|
"commentStart": 180,
|
|
"end": 0,
|
|
"key": {
|
|
"commentStart": 180,
|
|
"end": 0,
|
|
"name": "radius",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"start": 0,
|
|
"type": "ObjectProperty",
|
|
"value": {
|
|
"commentStart": 189,
|
|
"end": 0,
|
|
"raw": "10",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 10.0,
|
|
"suffix": "None"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"commentStart": 200,
|
|
"end": 0,
|
|
"key": {
|
|
"commentStart": 200,
|
|
"end": 0,
|
|
"name": "numSides",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"start": 0,
|
|
"type": "ObjectProperty",
|
|
"value": {
|
|
"commentStart": 211,
|
|
"end": 0,
|
|
"raw": "4",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 4.0,
|
|
"suffix": "None"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"commentStart": 221,
|
|
"end": 0,
|
|
"key": {
|
|
"commentStart": 221,
|
|
"end": 0,
|
|
"name": "center",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"start": 0,
|
|
"type": "ObjectProperty",
|
|
"value": {
|
|
"commentStart": 230,
|
|
"elements": [
|
|
{
|
|
"commentStart": 231,
|
|
"end": 0,
|
|
"raw": "0",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 0.0,
|
|
"suffix": "None"
|
|
}
|
|
},
|
|
{
|
|
"commentStart": 234,
|
|
"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": 245,
|
|
"end": 0,
|
|
"key": {
|
|
"commentStart": 245,
|
|
"end": 0,
|
|
"name": "inscribed",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"start": 0,
|
|
"type": "ObjectProperty",
|
|
"value": {
|
|
"commentStart": 257,
|
|
"end": 0,
|
|
"raw": "false",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": false
|
|
}
|
|
}
|
|
],
|
|
"start": 0,
|
|
"type": "ObjectExpression",
|
|
"type": "ObjectExpression"
|
|
},
|
|
{
|
|
"commentStart": 271,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "PipeSubstitution",
|
|
"type": "PipeSubstitution"
|
|
}
|
|
],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 163,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 163,
|
|
"end": 0,
|
|
"name": "polygon",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 163,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "CallExpression",
|
|
"type": "CallExpression"
|
|
},
|
|
{
|
|
"arguments": [
|
|
{
|
|
"type": "LabeledArg",
|
|
"label": {
|
|
"commentStart": 287,
|
|
"end": 0,
|
|
"name": "length",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"arg": {
|
|
"commentStart": 296,
|
|
"end": 0,
|
|
"raw": "4",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 4.0,
|
|
"suffix": "None"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 279,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 279,
|
|
"end": 0,
|
|
"name": "extrude",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 279,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "CallExpressionKw",
|
|
"type": "CallExpressionKw",
|
|
"unlabeled": null
|
|
},
|
|
{
|
|
"arguments": [
|
|
{
|
|
"type": "LabeledArg",
|
|
"label": {
|
|
"commentStart": 321,
|
|
"end": 0,
|
|
"name": "instances",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"arg": {
|
|
"commentStart": 333,
|
|
"end": 0,
|
|
"raw": "3",
|
|
"start": 0,
|
|
"type": "Literal",
|
|
"type": "Literal",
|
|
"value": {
|
|
"value": 3.0,
|
|
"suffix": "None"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "LabeledArg",
|
|
"label": {
|
|
"commentStart": 336,
|
|
"end": 0,
|
|
"name": "transform",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"arg": {
|
|
"abs_path": false,
|
|
"commentStart": 348,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 348,
|
|
"end": 0,
|
|
"name": "transform",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name",
|
|
"type": "Name"
|
|
}
|
|
}
|
|
],
|
|
"callee": {
|
|
"abs_path": false,
|
|
"commentStart": 304,
|
|
"end": 0,
|
|
"name": {
|
|
"commentStart": 304,
|
|
"end": 0,
|
|
"name": "patternTransform",
|
|
"start": 0,
|
|
"type": "Identifier"
|
|
},
|
|
"path": [],
|
|
"start": 0,
|
|
"type": "Name"
|
|
},
|
|
"commentStart": 304,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "CallExpressionKw",
|
|
"type": "CallExpressionKw",
|
|
"unlabeled": null
|
|
}
|
|
],
|
|
"commentStart": 109,
|
|
"end": 0,
|
|
"start": 0,
|
|
"type": "PipeExpression",
|
|
"type": "PipeExpression"
|
|
},
|
|
"start": 0,
|
|
"type": "ExpressionStatement",
|
|
"type": "ExpressionStatement"
|
|
}
|
|
],
|
|
"commentStart": 0,
|
|
"end": 0,
|
|
"start": 0
|
|
}
|
|
}
|