Files
modeling-app/rust/kcl-lib/tests/kcl_samples/pipe/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

1336 lines
42 KiB
Plaintext

---
source: kcl-lib/src/simulation_tests.rs
description: Result of parsing pipe.kcl
---
{
"Ok": {
"body": [
{
"commentStart": 199,
"declaration": {
"commentStart": 221,
"end": 0,
"id": {
"commentStart": 221,
"end": 0,
"name": "pipeTotalLength",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 239,
"end": 0,
"raw": "20",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 20.0,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"preComments": [
"// Define constants"
],
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 242,
"declaration": {
"commentStart": 242,
"end": 0,
"id": {
"commentStart": 242,
"end": 0,
"name": "pipeLargeDiaLength",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 263,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 265,
"declaration": {
"commentStart": 265,
"end": 0,
"id": {
"commentStart": 265,
"end": 0,
"name": "pipeLargeDia",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 280,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 282,
"declaration": {
"commentStart": 282,
"end": 0,
"id": {
"commentStart": 282,
"end": 0,
"name": "pipeSmallDia",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 297,
"end": 0,
"raw": ".75",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.75,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 301,
"declaration": {
"commentStart": 301,
"end": 0,
"id": {
"commentStart": 301,
"end": 0,
"name": "thickness",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 313,
"end": 0,
"raw": "0.125",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.125,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 319,
"declaration": {
"commentStart": 319,
"end": 0,
"id": {
"commentStart": 319,
"end": 0,
"name": "pipeTransitionAngle",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 341,
"end": 0,
"raw": "60",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 60.0,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 344,
"declaration": {
"commentStart": 344,
"end": 0,
"id": {
"commentStart": 344,
"end": 0,
"name": "pipeTransitionLength",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 367,
"end": 0,
"raw": "0.5",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.5,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 371,
"declaration": {
"commentStart": 371,
"end": 0,
"id": {
"commentStart": 371,
"end": 0,
"name": "pipeSmallDiaLength",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 392,
"end": 0,
"left": {
"commentStart": 392,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 392,
"end": 0,
"name": {
"commentStart": 392,
"end": 0,
"name": "pipeTotalLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "-",
"right": {
"abs_path": false,
"commentStart": 410,
"end": 0,
"name": {
"commentStart": 410,
"end": 0,
"name": "pipeTransitionLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"operator": "-",
"right": {
"abs_path": false,
"commentStart": 433,
"end": 0,
"name": {
"commentStart": 433,
"end": 0,
"name": "pipeLargeDiaLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 451,
"declaration": {
"commentStart": 592,
"end": 0,
"id": {
"commentStart": 592,
"end": 0,
"name": "pipeSketch",
"start": 0,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"commentStart": 619,
"end": 0,
"raw": "'XY'",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"abs_path": false,
"commentStart": 605,
"end": 0,
"name": {
"commentStart": 605,
"end": 0,
"name": "startSketchOn",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 605,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"commentStart": 645,
"elements": [
{
"commentStart": 646,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 646,
"end": 0,
"name": {
"commentStart": 646,
"end": 0,
"name": "pipeSmallDia",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "-",
"right": {
"commentStart": 662,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 662,
"end": 0,
"name": {
"commentStart": 662,
"end": 0,
"name": "thickness",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "/",
"right": {
"commentStart": 674,
"end": 0,
"raw": "2",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"commentStart": 678,
"end": 0,
"raw": "38",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 38.0,
"suffix": "None"
}
}
],
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"commentStart": 683,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"abs_path": false,
"commentStart": 630,
"end": 0,
"name": {
"commentStart": 630,
"end": 0,
"name": "startProfileAt",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 630,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 696,
"end": 0,
"name": "end",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 702,
"elements": [
{
"abs_path": false,
"commentStart": 703,
"end": 0,
"name": {
"commentStart": 703,
"end": 0,
"name": "thickness",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"commentStart": 714,
"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": 691,
"end": 0,
"name": {
"commentStart": 691,
"end": 0,
"name": "line",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 691,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 728,
"end": 0,
"name": "end",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 734,
"elements": [
{
"commentStart": 735,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"argument": {
"abs_path": false,
"commentStart": 739,
"end": 0,
"name": {
"commentStart": 739,
"end": 0,
"name": "pipeSmallDiaLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"commentStart": 738,
"end": 0,
"operator": "-",
"start": 0,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 723,
"end": 0,
"name": {
"commentStart": 723,
"end": 0,
"name": "line",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 723,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"commentStart": 785,
"end": 0,
"properties": [
{
"commentStart": 794,
"end": 0,
"key": {
"commentStart": 794,
"end": 0,
"name": "angle",
"start": 0,
"type": "Identifier"
},
"start": 0,
"type": "ObjectProperty",
"value": {
"argument": {
"commentStart": 803,
"end": 0,
"raw": "60",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 60.0,
"suffix": "None"
}
},
"commentStart": 802,
"end": 0,
"operator": "-",
"start": 0,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
},
{
"commentStart": 814,
"end": 0,
"key": {
"commentStart": 814,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"start": 0,
"type": "ObjectProperty",
"value": {
"abs_path": false,
"commentStart": 823,
"end": 0,
"name": {
"commentStart": 823,
"end": 0,
"name": "pipeTransitionLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}
],
"start": 0,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"commentStart": 852,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"abs_path": false,
"commentStart": 765,
"end": 0,
"name": {
"commentStart": 765,
"end": 0,
"name": "angledLineOfYLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 765,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 865,
"end": 0,
"name": "end",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 871,
"elements": [
{
"commentStart": 872,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"argument": {
"abs_path": false,
"commentStart": 876,
"end": 0,
"name": {
"commentStart": 876,
"end": 0,
"name": "pipeLargeDiaLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"commentStart": 875,
"end": 0,
"operator": "-",
"start": 0,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 860,
"end": 0,
"name": {
"commentStart": 860,
"end": 0,
"name": "line",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 860,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 908,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"arg": {
"argument": {
"abs_path": false,
"commentStart": 918,
"end": 0,
"name": {
"commentStart": 918,
"end": 0,
"name": "thickness",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"commentStart": 917,
"end": 0,
"operator": "-",
"start": 0,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 902,
"end": 0,
"name": {
"commentStart": 902,
"end": 0,
"name": "xLine",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 902,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 939,
"end": 0,
"name": "end",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 945,
"elements": [
{
"commentStart": 946,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"abs_path": false,
"commentStart": 949,
"end": 0,
"name": {
"commentStart": 949,
"end": 0,
"name": "pipeLargeDiaLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
],
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 934,
"end": 0,
"name": {
"commentStart": 934,
"end": 0,
"name": "line",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 934,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"commentStart": 989,
"end": 0,
"properties": [
{
"commentStart": 998,
"end": 0,
"key": {
"commentStart": 998,
"end": 0,
"name": "angle",
"start": 0,
"type": "Identifier"
},
"start": 0,
"type": "ObjectProperty",
"value": {
"commentStart": 1006,
"end": 0,
"left": {
"argument": {
"abs_path": false,
"commentStart": 1007,
"end": 0,
"name": {
"commentStart": 1007,
"end": 0,
"name": "pipeTransitionAngle",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"commentStart": 1006,
"end": 0,
"operator": "-",
"start": 0,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
"operator": "+",
"right": {
"commentStart": 1029,
"end": 0,
"raw": "180",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 180.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 1041,
"end": 0,
"key": {
"commentStart": 1041,
"end": 0,
"name": "to",
"start": 0,
"type": "Identifier"
},
"start": 0,
"type": "ObjectProperty",
"value": {
"commentStart": 1046,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 1046,
"end": 0,
"name": {
"commentStart": 1046,
"end": 0,
"name": "pipeSmallDia",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "-",
"right": {
"commentStart": 1062,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 1062,
"end": 0,
"name": {
"commentStart": 1062,
"end": 0,
"name": "thickness",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "/",
"right": {
"commentStart": 1074,
"end": 0,
"raw": "2",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
}
],
"start": 0,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"commentStart": 1085,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"abs_path": false,
"commentStart": 975,
"end": 0,
"name": {
"commentStart": 975,
"end": 0,
"name": "angledLineToX",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 975,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [],
"callee": {
"abs_path": false,
"commentStart": 1093,
"end": 0,
"name": {
"commentStart": 1093,
"end": 0,
"name": "close",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 1093,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
}
],
"commentStart": 605,
"end": 0,
"nonCodeMeta": {
"nonCodeNodes": {
"9": [
{
"commentStart": 1100,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLineBlockComment",
"value": "Revolve the sketch to create the pipe",
"style": "line"
}
}
]
},
"startNodes": []
},
"start": 0,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"preComments": [
"",
"",
"// Create the sketch to be revolved around the y-axis. Use the small diameter, large diameter, length, and thickness to define the sketch."
],
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 1143,
"declaration": {
"commentStart": 1143,
"end": 0,
"id": {
"commentStart": 1143,
"end": 0,
"name": "pipe",
"start": 0,
"type": "Identifier"
},
"init": {
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 1170,
"end": 0,
"name": "axis",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 1177,
"end": 0,
"raw": "'y'",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "y"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 1150,
"end": 0,
"name": {
"commentStart": 1150,
"end": 0,
"name": "revolve",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 1150,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 1158,
"end": 0,
"name": {
"commentStart": 1158,
"end": 0,
"name": "pipeSketch",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 0,
"innerAttrs": [
{
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 167,
"end": 0,
"name": "settings",
"start": 0,
"type": "Identifier"
},
"preComments": [
"// Pipe",
"// A tubular section or hollow cylinder, usually but not necessarily of circular cross-section, used mainly to convey substances that can flow.",
"",
"",
"// Set Units"
],
"properties": [
{
"commentStart": 176,
"end": 0,
"key": {
"commentStart": 176,
"end": 0,
"name": "defaultLengthUnit",
"start": 0,
"type": "Identifier"
},
"start": 0,
"type": "ObjectProperty",
"value": {
"abs_path": false,
"commentStart": 196,
"end": 0,
"name": {
"commentStart": 196,
"end": 0,
"name": "in",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}
],
"start": 0,
"type": "Annotation"
}
],
"nonCodeMeta": {
"nonCodeNodes": {},
"startNodes": [
{
"commentStart": 199,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"start": 0
}
}