Files
modeling-app/rust/kcl-lib/tests/parametric/ast.snap
Nick Cameron dddcd5ff46 Support paths to names rather than just raw idents (#5778)
* 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>
2025-03-24 20:58:55 +13:00

1170 lines
35 KiB
Plaintext

---
source: kcl-lib/src/simulation_tests.rs
description: Result of parsing parametric.kcl
---
{
"Ok": {
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 0,
"id": {
"commentStart": 0,
"end": 0,
"name": "sigmaAllow",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 13,
"end": 0,
"raw": "35000",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 35000.0,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 18,
"declaration": {
"commentStart": 26,
"end": 0,
"id": {
"commentStart": 26,
"end": 0,
"name": "width",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 34,
"end": 0,
"raw": "9",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 9.0,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 35,
"declaration": {
"commentStart": 44,
"end": 0,
"id": {
"commentStart": 44,
"end": 0,
"name": "p",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 48,
"end": 0,
"raw": "150",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 150.0,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 51,
"declaration": {
"commentStart": 76,
"end": 0,
"id": {
"commentStart": 76,
"end": 0,
"name": "distance",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 87,
"end": 0,
"raw": "6",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 6.0,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 88,
"declaration": {
"commentStart": 99,
"end": 0,
"id": {
"commentStart": 99,
"end": 0,
"name": "FOS",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 105,
"end": 0,
"raw": "2",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 106,
"declaration": {
"commentStart": 108,
"end": 0,
"id": {
"commentStart": 108,
"end": 0,
"name": "leg1",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 115,
"end": 0,
"raw": "5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 116,
"declaration": {
"commentStart": 127,
"end": 0,
"id": {
"commentStart": 127,
"end": 0,
"name": "leg2",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 134,
"end": 0,
"raw": "8",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 8.0,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 135,
"declaration": {
"commentStart": 146,
"end": 0,
"id": {
"commentStart": 146,
"end": 0,
"name": "thickness",
"start": 0,
"type": "Identifier"
},
"init": {
"arguments": [
{
"commentStart": 163,
"end": 0,
"left": {
"commentStart": 163,
"end": 0,
"left": {
"commentStart": 163,
"end": 0,
"left": {
"commentStart": 163,
"end": 0,
"left": {
"commentStart": 163,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 163,
"end": 0,
"name": {
"commentStart": 163,
"end": 0,
"name": "distance",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "*",
"right": {
"abs_path": false,
"commentStart": 174,
"end": 0,
"name": {
"commentStart": 174,
"end": 0,
"name": "p",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"operator": "*",
"right": {
"abs_path": false,
"commentStart": 178,
"end": 0,
"name": {
"commentStart": 178,
"end": 0,
"name": "FOS",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"operator": "*",
"right": {
"commentStart": 184,
"end": 0,
"raw": "6",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 6.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"operator": "/",
"right": {
"abs_path": false,
"commentStart": 188,
"end": 0,
"name": {
"commentStart": 188,
"end": 0,
"name": "sigmaAllow",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"operator": "/",
"right": {
"abs_path": false,
"commentStart": 201,
"end": 0,
"name": {
"commentStart": 201,
"end": 0,
"name": "width",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"callee": {
"abs_path": false,
"commentStart": 158,
"end": 0,
"name": {
"commentStart": 158,
"end": 0,
"name": "sqrt",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 158,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 207,
"declaration": {
"commentStart": 218,
"end": 0,
"id": {
"commentStart": 218,
"end": 0,
"name": "bracket",
"start": 0,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"commentStart": 242,
"end": 0,
"raw": "'XY'",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"abs_path": false,
"commentStart": 228,
"end": 0,
"name": {
"commentStart": 228,
"end": 0,
"name": "startSketchOn",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 228,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"commentStart": 268,
"elements": [
{
"commentStart": 269,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"commentStart": 272,
"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": 276,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"abs_path": false,
"commentStart": 253,
"end": 0,
"name": {
"commentStart": 253,
"end": 0,
"name": "startProfileAt",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 253,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 289,
"end": 0,
"name": "end",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 295,
"elements": [
{
"commentStart": 296,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"abs_path": false,
"commentStart": 299,
"end": 0,
"name": {
"commentStart": 299,
"end": 0,
"name": "leg1",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
],
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 284,
"end": 0,
"name": {
"commentStart": 284,
"end": 0,
"name": "line",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 284,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 316,
"end": 0,
"name": "end",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 322,
"elements": [
{
"abs_path": false,
"commentStart": 323,
"end": 0,
"name": {
"commentStart": 323,
"end": 0,
"name": "leg2",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 329,
"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": 311,
"end": 0,
"name": {
"commentStart": 311,
"end": 0,
"name": "line",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 311,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 343,
"end": 0,
"name": "end",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 349,
"elements": [
{
"commentStart": 350,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"argument": {
"abs_path": false,
"commentStart": 354,
"end": 0,
"name": {
"commentStart": 354,
"end": 0,
"name": "thickness",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"commentStart": 353,
"end": 0,
"operator": "-",
"start": 0,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 338,
"end": 0,
"name": {
"commentStart": 338,
"end": 0,
"name": "line",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 338,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 376,
"end": 0,
"name": "end",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 382,
"elements": [
{
"commentStart": 383,
"end": 0,
"left": {
"argument": {
"abs_path": false,
"commentStart": 384,
"end": 0,
"name": {
"commentStart": 384,
"end": 0,
"name": "leg2",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"commentStart": 383,
"end": 0,
"operator": "-",
"start": 0,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
"operator": "+",
"right": {
"abs_path": false,
"commentStart": 391,
"end": 0,
"name": {
"commentStart": 391,
"end": 0,
"name": "thickness",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"commentStart": 402,
"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": 371,
"end": 0,
"name": {
"commentStart": 371,
"end": 0,
"name": "line",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 371,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 416,
"end": 0,
"name": "end",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 422,
"elements": [
{
"commentStart": 423,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"commentStart": 426,
"end": 0,
"left": {
"argument": {
"abs_path": false,
"commentStart": 427,
"end": 0,
"name": {
"commentStart": 427,
"end": 0,
"name": "leg1",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"commentStart": 426,
"end": 0,
"operator": "-",
"start": 0,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
"operator": "+",
"right": {
"abs_path": false,
"commentStart": 434,
"end": 0,
"name": {
"commentStart": 434,
"end": 0,
"name": "thickness",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 411,
"end": 0,
"name": {
"commentStart": 411,
"end": 0,
"name": "line",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 411,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"commentStart": 457,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"abs_path": false,
"commentStart": 451,
"end": 0,
"name": {
"commentStart": 451,
"end": 0,
"name": "close",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 451,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 473,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"arg": {
"abs_path": false,
"commentStart": 482,
"end": 0,
"name": {
"commentStart": 482,
"end": 0,
"name": "width",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 465,
"end": 0,
"name": {
"commentStart": 465,
"end": 0,
"name": "extrude",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 465,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
}
],
"commentStart": 228,
"end": 0,
"start": 0,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 0,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"commentStart": 18,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "inlineComment",
"value": "psi",
"style": "line"
}
}
],
"1": [
{
"commentStart": 35,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "inlineComment",
"value": "inch",
"style": "line"
}
}
],
"2": [
{
"commentStart": 51,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "inlineComment",
"value": "Force on shelf - lbs",
"style": "line"
}
}
],
"3": [
{
"commentStart": 88,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "inlineComment",
"value": "inches",
"style": "line"
}
}
],
"4": [
{
"commentStart": 106,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"5": [
{
"commentStart": 116,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "inlineComment",
"value": "inches",
"style": "line"
}
}
],
"6": [
{
"commentStart": 135,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "inlineComment",
"value": "inches",
"style": "line"
}
}
],
"7": [
{
"commentStart": 207,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "inlineComment",
"value": "inches",
"style": "line"
}
}
]
},
"startNodes": []
},
"start": 0
}
}