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

795 lines
24 KiB
Plaintext

---
source: kcl-lib/src/simulation_tests.rs
description: Result of parsing i-beam.kcl
---
{
"Ok": {
"body": [
{
"commentStart": 143,
"declaration": {
"commentStart": 170,
"end": 0,
"id": {
"commentStart": 170,
"end": 0,
"name": "beamLength",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 183,
"end": 0,
"raw": "24",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 24.0,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"preComments": [
"// Define Beam Dimensions"
],
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 186,
"declaration": {
"commentStart": 186,
"end": 0,
"id": {
"commentStart": 186,
"end": 0,
"name": "beamWidth",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 198,
"end": 0,
"raw": "2.663",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.663,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 204,
"declaration": {
"commentStart": 204,
"end": 0,
"id": {
"commentStart": 204,
"end": 0,
"name": "beamHeight",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 217,
"end": 0,
"raw": "4",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 219,
"declaration": {
"commentStart": 219,
"end": 0,
"id": {
"commentStart": 219,
"end": 0,
"name": "wallThickness",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 235,
"end": 0,
"raw": "0.293",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.293,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 240,
"declaration": {
"commentStart": 367,
"end": 0,
"id": {
"commentStart": 367,
"end": 0,
"name": "sketch001",
"start": 0,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"commentStart": 393,
"end": 0,
"raw": "'-XZ'",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "-XZ"
}
],
"callee": {
"abs_path": false,
"commentStart": 379,
"end": 0,
"name": {
"commentStart": 379,
"end": 0,
"name": "startSketchOn",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 379,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"commentStart": 420,
"elements": [
{
"commentStart": 421,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"commentStart": 424,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 424,
"end": 0,
"name": {
"commentStart": 424,
"end": 0,
"name": "beamHeight",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "/",
"right": {
"commentStart": 435,
"end": 0,
"raw": "2",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"commentStart": 439,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"abs_path": false,
"commentStart": 405,
"end": 0,
"name": {
"commentStart": 405,
"end": 0,
"name": "startProfileAt",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 405,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 453,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 462,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 462,
"end": 0,
"name": {
"commentStart": 462,
"end": 0,
"name": "beamWidth",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "/",
"right": {
"commentStart": 472,
"end": 0,
"raw": "2",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 447,
"end": 0,
"name": {
"commentStart": 447,
"end": 0,
"name": "xLine",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 447,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 486,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"arg": {
"argument": {
"abs_path": false,
"commentStart": 496,
"end": 0,
"name": {
"commentStart": 496,
"end": 0,
"name": "wallThickness",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"commentStart": 495,
"end": 0,
"operator": "-",
"start": 0,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 480,
"end": 0,
"name": {
"commentStart": 480,
"end": 0,
"name": "yLine",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 480,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 522,
"end": 0,
"name": "endAbsolute",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 536,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 536,
"end": 0,
"name": {
"commentStart": 536,
"end": 0,
"name": "wallThickness",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "/",
"right": {
"commentStart": 550,
"end": 0,
"raw": "2",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 516,
"end": 0,
"name": {
"commentStart": 516,
"end": 0,
"name": "xLine",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 516,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 564,
"end": 0,
"name": "endAbsolute",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 578,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
}
],
"callee": {
"abs_path": false,
"commentStart": 558,
"end": 0,
"name": {
"commentStart": 558,
"end": 0,
"name": "yLine",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 558,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"commentStart": 595,
"end": 0,
"properties": [
{
"commentStart": 597,
"end": 0,
"key": {
"commentStart": 597,
"end": 0,
"name": "axis",
"start": 0,
"type": "Identifier"
},
"start": 0,
"type": "ObjectProperty",
"value": {
"commentStart": 604,
"end": 0,
"raw": "'X'",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "X"
}
}
],
"start": 0,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"commentStart": 611,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"abs_path": false,
"commentStart": 586,
"end": 0,
"name": {
"commentStart": 586,
"end": 0,
"name": "mirror2d",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 586,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"commentStart": 628,
"end": 0,
"properties": [
{
"commentStart": 630,
"end": 0,
"key": {
"commentStart": 630,
"end": 0,
"name": "axis",
"start": 0,
"type": "Identifier"
},
"start": 0,
"type": "ObjectProperty",
"value": {
"commentStart": 637,
"end": 0,
"raw": "'Y'",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "Y"
}
}
],
"start": 0,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"commentStart": 644,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"abs_path": false,
"commentStart": 619,
"end": 0,
"name": {
"commentStart": 619,
"end": 0,
"name": "mirror2d",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 619,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 660,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"arg": {
"abs_path": false,
"commentStart": 669,
"end": 0,
"name": {
"commentStart": 669,
"end": 0,
"name": "beamLength",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 652,
"end": 0,
"name": {
"commentStart": 652,
"end": 0,
"name": "extrude",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 652,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
}
],
"commentStart": 379,
"end": 0,
"start": 0,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"preComments": [
"",
"",
"// Sketch a quadrant of the beam cross section, then mirror for symmetry across each axis. Extrude to the appropriate length"
],
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 0,
"innerAttrs": [
{
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 111,
"end": 0,
"name": "settings",
"start": 0,
"type": "Identifier"
},
"preComments": [
"// I-beam",
"// A structural metal beam with an I shaped cross section. Often used in construction",
"",
"",
"// Set Units"
],
"properties": [
{
"commentStart": 120,
"end": 0,
"key": {
"commentStart": 120,
"end": 0,
"name": "defaultLengthUnit",
"start": 0,
"type": "Identifier"
},
"start": 0,
"type": "ObjectProperty",
"value": {
"abs_path": false,
"commentStart": 140,
"end": 0,
"name": {
"commentStart": 140,
"end": 0,
"name": "in",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
}
],
"start": 0,
"type": "Annotation"
}
],
"nonCodeMeta": {
"nonCodeNodes": {},
"startNodes": [
{
"commentStart": 143,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"start": 0
}
}