Files
modeling-app/rust/kcl-lib/tests/kcl_samples/pipe/ast.snap
2025-04-02 14:45:50 -05:00

1012 lines
30 KiB
Plaintext

---
source: kcl-lib/src/simulation_tests.rs
description: Result of parsing pipe.kcl
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 241,
"id": {
"end": 236,
"name": "pipeTotalLength",
"start": 221,
"type": "Identifier"
},
"init": {
"end": 241,
"raw": "20",
"start": 239,
"type": "Literal",
"type": "Literal",
"value": {
"value": 20.0,
"suffix": "None"
}
},
"start": 221,
"type": "VariableDeclarator"
},
"end": 241,
"kind": "const",
"start": 221,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 264,
"id": {
"end": 260,
"name": "pipeLargeDiaLength",
"start": 242,
"type": "Identifier"
},
"init": {
"end": 264,
"raw": "1",
"start": 263,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 242,
"type": "VariableDeclarator"
},
"end": 264,
"kind": "const",
"start": 242,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 281,
"id": {
"end": 277,
"name": "pipeLargeDia",
"start": 265,
"type": "Identifier"
},
"init": {
"end": 281,
"raw": "1",
"start": 280,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 265,
"type": "VariableDeclarator"
},
"end": 281,
"kind": "const",
"start": 265,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 300,
"id": {
"end": 294,
"name": "pipeSmallDia",
"start": 282,
"type": "Identifier"
},
"init": {
"end": 300,
"raw": ".75",
"start": 297,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.75,
"suffix": "None"
}
},
"start": 282,
"type": "VariableDeclarator"
},
"end": 300,
"kind": "const",
"start": 282,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 318,
"id": {
"end": 310,
"name": "thickness",
"start": 301,
"type": "Identifier"
},
"init": {
"end": 318,
"raw": "0.125",
"start": 313,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.125,
"suffix": "None"
}
},
"start": 301,
"type": "VariableDeclarator"
},
"end": 318,
"kind": "const",
"start": 301,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 343,
"id": {
"end": 338,
"name": "pipeTransitionAngle",
"start": 319,
"type": "Identifier"
},
"init": {
"end": 343,
"raw": "60",
"start": 341,
"type": "Literal",
"type": "Literal",
"value": {
"value": 60.0,
"suffix": "None"
}
},
"start": 319,
"type": "VariableDeclarator"
},
"end": 343,
"kind": "const",
"start": 319,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 370,
"id": {
"end": 364,
"name": "pipeTransitionLength",
"start": 344,
"type": "Identifier"
},
"init": {
"end": 370,
"raw": "0.5",
"start": 367,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.5,
"suffix": "None"
}
},
"start": 344,
"type": "VariableDeclarator"
},
"end": 370,
"kind": "const",
"start": 344,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 451,
"id": {
"end": 389,
"name": "pipeSmallDiaLength",
"start": 371,
"type": "Identifier"
},
"init": {
"end": 451,
"left": {
"end": 430,
"left": {
"end": 407,
"name": "pipeTotalLength",
"start": 392,
"type": "Identifier",
"type": "Identifier"
},
"operator": "-",
"right": {
"end": 430,
"name": "pipeTransitionLength",
"start": 410,
"type": "Identifier",
"type": "Identifier"
},
"start": 392,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"operator": "-",
"right": {
"end": 451,
"name": "pipeLargeDiaLength",
"start": 433,
"type": "Identifier",
"type": "Identifier"
},
"start": 392,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 371,
"type": "VariableDeclarator"
},
"end": 451,
"kind": "const",
"start": 371,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 1131,
"id": {
"end": 602,
"name": "pipeSketch",
"start": 592,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 623,
"raw": "'XY'",
"start": 619,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 618,
"name": "startSketchOn",
"start": 605,
"type": "Identifier"
},
"end": 624,
"start": 605,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 675,
"left": {
"end": 658,
"name": "pipeSmallDia",
"start": 646,
"type": "Identifier",
"type": "Identifier"
},
"operator": "-",
"right": {
"end": 675,
"left": {
"end": 671,
"name": "thickness",
"start": 662,
"type": "Identifier",
"type": "Identifier"
},
"operator": "/",
"right": {
"end": 675,
"raw": "2",
"start": 674,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 662,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 646,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"end": 680,
"raw": "38",
"start": 678,
"type": "Literal",
"type": "Literal",
"value": {
"value": 38.0,
"suffix": "None"
}
}
],
"end": 681,
"start": 645,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 684,
"start": 683,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 644,
"name": "startProfileAt",
"start": 630,
"type": "Identifier"
},
"end": 685,
"start": 630,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 699,
"name": "end",
"start": 696,
"type": "Identifier"
},
"arg": {
"elements": [
{
"end": 712,
"name": "thickness",
"start": 703,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 715,
"raw": "0",
"start": 714,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
],
"end": 716,
"start": 702,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 695,
"name": "line",
"start": 691,
"type": "Identifier"
},
"end": 717,
"start": 691,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 731,
"name": "end",
"start": 728,
"type": "Identifier"
},
"arg": {
"elements": [
{
"end": 736,
"raw": "0",
"start": 735,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"argument": {
"end": 757,
"name": "pipeSmallDiaLength",
"start": 739,
"type": "Identifier",
"type": "Identifier"
},
"end": 757,
"operator": "-",
"start": 738,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 758,
"start": 734,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 727,
"name": "line",
"start": 723,
"type": "Identifier"
},
"end": 759,
"start": 723,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 789,
"name": "angle",
"start": 784,
"type": "Identifier"
},
"arg": {
"argument": {
"end": 795,
"raw": "60",
"start": 793,
"type": "Literal",
"type": "Literal",
"value": {
"value": 60.0,
"suffix": "None"
}
},
"end": 795,
"operator": "-",
"start": 792,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
},
{
"type": "LabeledArg",
"label": {
"end": 811,
"name": "lengthY",
"start": 804,
"type": "Identifier"
},
"arg": {
"end": 834,
"name": "pipeTransitionLength",
"start": 814,
"type": "Identifier",
"type": "Identifier"
}
}
],
"callee": {
"end": 775,
"name": "angledLine",
"start": 765,
"type": "Identifier"
},
"end": 841,
"start": 765,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 855,
"name": "end",
"start": 852,
"type": "Identifier"
},
"arg": {
"elements": [
{
"end": 860,
"raw": "0",
"start": 859,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"argument": {
"end": 881,
"name": "pipeLargeDiaLength",
"start": 863,
"type": "Identifier",
"type": "Identifier"
},
"end": 881,
"operator": "-",
"start": 862,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 882,
"start": 858,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 851,
"name": "line",
"start": 847,
"type": "Identifier"
},
"end": 883,
"start": 847,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 901,
"name": "length",
"start": 895,
"type": "Identifier"
},
"arg": {
"argument": {
"end": 914,
"name": "thickness",
"start": 905,
"type": "Identifier",
"type": "Identifier"
},
"end": 914,
"operator": "-",
"start": 904,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
}
],
"callee": {
"end": 894,
"name": "xLine",
"start": 889,
"type": "Identifier"
},
"end": 915,
"start": 889,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 929,
"name": "end",
"start": 926,
"type": "Identifier"
},
"arg": {
"elements": [
{
"end": 934,
"raw": "0",
"start": 933,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"end": 954,
"name": "pipeLargeDiaLength",
"start": 936,
"type": "Identifier",
"type": "Identifier"
}
],
"end": 955,
"start": 932,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 925,
"name": "line",
"start": 921,
"type": "Identifier"
},
"end": 956,
"start": 921,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 986,
"name": "angle",
"start": 981,
"type": "Identifier"
},
"arg": {
"end": 1015,
"left": {
"argument": {
"end": 1009,
"name": "pipeTransitionAngle",
"start": 990,
"type": "Identifier",
"type": "Identifier"
},
"end": 1009,
"operator": "-",
"start": 989,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
"operator": "+",
"right": {
"end": 1015,
"raw": "180",
"start": 1012,
"type": "Literal",
"type": "Literal",
"value": {
"value": 180.0,
"suffix": "None"
}
},
"start": 989,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"type": "LabeledArg",
"label": {
"end": 1036,
"name": "endAbsoluteX",
"start": 1024,
"type": "Identifier"
},
"arg": {
"end": 1068,
"left": {
"end": 1051,
"name": "pipeSmallDia",
"start": 1039,
"type": "Identifier",
"type": "Identifier"
},
"operator": "-",
"right": {
"end": 1068,
"left": {
"end": 1064,
"name": "thickness",
"start": 1055,
"type": "Identifier",
"type": "Identifier"
},
"operator": "/",
"right": {
"end": 1068,
"raw": "2",
"start": 1067,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 1055,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 1039,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
}
],
"callee": {
"end": 972,
"name": "angledLine",
"start": 962,
"type": "Identifier"
},
"end": 1076,
"start": 962,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [],
"callee": {
"end": 1087,
"name": "close",
"start": 1082,
"type": "Identifier"
},
"end": 1089,
"start": 1082,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 1131,
"nonCodeMeta": {
"nonCodeNodes": {
"9": [
{
"end": 1131,
"start": 1089,
"type": "NonCodeNode",
"value": {
"type": "newLineBlockComment",
"value": "Revolve the sketch to create the pipe",
"style": "line"
}
}
]
},
"startNodes": []
},
"start": 605,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 592,
"type": "VariableDeclarator"
},
"end": 1131,
"kind": "const",
"start": 592,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 1174,
"id": {
"end": 1136,
"name": "pipe",
"start": 1132,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 1161,
"properties": [
{
"end": 1159,
"key": {
"end": 1153,
"name": "axis",
"start": 1149,
"type": "Identifier"
},
"start": 1149,
"type": "ObjectProperty",
"value": {
"end": 1159,
"raw": "'y'",
"start": 1156,
"type": "Literal",
"type": "Literal",
"value": "y"
}
}
],
"start": 1147,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 1173,
"name": "pipeSketch",
"start": 1163,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 1146,
"name": "revolve",
"start": 1139,
"type": "Identifier"
},
"end": 1174,
"start": 1139,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 1132,
"type": "VariableDeclarator"
},
"end": 1174,
"kind": "const",
"start": 1132,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 1175,
"innerAttrs": [
{
"end": 199,
"name": {
"end": 175,
"name": "settings",
"start": 167,
"type": "Identifier"
},
"properties": [
{
"end": 198,
"key": {
"end": 193,
"name": "defaultLengthUnit",
"start": 176,
"type": "Identifier"
},
"start": 176,
"type": "ObjectProperty",
"value": {
"end": 198,
"name": "in",
"start": 196,
"type": "Identifier",
"type": "Identifier"
}
}
],
"start": 166,
"type": "Annotation"
}
],
"nonCodeMeta": {
"nonCodeNodes": {
"7": [
{
"end": 591,
"start": 451,
"type": "NonCodeNode",
"value": {
"type": "newLineBlockComment",
"value": "Create the sketch to be revolved around the y-axis. Use the small diameter, large diameter, length, and thickness to define the sketch.",
"style": "line"
}
}
]
},
"startNodes": [
{
"end": 7,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "blockComment",
"value": "Pipe",
"style": "line"
}
},
{
"end": 151,
"start": 8,
"type": "NonCodeNode",
"value": {
"type": "blockComment",
"value": "A tubular section or hollow cylinder, usually but not necessarily of circular cross-section, used mainly to convey substances that can flow.",
"style": "line"
}
},
{
"end": 153,
"start": 151,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
},
{
"end": 165,
"start": 153,
"type": "NonCodeNode",
"value": {
"type": "blockComment",
"value": "Set Units",
"style": "line"
}
},
{
"end": 201,
"start": 199,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
},
{
"end": 220,
"start": 201,
"type": "NonCodeNode",
"value": {
"type": "blockComment",
"value": "Define constants",
"style": "line"
}
}
]
},
"start": 0
}
}