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

909 lines
27 KiB
Plaintext

---
source: kcl-lib/src/simulation_tests.rs
description: Result of parsing riddle_small.kcl
---
{
"Ok": {
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 0,
"id": {
"commentStart": 0,
"end": 0,
"name": "ANSWER",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 9,
"end": 0,
"raw": "41803",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 41803.0,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 14,
"declaration": {
"commentStart": 19,
"end": 0,
"id": {
"commentStart": 19,
"end": 0,
"name": "t",
"start": 0,
"type": "Identifier"
},
"init": {
"body": {
"body": [
{
"argument": {
"commentStart": 36,
"end": 0,
"left": {
"commentStart": 36,
"end": 0,
"left": {
"commentStart": 36,
"end": 0,
"left": {
"abs_path": false,
"commentStart": 36,
"end": 0,
"name": {
"commentStart": 36,
"end": 0,
"name": "ANSWER",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"operator": "*",
"right": {
"abs_path": false,
"commentStart": 45,
"end": 0,
"name": {
"commentStart": 45,
"end": 0,
"name": "s",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"operator": "+",
"right": {
"commentStart": 49,
"end": 0,
"raw": "12345",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 12345.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"operator": "%",
"right": {
"commentStart": 58,
"end": 0,
"raw": "214748",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 214748.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"commentStart": 28,
"end": 0,
"start": 0,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"commentStart": 24,
"end": 0,
"start": 0
},
"commentStart": 20,
"end": 0,
"params": [
{
"type": "Parameter",
"identifier": {
"commentStart": 21,
"end": 0,
"name": "s",
"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": 66,
"declaration": {
"commentStart": 68,
"end": 0,
"id": {
"commentStart": 68,
"end": 0,
"name": "xs",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 73,
"end": 0,
"raw": "205804",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 205804.0,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 80,
"declaration": {
"commentStart": 80,
"end": 0,
"id": {
"commentStart": 80,
"end": 0,
"name": "ys",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 85,
"end": 0,
"raw": "71816",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 71816.0,
"suffix": "None"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 91,
"declaration": {
"commentStart": 91,
"end": 0,
"id": {
"commentStart": 91,
"end": 0,
"name": "ox",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 96,
"end": 0,
"left": {
"commentStart": 96,
"end": 0,
"raw": "35",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 35.0,
"suffix": "None"
}
},
"operator": "-",
"right": {
"commentStart": 102,
"end": 0,
"left": {
"arguments": [
{
"abs_path": false,
"commentStart": 104,
"end": 0,
"name": {
"commentStart": 104,
"end": 0,
"name": "xs",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
],
"callee": {
"abs_path": false,
"commentStart": 102,
"end": 0,
"name": {
"commentStart": 102,
"end": 0,
"name": "t",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 102,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"operator": "%",
"right": {
"commentStart": 110,
"end": 0,
"raw": "70",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 70.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 114,
"declaration": {
"commentStart": 114,
"end": 0,
"id": {
"commentStart": 114,
"end": 0,
"name": "oy",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 119,
"end": 0,
"left": {
"commentStart": 119,
"end": 0,
"raw": "35",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 35.0,
"suffix": "None"
}
},
"operator": "-",
"right": {
"commentStart": 125,
"end": 0,
"left": {
"arguments": [
{
"abs_path": false,
"commentStart": 127,
"end": 0,
"name": {
"commentStart": 127,
"end": 0,
"name": "ys",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
],
"callee": {
"abs_path": false,
"commentStart": 125,
"end": 0,
"name": {
"commentStart": 125,
"end": 0,
"name": "t",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 125,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
"operator": "%",
"right": {
"commentStart": 133,
"end": 0,
"raw": "70",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 70.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 0,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"commentStart": 137,
"declaration": {
"commentStart": 137,
"end": 0,
"id": {
"commentStart": 137,
"end": 0,
"name": "r",
"start": 0,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"commentStart": 155,
"end": 0,
"raw": "'XZ'",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "XZ"
}
],
"callee": {
"abs_path": false,
"commentStart": 141,
"end": 0,
"name": {
"commentStart": 141,
"end": 0,
"name": "startSketchOn",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 141,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"commentStart": 181,
"elements": [
{
"abs_path": false,
"commentStart": 182,
"end": 0,
"name": {
"commentStart": 182,
"end": 0,
"name": "ox",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
},
{
"abs_path": false,
"commentStart": 186,
"end": 0,
"name": {
"commentStart": 186,
"end": 0,
"name": "oy",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
],
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"commentStart": 191,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"abs_path": false,
"commentStart": 166,
"end": 0,
"name": {
"commentStart": 166,
"end": 0,
"name": "startProfileAt",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 166,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 204,
"end": 0,
"name": "end",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 210,
"elements": [
{
"commentStart": 211,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
{
"commentStart": 214,
"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": 199,
"end": 0,
"name": {
"commentStart": 199,
"end": 0,
"name": "line",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 199,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 228,
"end": 0,
"name": "end",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 234,
"elements": [
{
"commentStart": 235,
"end": 0,
"raw": "0",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"argument": {
"commentStart": 239,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"commentStart": 238,
"end": 0,
"operator": "-",
"start": 0,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 0,
"start": 0,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"abs_path": false,
"commentStart": 223,
"end": 0,
"name": {
"commentStart": 223,
"end": 0,
"name": "line",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 223,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 253,
"end": 0,
"name": "end",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 259,
"elements": [
{
"argument": {
"commentStart": 261,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"commentStart": 260,
"end": 0,
"operator": "-",
"start": 0,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"commentStart": 264,
"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": 248,
"end": 0,
"name": {
"commentStart": 248,
"end": 0,
"name": "line",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 248,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"commentStart": 279,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"abs_path": false,
"commentStart": 273,
"end": 0,
"name": {
"commentStart": 273,
"end": 0,
"name": "close",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 273,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 295,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 304,
"end": 0,
"raw": "1",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
}
],
"callee": {
"abs_path": false,
"commentStart": 287,
"end": 0,
"name": {
"commentStart": 287,
"end": 0,
"name": "extrude",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name"
},
"commentStart": 287,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
}
],
"commentStart": 141,
"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": 14,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"1": [
{
"commentStart": 66,
"end": 0,
"start": 0,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 0
}
}