Support comments on attributes (#5850)

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-03-20 16:23:20 +13:00
committed by GitHub
parent 79be72c5f0
commit 461a2c3ab2
319 changed files with 37650 additions and 4752 deletions

View File

@ -184,7 +184,6 @@ example = extrude(exampleSketch, length = 1)
```js
// Color the result of a sweep.
// Create a path for the sweep.
sweepPath = startSketchOn('XZ')
|> startProfileAt([0.05, 0.05], %)

View File

@ -52,7 +52,6 @@ fn sum(arr):
sumSoFar = add(sumSoFar, i)
return sumSoFar */
// We use `assertEqual` to check that our `sum` function gives the
// expected result. It's good to check your work!
assertEqual(sum([1, 2, 3]), 6, 0.00001, "1 + 2 + 3 summed is 6")
@ -114,7 +113,6 @@ fn decagon(radius):
fullDecagon = partialDecagon // it's now full
return fullDecagon */
// Use the `decagon` function declared above, to sketch a decagon with radius 5.
decagon(5.0)
|> close()

View File

@ -57,7 +57,6 @@ rotate(
```js
// Rotate a pipe with roll, pitch, and yaw.
// Create a path for the sweep.
sweepPath = startSketchOn('XZ')
|> startProfileAt([0.05, 0.05], %)
@ -83,7 +82,6 @@ sweepSketch = startSketchOn('XY')
```js
// Rotate a pipe about an axis with an angle.
// Create a path for the sweep.
sweepPath = startSketchOn('XZ')
|> startProfileAt([0.05, 0.05], %)

View File

@ -37,7 +37,6 @@ scale(
```js
// Scale a pipe.
// Create a path for the sweep.
sweepPath = startSketchOn('XZ')
|> startProfileAt([0.05, 0.05], %)

View File

@ -41312,7 +41312,7 @@
"// Setting the appearance of a 3D pattern can be done _before_ or _after_ the pattern.\n// This example shows _before_ the pattern.\nexampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 2])\n |> line(end = [3, 1])\n |> line(end = [0, -4])\n |> close()\n\nexample = extrude(exampleSketch, length = 1)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)\n |> patternLinear3d(axis = [1, 0, 1], instances = 7, distance = 6)",
"// Setting the appearance of a 3D pattern can be done _before_ or _after_ the pattern.\n// This example shows _after_ the pattern.\nexampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(end = [0, 2])\n |> line(end = [3, 1])\n |> line(end = [0, -4])\n |> close()\n\nexample = extrude(exampleSketch, length = 1)\n |> patternLinear3d(axis = [1, 0, 1], instances = 7, distance = 6)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)",
"// Color the result of a 2D pattern that was extruded.\nexampleSketch = startSketchOn('XZ')\n |> startProfileAt([.5, 25], %)\n |> line(end = [0, 5])\n |> line(end = [-1, 0])\n |> line(end = [0, -5])\n |> close()\n |> patternCircular2d(\n center = [0, 0],\n instances = 13,\n arcDegrees = 360,\n rotateDuplicates = true,\n )\n\nexample = extrude(exampleSketch, length = 1)\n |> appearance(color = '#ff0000', metalness = 90, roughness = 90)",
"// Color the result of a sweep.\n\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\npipeHole = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)\n |> appearance(color = \"#ff0000\", metalness = 50, roughness = 50)"
"// Color the result of a sweep.\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\npipeHole = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)\n |> appearance(color = \"#ff0000\", metalness = 50, roughness = 50)"
]
},
{
@ -246617,9 +246617,9 @@
"unpublished": false,
"deprecated": false,
"examples": [
"// This function adds two numbers.\nfn add(a, b) {\n return a + b\n}\n\n// This function adds an array of numbers.\n// It uses the `reduce` function, to call the `add` function on every\n// element of the `arr` parameter. The starting value is 0.\nfn sum(arr) {\n return reduce(arr, 0, add)\n}\n\n/* The above is basically like this pseudo-code:\nfn sum(arr):\n sumSoFar = 0\n for i in arr:\n sumSoFar = add(sumSoFar, i)\n return sumSoFar */\n\n\n// We use `assertEqual` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassertEqual(sum([1, 2, 3]), 6, 0.00001, \"1 + 2 + 3 summed is 6\")",
"// This function adds two numbers.\nfn add(a, b) {\n return a + b\n}\n\n// This function adds an array of numbers.\n// It uses the `reduce` function, to call the `add` function on every\n// element of the `arr` parameter. The starting value is 0.\nfn sum(arr) {\n return reduce(arr, 0, add)\n}\n\n/* The above is basically like this pseudo-code:\nfn sum(arr):\n sumSoFar = 0\n for i in arr:\n sumSoFar = add(sumSoFar, i)\n return sumSoFar */\n\n// We use `assertEqual` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassertEqual(sum([1, 2, 3]), 6, 0.00001, \"1 + 2 + 3 summed is 6\")",
"// This example works just like the previous example above, but it uses\n// an anonymous `add` function as its parameter, instead of declaring a\n// named function outside.\narr = [1, 2, 3]\nsum = reduce(arr, 0, fn(i, result_so_far) {\n return i + result_so_far\n})\n\n// We use `assertEqual` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassertEqual(sum, 6, 0.00001, \"1 + 2 + 3 summed is 6\")",
"// Declare a function that sketches a decagon.\nfn decagon(radius) {\n // Each side of the decagon is turned this many degrees from the previous angle.\n stepAngle = 1 / 10 * TAU\n\n // Start the decagon sketch at this point.\n startOfDecagonSketch = startSketchOn('XY')\n |> startProfileAt([cos(0) * radius, sin(0) * radius], %)\n\n // Use a `reduce` to draw the remaining decagon sides.\n // For each number in the array 1..10, run the given function,\n // which takes a partially-sketched decagon and adds one more edge to it.\n fullDecagon = reduce([1..10], startOfDecagonSketch, fn(i, partialDecagon) {\n // Draw one edge of the decagon.\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n return line(partialDecagon, end = [x, y])\n })\n\n return fullDecagon\n}\n\n/* The `decagon` above is basically like this pseudo-code:\nfn decagon(radius):\n stepAngle = (1/10) * TAU\n plane = startSketchOn('XY')\n startOfDecagonSketch = startProfileAt([(cos(0)*radius), (sin(0) * radius)], plane)\n\n // Here's the reduce part.\n partialDecagon = startOfDecagonSketch\n for i in [1..10]:\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n partialDecagon = line(partialDecagon, end = [x, y])\n fullDecagon = partialDecagon // it's now full\n return fullDecagon */\n\n\n// Use the `decagon` function declared above, to sketch a decagon with radius 5.\ndecagon(5.0)\n |> close()"
"// Declare a function that sketches a decagon.\nfn decagon(radius) {\n // Each side of the decagon is turned this many degrees from the previous angle.\n stepAngle = 1 / 10 * TAU\n\n // Start the decagon sketch at this point.\n startOfDecagonSketch = startSketchOn('XY')\n |> startProfileAt([cos(0) * radius, sin(0) * radius], %)\n\n // Use a `reduce` to draw the remaining decagon sides.\n // For each number in the array 1..10, run the given function,\n // which takes a partially-sketched decagon and adds one more edge to it.\n fullDecagon = reduce([1..10], startOfDecagonSketch, fn(i, partialDecagon) {\n // Draw one edge of the decagon.\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n return line(partialDecagon, end = [x, y])\n })\n\n return fullDecagon\n}\n\n/* The `decagon` above is basically like this pseudo-code:\nfn decagon(radius):\n stepAngle = (1/10) * TAU\n plane = startSketchOn('XY')\n startOfDecagonSketch = startProfileAt([(cos(0)*radius), (sin(0) * radius)], plane)\n\n // Here's the reduce part.\n partialDecagon = startOfDecagonSketch\n for i in [1..10]:\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n partialDecagon = line(partialDecagon, end = [x, y])\n fullDecagon = partialDecagon // it's now full\n return fullDecagon */\n\n// Use the `decagon` function declared above, to sketch a decagon with radius 5.\ndecagon(5.0)\n |> close()"
]
},
{
@ -271286,8 +271286,8 @@
"unpublished": false,
"deprecated": false,
"examples": [
"// Rotate a pipe with roll, pitch, and yaw.\n\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)\n |> rotate(roll = 10, pitch = 10, yaw = 90)",
"// Rotate a pipe about an axis with an angle.\n\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)\n |> rotate(axis = [0, 0, 1.0], angle = 90)",
"// Rotate a pipe with roll, pitch, and yaw.\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)\n |> rotate(roll = 10, pitch = 10, yaw = 90)",
"// Rotate a pipe about an axis with an angle.\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)\n |> rotate(axis = [0, 0, 1.0], angle = 90)",
"// Rotate an imported model.\n\n\nimport \"tests/inputs/cube.sldprt\" as cube\n\ncube\n |> rotate(axis = [0, 0, 1.0], angle = 90)",
"// Sweep two sketches along the same path.\n\n\nsketch001 = startSketchOn('XY')\nrectangleSketch = startProfileAt([-200, 23.86], sketch001)\n |> angledLine([0, 73.47], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 50.61\n ], %)\n |> angledLine([\n segAng(rectangleSegmentA001),\n -segLen(rectangleSegmentA001)\n ], %)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)\n\nsketch002 = startSketchOn('YZ')\nsweepPath = startProfileAt([0, 0], sketch002)\n |> yLine(length = 231.81)\n |> tangentialArc({ radius = 80, offset = -90 }, %)\n |> xLine(length = 384.93)\n\nparts = sweep([rectangleSketch, circleSketch], path = sweepPath)\n\n// Rotate the sweeps.\nrotate(parts, axis = [0, 0, 1.0], angle = 90)",
"// Translate and rotate a sketch to create a loft.\nsketch001 = startSketchOn('XY')\n\nfn square() {\n return startProfileAt([-10, 10], sketch001)\n |> xLine(length = 20)\n |> yLine(length = -20)\n |> xLine(length = -20)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n}\n\nprofile001 = square()\n\nprofile002 = square()\n |> translate(translate = [0, 0, 20])\n |> rotate(axis = [0, 0, 1.0], angle = 45)\n\nloft([profile001, profile002])"
@ -277877,7 +277877,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"// Scale a pipe.\n\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)\n |> scale(scale = [1.0, 1.0, 2.5])",
"// Scale a pipe.\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)\n |> scale(scale = [1.0, 1.0, 2.5])",
"// Scale an imported model.\n\n\nimport \"tests/inputs/cube.sldprt\" as cube\n\ncube\n |> scale(scale = [1.0, 1.0, 2.5])",
"// Sweep two sketches along the same path.\n\n\nsketch001 = startSketchOn('XY')\nrectangleSketch = startProfileAt([-200, 23.86], sketch001)\n |> angledLine([0, 73.47], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 50.61\n ], %)\n |> angledLine([\n segAng(rectangleSegmentA001),\n -segLen(rectangleSegmentA001)\n ], %)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)\n\nsketch002 = startSketchOn('YZ')\nsweepPath = startProfileAt([0, 0], sketch002)\n |> yLine(length = 231.81)\n |> tangentialArc({ radius = 80, offset = -90 }, %)\n |> xLine(length = 384.93)\n\nparts = sweep([rectangleSketch, circleSketch], path = sweepPath)\n\n// Scale the sweep.\nscale(parts, scale = [1.0, 1.0, 0.5])"
]
@ -311369,8 +311369,8 @@
"unpublished": false,
"deprecated": false,
"examples": [
"// Create a pipe using a sweep.\n\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)",
"// Create a spring by sweeping around a helix path.\n\n\n// Create a helix around the Z axis.\nhelixPath = helix(\n angleStart = 0,\n ccw = true,\n revolutions = 4,\n length = 10,\n radius = 5,\n axis = 'Z',\n)\n\n// Create a spring by sweeping around the helix path.\nspringSketch = startSketchOn('YZ')\n |> circle(center = [0, 0], radius = 1)\n |> sweep(path = helixPath)",
"// Create a pipe using a sweep.\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)",
"// Create a spring by sweeping around a helix path.\n\n// Create a helix around the Z axis.\nhelixPath = helix(\n angleStart = 0,\n ccw = true,\n revolutions = 4,\n length = 10,\n radius = 5,\n axis = 'Z',\n)\n\n// Create a spring by sweeping around the helix path.\nspringSketch = startSketchOn('YZ')\n |> circle(center = [0, 0], radius = 1)\n |> sweep(path = helixPath)",
"// Sweep two sketches along the same path.\n\n\nsketch001 = startSketchOn('XY')\nrectangleSketch = startProfileAt([-200, 23.86], sketch001)\n |> angledLine([0, 73.47], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 50.61\n ], %)\n |> angledLine([\n segAng(rectangleSegmentA001),\n -segLen(rectangleSegmentA001)\n ], %)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)\n\nsketch002 = startSketchOn('YZ')\nsweepPath = startProfileAt([0, 0], sketch002)\n |> yLine(length = 231.81)\n |> tangentialArc({ radius = 80, offset = -90 }, %)\n |> xLine(length = 384.93)\n\nsweep([rectangleSketch, circleSketch], path = sweepPath)"
]
},
@ -332924,7 +332924,7 @@
"unpublished": false,
"deprecated": false,
"examples": [
"// Move a pipe.\n\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)\n |> translate(translate = [1.0, 1.0, 2.5])",
"// Move a pipe.\n\n// Create a path for the sweep.\nsweepPath = startSketchOn('XZ')\n |> startProfileAt([0.05, 0.05], %)\n |> line(end = [0, 7])\n |> tangentialArc({ offset = 90, radius = 5 }, %)\n |> line(end = [-3, 0])\n |> tangentialArc({ offset = -90, radius = 5 }, %)\n |> line(end = [0, 7])\n\n// Create a hole for the pipe.\npipeHole = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 1.5)\n\nsweepSketch = startSketchOn('XY')\n |> circle(center = [0, 0], radius = 2)\n |> hole(pipeHole, %)\n |> sweep(path = sweepPath)\n |> translate(translate = [1.0, 1.0, 2.5])",
"// Move an imported model.\n\n\nimport \"tests/inputs/cube.sldprt\" as cube\n\ncube\n |> translate(translate = [1.0, 1.0, 2.5])",
"// Sweep two sketches along the same path.\n\n\nsketch001 = startSketchOn('XY')\nrectangleSketch = startProfileAt([-200, 23.86], sketch001)\n |> angledLine([0, 73.47], %, $rectangleSegmentA001)\n |> angledLine([\n segAng(rectangleSegmentA001) - 90,\n 50.61\n ], %)\n |> angledLine([\n segAng(rectangleSegmentA001),\n -segLen(rectangleSegmentA001)\n ], %)\n |> line(endAbsolute = [profileStartX(%), profileStartY(%)])\n |> close()\n\ncircleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)\n\nsketch002 = startSketchOn('YZ')\nsweepPath = startProfileAt([0, 0], sketch002)\n |> yLine(length = 231.81)\n |> tangentialArc({ radius = 80, offset = -90 }, %)\n |> xLine(length = 384.93)\n\nparts = sweep([rectangleSketch, circleSketch], path = sweepPath)\n\n// Move the sweeps.\ntranslate(parts, translate = [1.0, 1.0, 2.5])",
"// Move a sketch.\n\n\nfn square(length) {\n l = length / 2\n p0 = [-l, -l]\n p1 = [-l, l]\n p2 = [l, l]\n p3 = [l, -l]\n\n return startSketchOn(XY)\n |> startProfileAt(p0, %)\n |> line(endAbsolute = p1)\n |> line(endAbsolute = p2)\n |> line(endAbsolute = p3)\n |> close()\n}\n\nsquare(10)\n |> translate(translate = [5, 5, 0])\n |> extrude(length = 10)",

View File

@ -43,7 +43,6 @@ sweep(
```js
// Create a pipe using a sweep.
// Create a path for the sweep.
sweepPath = startSketchOn('XZ')
|> startProfileAt([0.05, 0.05], %)
@ -68,7 +67,6 @@ sweepSketch = startSketchOn('XY')
```js
// Create a spring by sweeping around a helix path.
// Create a helix around the Z axis.
helixPath = helix(
angleStart = 0,

View File

@ -35,7 +35,6 @@ translate(
```js
// Move a pipe.
// Create a path for the sweep.
sweepPath = startSketchOn('XZ')
|> startProfileAt([0.05, 0.05], %)

View File

@ -8,7 +8,7 @@ use tower_lsp::lsp_types::{
use crate::{
execution::annotations,
parsing::{
ast::types::{Annotation, Node, NonCodeNode, NonCodeValue, VariableKind},
ast::types::{Annotation, Node, NonCodeNode, VariableKind},
token::NumericSuffix,
},
ModuleId,
@ -36,7 +36,7 @@ impl CollectionVisitor {
.unwrap();
self.id += 1;
for (i, n) in parsed.body.iter().enumerate() {
for n in &parsed.body {
match n {
crate::parsing::ast::types::BodyItem::ImportStatement(import) if !import.visibility.is_default() => {
// Only supports glob imports for now.
@ -63,12 +63,11 @@ impl CollectionVisitor {
VariableKind::Const => DocData::Const(ConstData::from_ast(var, qual_name)),
};
// FIXME this association of metadata with items is pretty flaky.
if i == 0 {
dd.with_meta(&parsed.non_code_meta.start_nodes, &var.outer_attrs);
} else if let Some(meta) = parsed.non_code_meta.non_code_nodes.get(&(i - 1)) {
dd.with_meta(meta, &var.outer_attrs);
dd.with_meta(&var.outer_attrs);
for a in &var.outer_attrs {
dd.with_comments(&a.pre_comments);
}
dd.with_comments(n.get_comments());
self.result.push(dd);
}
@ -80,12 +79,11 @@ impl CollectionVisitor {
};
let mut dd = DocData::Ty(TyData::from_ast(ty, qual_name));
// FIXME this association of metadata with items is pretty flaky.
if i == 0 {
dd.with_meta(&parsed.non_code_meta.start_nodes, &ty.outer_attrs);
} else if let Some(meta) = parsed.non_code_meta.non_code_nodes.get(&(i - 1)) {
dd.with_meta(meta, &ty.outer_attrs);
dd.with_meta(&ty.outer_attrs);
for a in &ty.outer_attrs {
dd.with_comments(&a.pre_comments);
}
dd.with_comments(n.get_comments());
self.result.push(dd);
}
@ -172,11 +170,19 @@ impl DocData {
}
}
fn with_meta(&mut self, meta: &[Node<NonCodeNode>], attrs: &[Node<Annotation>]) {
fn with_meta(&mut self, attrs: &[Node<Annotation>]) {
match self {
DocData::Fn(f) => f.with_meta(meta, attrs),
DocData::Const(c) => c.with_meta(meta, attrs),
DocData::Ty(t) => t.with_meta(meta, attrs),
DocData::Fn(f) => f.with_meta(attrs),
DocData::Const(c) => c.with_meta(attrs),
DocData::Ty(t) => t.with_meta(attrs),
}
}
fn with_comments(&mut self, comments: &[String]) {
match self {
DocData::Fn(f) => f.with_comments(comments),
DocData::Const(c) => c.with_comments(comments),
DocData::Ty(t) => t.with_comments(comments),
}
}
@ -640,55 +646,20 @@ trait ApplyMeta {
fn doc_hidden(&mut self, doc_hidden: bool);
fn impl_kind(&mut self, impl_kind: annotations::Impl);
fn with_meta(&mut self, meta: &[Node<NonCodeNode>], attrs: &[Node<Annotation>]) {
for attr in attrs {
if let Annotation {
name: None,
properties: Some(props),
..
} = &attr.inner
{
for p in props {
match &*p.key.name {
annotations::IMPL => {
if let Some(s) = p.value.ident_name() {
self.impl_kind(annotations::Impl::from_str(s).unwrap());
}
}
"deprecated" => {
if let Some(b) = p.value.literal_bool() {
self.deprecated(b);
}
}
"doc_hidden" => {
if let Some(b) = p.value.literal_bool() {
self.doc_hidden(b);
}
}
_ => {}
}
}
}
}
let mut comments = Vec::new();
for m in meta {
match &m.value {
NonCodeValue::BlockComment { value, .. } | NonCodeValue::NewLineBlockComment { value, .. } => {
comments.push(value)
}
_ => {}
}
fn with_comments(&mut self, comments: &[String]) {
if comments.iter().all(|s| s.is_empty()) {
return;
}
let mut summary = None;
let mut description = None;
let mut example: Option<(String, ExampleProperties)> = None;
let mut examples = Vec::new();
for l in comments.into_iter().filter(|l| l.starts_with('/')).map(|l| {
if let Some(ll) = l.strip_prefix("/ ") {
for l in comments.iter().filter(|l| l.starts_with("///")).map(|l| {
if let Some(ll) = l.strip_prefix("/// ") {
ll
} else {
&l[1..]
&l[3..]
}
}) {
if description.is_none() && summary.is_none() {
@ -763,6 +734,38 @@ trait ApplyMeta {
examples,
);
}
fn with_meta(&mut self, attrs: &[Node<Annotation>]) {
for attr in attrs {
if let Annotation {
name: None,
properties: Some(props),
..
} = &attr.inner
{
for p in props {
match &*p.key.name {
annotations::IMPL => {
if let Some(s) = p.value.ident_name() {
self.impl_kind(annotations::Impl::from_str(s).unwrap());
}
}
"deprecated" => {
if let Some(b) = p.value.literal_bool() {
self.deprecated(b);
}
}
"doc_hidden" => {
if let Some(b) = p.value.literal_bool() {
self.doc_hidden(b);
}
}
_ => {}
}
}
}
}
}
}
impl ApplyMeta for ConstData {

View File

@ -1714,7 +1714,6 @@ outsideRevolve = startSketchOn('XZ')
r#"// Ball Bearing
// A ball bearing is a type of rolling-element bearing that uses balls to maintain the separation between the bearing races. The primary purpose of a ball bearing is to reduce rotational friction and support radial and axial loads.
// Define constants like ball diameter, inside diameter, overhange length, and thickness
sphereDia = 0.5
insideDia = 1

View File

@ -53,6 +53,12 @@ pub struct Node<T> {
pub module_id: ModuleId,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub outer_attrs: NodeList<Annotation>,
// Some comments are kept here, some are kept in NonCodeMeta, and some are ignored. See how each
// node is parsed to check for certain. In any case, only comments which are strongly associated
// with an item are kept here.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub pre_comments: Vec<String>,
pub comment_start: usize,
}
impl<T: JsonSchema> schemars::JsonSchema for Node<T> {
@ -85,6 +91,20 @@ impl<T> Node<T> {
end,
module_id,
outer_attrs: Vec::new(),
pre_comments: Vec::new(),
comment_start: start,
}
}
pub fn new_node(start: usize, end: usize, module_id: ModuleId, inner: T) -> Self {
Self {
inner,
start,
end,
module_id,
outer_attrs: Vec::new(),
pre_comments: Vec::new(),
comment_start: start,
}
}
@ -95,6 +115,8 @@ impl<T> Node<T> {
end: 0,
module_id: ModuleId::default(),
outer_attrs: Vec::new(),
pre_comments: Vec::new(),
comment_start: 0,
}
}
@ -105,6 +127,8 @@ impl<T> Node<T> {
end,
module_id,
outer_attrs: Vec::new(),
pre_comments: Vec::new(),
comment_start: start,
})
}
@ -133,8 +157,15 @@ impl<T> Node<T> {
end: self.end,
module_id: self.module_id,
outer_attrs: self.outer_attrs,
pre_comments: self.pre_comments,
comment_start: self.comment_start,
}
}
pub fn set_comments(&mut self, comments: Vec<String>, start: usize) {
self.pre_comments = comments;
self.comment_start = start;
}
}
impl<T> Deref for Node<T> {
@ -373,6 +404,26 @@ impl Program {
if self.non_code_meta.in_comment(pos) {
return true;
}
for item in &self.body {
let r = item.comment_range();
eprintln!("item {r:?}");
if pos >= r.0 && pos < r.1 {
return true;
}
if pos < r.0 {
break;
}
}
for n in &self.inner_attrs {
if pos >= n.comment_start && pos < n.start {
return true;
}
if pos < n.comment_start {
break;
}
}
let item = self.get_body_item_for_position(pos);
// Recurse over the item.
@ -660,6 +711,36 @@ impl BodyItem {
BodyItem::ReturnStatement(node) => &mut node.outer_attrs,
}
}
pub(crate) fn set_comments(&mut self, comments: Vec<String>, start: usize) {
match self {
BodyItem::ImportStatement(node) => node.set_comments(comments, start),
BodyItem::ExpressionStatement(node) => node.set_comments(comments, start),
BodyItem::VariableDeclaration(node) => node.set_comments(comments, start),
BodyItem::TypeDeclaration(node) => node.set_comments(comments, start),
BodyItem::ReturnStatement(node) => node.set_comments(comments, start),
}
}
pub(crate) fn get_comments(&self) -> &[String] {
match self {
BodyItem::ImportStatement(node) => &node.pre_comments,
BodyItem::ExpressionStatement(node) => &node.pre_comments,
BodyItem::VariableDeclaration(node) => &node.pre_comments,
BodyItem::TypeDeclaration(node) => &node.pre_comments,
BodyItem::ReturnStatement(node) => &node.pre_comments,
}
}
pub(crate) fn comment_range(&self) -> (usize, usize) {
match self {
BodyItem::ImportStatement(node) => (node.comment_start, node.start),
BodyItem::ExpressionStatement(node) => (node.comment_start, node.start),
BodyItem::VariableDeclaration(node) => (node.comment_start, node.start),
BodyItem::TypeDeclaration(node) => (node.comment_start, node.start),
BodyItem::ReturnStatement(node) => (node.comment_start, node.start),
}
}
}
impl From<BodyItem> for SourceRange {
@ -1171,6 +1252,23 @@ pub enum CommentStyle {
Block,
}
impl CommentStyle {
pub fn render_comment(&self, comment: &str) -> String {
match self {
CommentStyle::Line => {
let comment = comment.trim();
let mut result = "//".to_owned();
if !comment.is_empty() && !comment.starts_with('/') {
result.push(' ');
}
result.push_str(comment);
result
}
CommentStyle::Block => format!("/* {comment} */"),
}
}
}
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
#[ts(export)]
#[serde(tag = "type", rename_all = "camelCase")]
@ -1186,7 +1284,7 @@ pub enum NonCodeValue {
},
/// A block comment.
/// An example of this is the following:
/// ```python,no_run
/// ```no_run
/// /* This is a
/// block comment */
/// 1 + 1
@ -3890,7 +3988,6 @@ startSketchOn('XY')"#;
formatted,
r#"@settings(defaultLengthUnit = mm)
startSketchOn('XY')
"#
);
@ -3925,6 +4022,7 @@ startSketchOn('XY')
assert_eq!(
formatted,
r#"@settings(defaultLengthUnit = mm)
startSketchOn('XY')
"#
);

View File

@ -300,16 +300,17 @@ fn annotation(i: &mut TokenSlice) -> PResult<Node<Annotation>> {
terminated(one_of((TokenType::Operator, "=")), opt(whitespace)),
expression,
)
.map(|(key, value)| Node {
start: key.start,
end: value.end(),
module_id: key.module_id,
inner: ObjectProperty {
key,
value,
digest: None,
},
outer_attrs: Vec::new(),
.map(|(key, value)| {
Node::new_node(
key.start,
value.end(),
key.module_id,
ObjectProperty {
key,
value,
digest: None,
},
)
}),
comma_sep,
)
@ -417,17 +418,16 @@ fn pipe_expression(i: &mut TokenSlice) -> PResult<Node<PipeExpression>> {
non_code_meta.insert(code_count, nc);
}
}
Ok(Node {
start: values.first().unwrap().start(),
end: values.last().unwrap().end().max(max_noncode_end),
module_id: values.first().unwrap().module_id(),
inner: PipeExpression {
Ok(Node::new_node(
values.first().unwrap().start(),
values.last().unwrap().end().max(max_noncode_end),
values.first().unwrap().module_id(),
PipeExpression {
body: values,
non_code_meta,
digest: None,
},
outer_attrs: Vec::new(),
})
))
}
fn bool_value(i: &mut TokenSlice) -> PResult<BoxNode<Literal>> {
@ -858,17 +858,16 @@ fn array_end_start(i: &mut TokenSlice) -> PResult<Node<ArrayRangeExpression>> {
fn object_property_same_key_and_val(i: &mut TokenSlice) -> PResult<Node<ObjectProperty>> {
let key = nameable_identifier.context(expected("the property's key (the name or identifier of the property), e.g. in 'height = 4', 'height' is the property key")).parse_next(i)?;
ignore_whitespace(i);
Ok(Node {
start: key.start,
end: key.end,
module_id: key.module_id,
inner: ObjectProperty {
Ok(Node::new_node(
key.start,
key.end,
key.module_id,
ObjectProperty {
value: Expr::Identifier(Box::new(key.clone())),
key,
digest: None,
},
outer_attrs: Vec::new(),
})
))
}
fn object_property(i: &mut TokenSlice) -> PResult<Node<ObjectProperty>> {
@ -899,17 +898,16 @@ fn object_property(i: &mut TokenSlice) -> PResult<Node<ObjectProperty>> {
}
};
let result = Node {
start: key.start,
end: expr.end(),
module_id: key.module_id,
inner: ObjectProperty {
let result = Node::new_node(
key.start,
expr.end(),
key.module_id,
ObjectProperty {
key,
value: expr,
digest: None,
},
outer_attrs: Vec::new(),
};
);
if sep.token_type == TokenType::Colon {
ParseContext::warn(
@ -1552,14 +1550,57 @@ fn function_body(i: &mut TokenSlice) -> PResult<Node<Program>> {
let mut inner_attrs = Vec::new();
let mut pending_attrs = Vec::new();
let mut non_code_meta = NonCodeMeta::default();
let mut pending_non_code: Vec<Node<NonCodeNode>> = Vec::new();
let mut end = 0;
let mut start = leading_whitespace_start;
macro_rules! handle_pending_non_code {
($node: ident) => {
if !pending_non_code.is_empty() {
let start = pending_non_code[0].start;
let force_disoc = matches!(
&pending_non_code.last().unwrap().inner.value,
NonCodeValue::NewLine
);
let mut comments = Vec::new();
for nc in pending_non_code {
match nc.inner.value {
NonCodeValue::BlockComment { value, style } if !force_disoc => {
comments.push(style.render_comment(&value));
}
NonCodeValue::NewLineBlockComment { value, style } if !force_disoc => {
if comments.is_empty() && nc.start != 0 {
comments.push(String::new());
comments.push(String::new());
}
comments.push(style.render_comment(&value));
}
NonCodeValue::NewLine if !force_disoc && !comments.is_empty() => {
comments.push(String::new());
comments.push(String::new());
}
_ => {
if body.is_empty() {
non_code_meta.start_nodes.push(nc);
} else {
non_code_meta.insert(body.len() - 1, nc);
}
}
}
}
$node.set_comments(comments, start);
pending_non_code = Vec::new();
}
};
}
for thing_in_body in things_within_body {
match thing_in_body {
WithinFunction::Annotation(attr) => {
WithinFunction::Annotation(mut attr) => {
if start.is_none() {
start = Some((attr.start, attr.module_id))
}
handle_pending_non_code!(attr);
if attr.is_inner() {
inner_attrs.push(attr);
} else {
@ -1575,10 +1616,11 @@ fn function_body(i: &mut TokenSlice) -> PResult<Node<Program>> {
b.set_attrs(pending_attrs);
pending_attrs = Vec::new();
}
handle_pending_non_code!(b);
body.push(b);
if let Some(nc) = maybe_noncode {
end = nc.end;
non_code_meta.insert(body.len() - 1, nc);
pending_non_code.push(nc);
}
}
WithinFunction::NonCode(nc) => {
@ -1586,11 +1628,7 @@ fn function_body(i: &mut TokenSlice) -> PResult<Node<Program>> {
start = Some((nc.start, nc.module_id));
}
end = nc.end;
if body.is_empty() {
non_code_meta.start_nodes.push(nc);
} else {
non_code_meta.insert(body.len() - 1, nc);
}
pending_non_code.push(nc);
}
}
}
@ -1614,6 +1652,15 @@ fn function_body(i: &mut TokenSlice) -> PResult<Node<Program>> {
.into(),
));
}
for nc in pending_non_code {
if body.is_empty() {
non_code_meta.start_nodes.push(nc);
} else {
non_code_meta.insert(body.len() - 1, nc);
}
}
// Safe to unwrap `body.first()` because `body` is `separated1` therefore guaranteed
// to have len >= 1.
let end_ws = opt(whitespace)
@ -1922,13 +1969,12 @@ fn return_stmt(i: &mut TokenSlice) -> PResult<Node<ReturnStatement>> {
.parse_next(i)?;
require_whitespace(i)?;
let argument = expression(i)?;
Ok(Node {
start: ret.start,
end: argument.end(),
module_id: ret.module_id,
inner: ReturnStatement { argument, digest: None },
outer_attrs: Vec::new(),
})
Ok(Node::new_node(
ret.start,
argument.end(),
ret.module_id,
ReturnStatement { argument, digest: None },
))
}
/// Parse a KCL expression.
@ -2134,28 +2180,27 @@ fn declaration(i: &mut TokenSlice) -> PResult<BoxNode<VariableDeclaration>> {
.map_err(|e| e.cut())?;
let end = val.end();
Ok(Box::new(Node {
start,
end,
module_id: id.module_id,
inner: VariableDeclaration {
declaration: Node {
start: id.start,
let module_id = id.module_id;
Ok(Node::boxed(
VariableDeclaration {
declaration: Node::new_node(
id.start,
end,
module_id: id.module_id,
inner: VariableDeclarator {
module_id,
VariableDeclarator {
id,
init: val,
digest: None,
},
outer_attrs: Vec::new(),
},
),
visibility,
kind,
digest: None,
},
outer_attrs: Vec::new(),
}))
start,
end,
module_id,
))
}
fn ty_decl(i: &mut TokenSlice) -> PResult<BoxNode<TypeDeclaration>> {
@ -2183,18 +2228,18 @@ fn ty_decl(i: &mut TokenSlice) -> PResult<BoxNode<TypeDeclaration>> {
None
};
let result = Box::new(Node {
start,
end,
module_id: name.module_id,
outer_attrs: Vec::new(),
inner: TypeDeclaration {
let module_id = name.module_id;
let result = Node::boxed(
TypeDeclaration {
name,
args,
visibility,
digest: None,
},
});
start,
end,
module_id,
);
ParseContext::warn(CompilationError::err(
result.as_source_range(),
@ -2374,17 +2419,16 @@ fn unary_expression(i: &mut TokenSlice) -> PResult<Node<UnaryExpression>> {
.context(expected("a unary expression, e.g. -x or -3"))
.parse_next(i)?;
let argument = operand.parse_next(i)?;
Ok(Node {
start: op_token.start,
end: argument.end(),
module_id: op_token.module_id,
inner: UnaryExpression {
Ok(Node::new_node(
op_token.start,
argument.end(),
op_token.module_id,
UnaryExpression {
operator,
argument,
digest: None,
},
outer_attrs: Vec::new(),
})
))
}
/// Consume tokens that make up a binary expression, but don't actually return them.
@ -2456,16 +2500,15 @@ fn expression_stmt(i: &mut TokenSlice) -> PResult<Node<ExpressionStatement>> {
"an expression (i.e. a value, or an algorithm for calculating one), e.g. 'x + y' or '3' or 'width * 2'",
))
.parse_next(i)?;
Ok(Node {
start: val.start(),
end: val.end(),
module_id: val.module_id(),
inner: ExpressionStatement {
Ok(Node::new_node(
val.start(),
val.end(),
val.module_id(),
ExpressionStatement {
expression: val,
digest: None,
},
outer_attrs: Vec::new(),
})
))
}
/// Parse the given brace symbol.
@ -2889,17 +2932,16 @@ fn fn_call(i: &mut TokenSlice) -> PResult<Node<CallExpression>> {
}
let end = preceded(opt(whitespace), close_paren).parse_next(i)?.end;
Ok(Node {
start: fn_name.start,
Ok(Node::new_node(
fn_name.start,
end,
module_id: fn_name.module_id,
inner: CallExpression {
fn_name.module_id,
CallExpression {
callee: fn_name,
arguments: args,
digest: None,
},
outer_attrs: Vec::new(),
})
))
}
fn fn_call_kw(i: &mut TokenSlice) -> PResult<Node<CallExpressionKw>> {
@ -2971,19 +3013,18 @@ fn fn_call_kw(i: &mut TokenSlice) -> PResult<Node<CallExpressionKw>> {
non_code_nodes,
..Default::default()
};
Ok(Node {
start: fn_name.start,
Ok(Node::new_node(
fn_name.start,
end,
module_id: fn_name.module_id,
inner: CallExpressionKw {
fn_name.module_id,
CallExpressionKw {
callee: fn_name,
unlabeled: initial_unlabeled_arg,
arguments: args,
digest: None,
non_code_meta,
},
outer_attrs: Vec::new(),
})
))
}
#[cfg(test)]
@ -3094,18 +3135,18 @@ mod tests {
a = 1
// comment 1
b = 2
// comment 2
/// comment 2
return 1
}"#;
let tokens = crate::parsing::token::lex(test_program, ModuleId::default()).unwrap();
let expr = function_decl.map(|t| t.0).parse_next(&mut tokens.as_slice()).unwrap();
assert_eq!(expr.params, vec![]);
let comment_start = expr.body.non_code_meta.start_nodes.first().unwrap();
let comment0 = &expr.body.non_code_meta.non_code_nodes.get(&0).unwrap()[0];
let comment1 = &expr.body.non_code_meta.non_code_nodes.get(&1).unwrap()[0];
assert_eq!(comment_start.value(), "comment 0");
assert_eq!(comment0.value(), "comment 1");
assert_eq!(comment1.value(), "comment 2");
let comment_start = expr.body.body[0].get_comments();
let comment0 = expr.body.body[1].get_comments();
let comment1 = expr.body.body[2].get_comments();
assert_eq!(comment_start, vec!["// comment 0".to_owned()]);
assert_eq!(comment0, vec!["// comment 1".to_owned()]);
assert_eq!(comment1, vec!["/// comment 2".to_owned()]);
}
#[test]
@ -3186,61 +3227,16 @@ mySk1 = startSketchOn(XY)
let tokens = crate::parsing::token::lex(test_program, module_id).unwrap();
let expr = function_decl.map(|t| t.0).parse_next(&mut tokens.as_slice()).unwrap();
assert_eq!(
expr,
Node::new(
FunctionExpression {
params: Default::default(),
body: Node::new(
Program {
body: vec![BodyItem::ReturnStatement(Node::new(
ReturnStatement {
argument: Expr::Literal(Box::new(Node::new(
Literal {
value: LiteralValue::Number {
value: 2.0,
suffix: NumericSuffix::None
},
raw: "2".to_owned(),
digest: None,
},
29,
30,
module_id,
))),
digest: None,
},
22,
30,
module_id,
))],
non_code_meta: NonCodeMeta {
non_code_nodes: Default::default(),
start_nodes: vec![Node::new(
NonCodeNode {
value: NonCodeValue::NewLine,
digest: None
},
4,
22,
module_id,
)],
digest: None,
},
inner_attrs: Vec::new(),
shebang: None,
digest: None,
},
4,
44,
module_id,
),
return_type: None,
digest: None,
expr.body.non_code_meta.start_nodes,
vec![Node::new(
NonCodeNode {
value: NonCodeValue::NewLine,
digest: None
},
0,
44,
4,
22,
module_id,
)
)]
);
}
@ -3282,22 +3278,10 @@ mySk1 = startSketchOn(XY)
let module_id = ModuleId::default();
let tokens = crate::parsing::token::lex(test_program, module_id).unwrap();
let Program { non_code_meta, .. } = function_body.parse(tokens.as_slice()).unwrap().inner;
assert_eq!(
vec![Node::new(
NonCodeNode {
value: NonCodeValue::BlockComment {
value: "this is a comment".to_owned(),
style: CommentStyle::Line
},
digest: None,
},
0,
20,
module_id,
)],
non_code_meta.start_nodes,
);
let Program {
body, non_code_meta, ..
} = function_body.parse(tokens.as_slice()).unwrap().inner;
assert_eq!(body[0].get_comments(), vec!["// this is a comment".to_owned()],);
assert_eq!(
Some(&vec![
@ -3326,21 +3310,7 @@ mySk1 = startSketchOn(XY)
non_code_meta.non_code_nodes.get(&0),
);
assert_eq!(
Some(&vec![Node::new(
NonCodeNode {
value: NonCodeValue::BlockComment {
value: "this is also a comment".to_owned(),
style: CommentStyle::Line
},
digest: None,
},
94,
120,
module_id,
)]),
non_code_meta.non_code_nodes.get(&1),
);
assert_eq!(body[2].get_comments(), vec!["// this is also a comment".to_owned()],);
}
#[test]

View File

@ -1,5 +1,5 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
@ -14,7 +14,8 @@ expression: actual
},
"raw": "1",
"start": 0,
"end": 1
"end": 1,
"commentStart": 0
},
"right": {
"type": "Literal",
@ -25,8 +26,10 @@ expression: actual
},
"raw": "2",
"start": 4,
"end": 5
"end": 5,
"commentStart": 4
},
"start": 0,
"end": 5
"end": 5,
"commentStart": 0
}

View File

@ -1,5 +1,5 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
@ -14,7 +14,8 @@ expression: actual
},
"raw": "1",
"start": 0,
"end": 1
"end": 1,
"commentStart": 0
},
"right": {
"type": "Literal",
@ -25,8 +26,10 @@ expression: actual
},
"raw": "2",
"start": 2,
"end": 3
"end": 3,
"commentStart": 2
},
"start": 0,
"end": 3
"end": 3,
"commentStart": 0
}

View File

@ -1,5 +1,5 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
@ -14,7 +14,8 @@ expression: actual
},
"raw": "1",
"start": 0,
"end": 1
"end": 1,
"commentStart": 0
},
"right": {
"type": "Literal",
@ -25,8 +26,10 @@ expression: actual
},
"raw": "2",
"start": 3,
"end": 4
"end": 4,
"commentStart": 3
},
"start": 0,
"end": 4
"end": 4,
"commentStart": 0
}

View File

@ -1,5 +1,5 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
@ -14,7 +14,8 @@ expression: actual
},
"raw": "1",
"start": 0,
"end": 1
"end": 1,
"commentStart": 0
},
"right": {
"type": "BinaryExpression",
@ -29,7 +30,8 @@ expression: actual
},
"raw": "2",
"start": 4,
"end": 5
"end": 5,
"commentStart": 4
},
"right": {
"type": "Literal",
@ -40,11 +42,14 @@ expression: actual
},
"raw": "3",
"start": 8,
"end": 9
"end": 9,
"commentStart": 8
},
"start": 4,
"end": 9
"end": 9,
"commentStart": 4
},
"start": 0,
"end": 9
"end": 9,
"commentStart": 0
}

View File

@ -1,5 +1,5 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
@ -14,7 +14,8 @@ expression: actual
},
"raw": "1",
"start": 0,
"end": 1
"end": 1,
"commentStart": 0
},
"right": {
"type": "BinaryExpression",
@ -29,7 +30,8 @@ expression: actual
},
"raw": "2",
"start": 6,
"end": 7
"end": 7,
"commentStart": 6
},
"right": {
"type": "Literal",
@ -40,11 +42,14 @@ expression: actual
},
"raw": "3",
"start": 10,
"end": 11
"end": 11,
"commentStart": 10
},
"start": 6,
"end": 11
"end": 11,
"commentStart": 6
},
"start": 0,
"end": 11
"end": 11,
"commentStart": 0
}

View File

@ -1,5 +1,5 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
@ -18,7 +18,8 @@ expression: actual
},
"raw": "1",
"start": 0,
"end": 1
"end": 1,
"commentStart": 0
},
"right": {
"type": "BinaryExpression",
@ -33,7 +34,8 @@ expression: actual
},
"raw": "2",
"start": 6,
"end": 7
"end": 7,
"commentStart": 6
},
"right": {
"type": "Literal",
@ -44,13 +46,16 @@ expression: actual
},
"raw": "3",
"start": 10,
"end": 11
"end": 11,
"commentStart": 10
},
"start": 6,
"end": 11
"end": 11,
"commentStart": 6
},
"start": 0,
"end": 11
"end": 11,
"commentStart": 0
},
"right": {
"type": "Literal",
@ -61,8 +66,10 @@ expression: actual
},
"raw": "4",
"start": 16,
"end": 17
"end": 17,
"commentStart": 16
},
"start": 0,
"end": 17
"end": 17,
"commentStart": 0
}

View File

@ -1,5 +1,5 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
@ -14,7 +14,8 @@ expression: actual
},
"raw": "1",
"start": 0,
"end": 1
"end": 1,
"commentStart": 0
},
"right": {
"type": "BinaryExpression",
@ -33,7 +34,8 @@ expression: actual
},
"raw": "2",
"start": 6,
"end": 7
"end": 7,
"commentStart": 6
},
"right": {
"type": "Literal",
@ -44,10 +46,12 @@ expression: actual
},
"raw": "3",
"start": 10,
"end": 11
"end": 11,
"commentStart": 10
},
"start": 6,
"end": 11
"end": 11,
"commentStart": 6
},
"right": {
"type": "Literal",
@ -58,11 +62,14 @@ expression: actual
},
"raw": "4",
"start": 16,
"end": 17
"end": 17,
"commentStart": 16
},
"start": 6,
"end": 17
"end": 17,
"commentStart": 6
},
"start": 0,
"end": 17
"end": 17,
"commentStart": 0
}

View File

@ -1,5 +1,5 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
@ -14,7 +14,8 @@ expression: actual
},
"raw": "1",
"start": 0,
"end": 1
"end": 1,
"commentStart": 0
},
"right": {
"type": "BinaryExpression",
@ -37,7 +38,8 @@ expression: actual
},
"raw": "2",
"start": 7,
"end": 8
"end": 8,
"commentStart": 7
},
"right": {
"type": "Literal",
@ -48,10 +50,12 @@ expression: actual
},
"raw": "3",
"start": 11,
"end": 12
"end": 12,
"commentStart": 11
},
"start": 7,
"end": 12
"end": 12,
"commentStart": 7
},
"right": {
"type": "Literal",
@ -62,10 +66,12 @@ expression: actual
},
"raw": "4",
"start": 17,
"end": 18
"end": 18,
"commentStart": 17
},
"start": 7,
"end": 18
"end": 18,
"commentStart": 7
},
"right": {
"type": "Literal",
@ -76,11 +82,14 @@ expression: actual
},
"raw": "5",
"start": 21,
"end": 22
"end": 22,
"commentStart": 21
},
"start": 7,
"end": 22
"end": 22,
"commentStart": 7
},
"start": 0,
"end": 22
"end": 22,
"commentStart": 0
}

View File

@ -1,5 +1,5 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
@ -14,7 +14,8 @@ expression: actual
},
"raw": "1",
"start": 0,
"end": 1
"end": 1,
"commentStart": 0
},
"right": {
"type": "BinaryExpression",
@ -29,7 +30,8 @@ expression: actual
},
"raw": "2",
"start": 8,
"end": 9
"end": 9,
"commentStart": 8
},
"right": {
"type": "Literal",
@ -40,11 +42,14 @@ expression: actual
},
"raw": "3",
"start": 12,
"end": 13
"end": 13,
"commentStart": 12
},
"start": 8,
"end": 13
"end": 13,
"commentStart": 8
},
"start": 0,
"end": 13
"end": 13,
"commentStart": 0
}

View File

@ -1,5 +1,5 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
@ -22,27 +22,32 @@ expression: actual
"type": "Identifier",
"name": "distance",
"start": 0,
"end": 8
"end": 8,
"commentStart": 0
},
"right": {
"type": "Identifier",
"type": "Identifier",
"name": "p",
"start": 11,
"end": 12
"end": 12,
"commentStart": 11
},
"start": 0,
"end": 12
"end": 12,
"commentStart": 0
},
"right": {
"type": "Identifier",
"type": "Identifier",
"name": "FOS",
"start": 15,
"end": 18
"end": 18,
"commentStart": 15
},
"start": 0,
"end": 18
"end": 18,
"commentStart": 0
},
"right": {
"type": "Literal",
@ -53,10 +58,12 @@ expression: actual
},
"raw": "6",
"start": 21,
"end": 22
"end": 22,
"commentStart": 21
},
"start": 0,
"end": 22
"end": 22,
"commentStart": 0
},
"right": {
"type": "BinaryExpression",
@ -67,18 +74,22 @@ expression: actual
"type": "Identifier",
"name": "sigmaAllow",
"start": 26,
"end": 36
"end": 36,
"commentStart": 26
},
"right": {
"type": "Identifier",
"type": "Identifier",
"name": "width",
"start": 39,
"end": 44
"end": 44,
"commentStart": 39
},
"start": 26,
"end": 44
"end": 44,
"commentStart": 26
},
"start": 0,
"end": 44
"end": 44,
"commentStart": 0
}

View File

@ -1,5 +1,5 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
@ -14,7 +14,8 @@ expression: actual
},
"raw": "2",
"start": 0,
"end": 1
"end": 1,
"commentStart": 0
},
"right": {
"type": "Literal",
@ -25,8 +26,10 @@ expression: actual
},
"raw": "3",
"start": 7,
"end": 8
"end": 8,
"commentStart": 7
},
"start": 0,
"end": 8
"end": 8,
"commentStart": 0
}

View File

@ -5,9 +5,12 @@ expression: actual
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 170,
"id": {
"commentStart": 0,
"end": 9,
"name": "boxSketch",
"start": 0,
@ -18,6 +21,7 @@ expression: actual
{
"arguments": [
{
"commentStart": 26,
"end": 28,
"name": "XY",
"start": 26,
@ -26,11 +30,13 @@ expression: actual
}
],
"callee": {
"commentStart": 12,
"end": 25,
"name": "startSketchOn",
"start": 12,
"type": "Identifier"
},
"commentStart": 12,
"end": 29,
"start": 12,
"type": "CallExpression",
@ -39,8 +45,10 @@ expression: actual
{
"arguments": [
{
"commentStart": 52,
"elements": [
{
"commentStart": 53,
"end": 54,
"raw": "0",
"start": 53,
@ -52,6 +60,7 @@ expression: actual
}
},
{
"commentStart": 56,
"end": 57,
"raw": "0",
"start": 56,
@ -69,6 +78,7 @@ expression: actual
"type": "ArrayExpression"
},
{
"commentStart": 60,
"end": 61,
"start": 60,
"type": "PipeSubstitution",
@ -76,11 +86,13 @@ expression: actual
}
],
"callee": {
"commentStart": 37,
"end": 51,
"name": "startProfileAt",
"start": 37,
"type": "Identifier"
},
"commentStart": 37,
"end": 62,
"start": 37,
"type": "CallExpression",
@ -89,8 +101,10 @@ expression: actual
{
"arguments": [
{
"commentStart": 75,
"elements": [
{
"commentStart": 76,
"end": 77,
"raw": "0",
"start": 76,
@ -102,6 +116,7 @@ expression: actual
}
},
{
"commentStart": 79,
"end": 81,
"raw": "10",
"start": 79,
@ -119,6 +134,7 @@ expression: actual
"type": "ArrayExpression"
},
{
"commentStart": 84,
"end": 85,
"start": 84,
"type": "PipeSubstitution",
@ -126,11 +142,13 @@ expression: actual
}
],
"callee": {
"commentStart": 70,
"end": 74,
"name": "line",
"start": 70,
"type": "Identifier"
},
"commentStart": 70,
"end": 86,
"start": 70,
"type": "CallExpression",
@ -139,9 +157,11 @@ expression: actual
{
"arguments": [
{
"commentStart": 108,
"elements": [
{
"argument": {
"commentStart": 110,
"end": 111,
"raw": "5",
"start": 110,
@ -152,6 +172,7 @@ expression: actual
"suffix": "None"
}
},
"commentStart": 109,
"end": 111,
"operator": "-",
"start": 109,
@ -159,6 +180,7 @@ expression: actual
"type": "UnaryExpression"
},
{
"commentStart": 113,
"end": 114,
"raw": "5",
"start": 113,
@ -176,6 +198,7 @@ expression: actual
"type": "ArrayExpression"
},
{
"commentStart": 117,
"end": 118,
"start": 117,
"type": "PipeSubstitution",
@ -183,11 +206,13 @@ expression: actual
}
],
"callee": {
"commentStart": 94,
"end": 107,
"name": "tangentialArc",
"start": 94,
"type": "Identifier"
},
"commentStart": 94,
"end": 119,
"start": 94,
"type": "CallExpression",
@ -196,8 +221,10 @@ expression: actual
{
"arguments": [
{
"commentStart": 132,
"elements": [
{
"commentStart": 133,
"end": 134,
"raw": "5",
"start": 133,
@ -210,6 +237,7 @@ expression: actual
},
{
"argument": {
"commentStart": 137,
"end": 139,
"raw": "15",
"start": 137,
@ -220,6 +248,7 @@ expression: actual
"suffix": "None"
}
},
"commentStart": 136,
"end": 139,
"operator": "-",
"start": 136,
@ -233,6 +262,7 @@ expression: actual
"type": "ArrayExpression"
},
{
"commentStart": 142,
"end": 143,
"start": 142,
"type": "PipeSubstitution",
@ -240,11 +270,13 @@ expression: actual
}
],
"callee": {
"commentStart": 127,
"end": 131,
"name": "line",
"start": 127,
"type": "Identifier"
},
"commentStart": 127,
"end": 144,
"start": 127,
"type": "CallExpression",
@ -255,12 +287,14 @@ expression: actual
{
"type": "LabeledArg",
"label": {
"commentStart": 160,
"end": 166,
"name": "length",
"start": 160,
"type": "Identifier"
},
"arg": {
"commentStart": 167,
"end": 169,
"raw": "10",
"start": 167,
@ -274,11 +308,13 @@ expression: actual
}
],
"callee": {
"commentStart": 152,
"end": 159,
"name": "extrude",
"start": 152,
"type": "Identifier"
},
"commentStart": 152,
"end": 170,
"start": 152,
"type": "CallExpressionKw",
@ -286,6 +322,7 @@ expression: actual
"unlabeled": null
}
],
"commentStart": 12,
"end": 170,
"start": 12,
"type": "PipeExpression",
@ -301,6 +338,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 171,
"start": 0
}

View File

@ -1,13 +1,16 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 11,
"id": {
"commentStart": 0,
"end": 2,
"name": "sg",
"start": 0,
@ -15,12 +18,14 @@ expression: actual
},
"init": {
"argument": {
"commentStart": 6,
"end": 11,
"name": "scale",
"start": 6,
"type": "Identifier",
"type": "Identifier"
},
"commentStart": 5,
"end": 11,
"operator": "-",
"start": 5,
@ -37,6 +42,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 11,
"start": 0
}

View File

@ -5,20 +5,24 @@ expression: actual
{
"body": [
{
"commentStart": 0,
"end": 27,
"expression": {
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 5,
"end": 16,
"name": "endAbsolute",
"start": 5,
"type": "Identifier"
},
"arg": {
"commentStart": 19,
"elements": [
{
"commentStart": 20,
"end": 21,
"raw": "0",
"start": 20,
@ -31,6 +35,7 @@ expression: actual
},
{
"argument": {
"commentStart": 24,
"end": 25,
"raw": "1",
"start": 24,
@ -41,6 +46,7 @@ expression: actual
"suffix": "None"
}
},
"commentStart": 23,
"end": 25,
"operator": "-",
"start": 23,
@ -56,11 +62,13 @@ expression: actual
}
],
"callee": {
"commentStart": 0,
"end": 4,
"name": "line",
"start": 0,
"type": "Identifier"
},
"commentStart": 0,
"end": 27,
"start": 0,
"type": "CallExpressionKw",
@ -72,6 +80,7 @@ expression: actual
"type": "ExpressionStatement"
}
],
"commentStart": 0,
"end": 27,
"start": 0
}

View File

@ -1,21 +1,26 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 17,
"id": {
"commentStart": 0,
"end": 7,
"name": "myArray",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 10,
"end": 17,
"endElement": {
"commentStart": 14,
"end": 16,
"raw": "10",
"start": 14,
@ -29,6 +34,7 @@ expression: actual
"endInclusive": true,
"start": 10,
"startElement": {
"commentStart": 11,
"end": 12,
"raw": "0",
"start": 11,
@ -52,6 +58,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 17,
"start": 0
}

View File

@ -1,13 +1,16 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 5,
"declaration": {
"commentStart": 8,
"end": 57,
"id": {
"commentStart": 8,
"end": 24,
"name": "firstPrimeNumber",
"start": 8,
@ -18,6 +21,7 @@ expression: actual
"body": [
{
"argument": {
"commentStart": 50,
"end": 51,
"raw": "2",
"start": 50,
@ -28,15 +32,18 @@ expression: actual
"suffix": "None"
}
},
"commentStart": 43,
"end": 51,
"start": 43,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"commentStart": 33,
"end": 57,
"start": 33
},
"commentStart": 27,
"end": 57,
"params": [],
"start": 27,
@ -53,15 +60,18 @@ expression: actual
"type": "VariableDeclaration"
},
{
"commentStart": 62,
"end": 80,
"expression": {
"arguments": [],
"callee": {
"commentStart": 62,
"end": 78,
"name": "firstPrimeNumber",
"start": 62,
"type": "Identifier"
},
"commentStart": 62,
"end": 80,
"start": 62,
"type": "CallExpression",
@ -72,6 +82,7 @@ expression: actual
"type": "ExpressionStatement"
}
],
"commentStart": 0,
"end": 80,
"start": 0
}

View File

@ -1,13 +1,16 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 3,
"end": 49,
"id": {
"commentStart": 3,
"end": 8,
"name": "thing",
"start": 3,
@ -18,6 +21,7 @@ expression: actual
"body": [
{
"argument": {
"commentStart": 39,
"end": 43,
"raw": "true",
"start": 39,
@ -25,20 +29,24 @@ expression: actual
"type": "Literal",
"value": true
},
"commentStart": 32,
"end": 43,
"start": 32,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"commentStart": 22,
"end": 49,
"start": 22
},
"commentStart": 11,
"end": 49,
"params": [
{
"type": "Parameter",
"identifier": {
"commentStart": 12,
"end": 17,
"name": "param",
"start": 12,
@ -60,10 +68,12 @@ expression: actual
"type": "VariableDeclaration"
},
{
"commentStart": 54,
"end": 66,
"expression": {
"arguments": [
{
"commentStart": 60,
"end": 65,
"raw": "false",
"start": 60,
@ -73,11 +83,13 @@ expression: actual
}
],
"callee": {
"commentStart": 54,
"end": 59,
"name": "thing",
"start": 54,
"type": "Identifier"
},
"commentStart": 54,
"end": 66,
"start": 54,
"type": "CallExpression",
@ -88,6 +100,7 @@ expression: actual
"type": "ExpressionStatement"
}
],
"commentStart": 0,
"end": 66,
"start": 0
}

View File

@ -5,9 +5,12 @@ expression: actual
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 230,
"id": {
"commentStart": 0,
"end": 8,
"name": "mySketch",
"start": 0,
@ -18,6 +21,7 @@ expression: actual
{
"arguments": [
{
"commentStart": 25,
"end": 27,
"name": "XY",
"start": 25,
@ -26,11 +30,13 @@ expression: actual
}
],
"callee": {
"commentStart": 11,
"end": 24,
"name": "startSketchOn",
"start": 11,
"type": "Identifier"
},
"commentStart": 11,
"end": 28,
"start": 11,
"type": "CallExpression",
@ -39,8 +45,10 @@ expression: actual
{
"arguments": [
{
"commentStart": 55,
"elements": [
{
"commentStart": 56,
"end": 57,
"raw": "0",
"start": 56,
@ -52,6 +60,7 @@ expression: actual
}
},
{
"commentStart": 58,
"end": 59,
"raw": "0",
"start": 58,
@ -69,6 +78,7 @@ expression: actual
"type": "ArrayExpression"
},
{
"commentStart": 62,
"end": 63,
"start": 62,
"type": "PipeSubstitution",
@ -76,11 +86,13 @@ expression: actual
}
],
"callee": {
"commentStart": 40,
"end": 54,
"name": "startProfileAt",
"start": 40,
"type": "Identifier"
},
"commentStart": 40,
"end": 64,
"start": 40,
"type": "CallExpression",
@ -91,14 +103,17 @@ expression: actual
{
"type": "LabeledArg",
"label": {
"commentStart": 81,
"end": 92,
"name": "endAbsolute",
"start": 81,
"type": "Identifier"
},
"arg": {
"commentStart": 95,
"elements": [
{
"commentStart": 96,
"end": 97,
"raw": "0",
"start": 96,
@ -110,6 +125,7 @@ expression: actual
}
},
{
"commentStart": 99,
"end": 100,
"raw": "1",
"start": 99,
@ -130,12 +146,14 @@ expression: actual
{
"type": "LabeledArg",
"label": {
"commentStart": 103,
"end": 106,
"name": "tag",
"start": 103,
"type": "Identifier"
},
"arg": {
"commentStart": 109,
"end": 116,
"start": 109,
"type": "TagDeclarator",
@ -145,11 +163,13 @@ expression: actual
}
],
"callee": {
"commentStart": 76,
"end": 80,
"name": "line",
"start": 76,
"type": "Identifier"
},
"commentStart": 76,
"end": 117,
"start": 76,
"type": "CallExpressionKw",
@ -161,14 +181,17 @@ expression: actual
{
"type": "LabeledArg",
"label": {
"commentStart": 134,
"end": 145,
"name": "endAbsolute",
"start": 134,
"type": "Identifier"
},
"arg": {
"commentStart": 148,
"elements": [
{
"commentStart": 149,
"end": 150,
"raw": "1",
"start": 149,
@ -180,6 +203,7 @@ expression: actual
}
},
{
"commentStart": 152,
"end": 153,
"raw": "1",
"start": 152,
@ -199,11 +223,13 @@ expression: actual
}
],
"callee": {
"commentStart": 129,
"end": 133,
"name": "line",
"start": 129,
"type": "Identifier"
},
"commentStart": 129,
"end": 155,
"start": 129,
"type": "CallExpressionKw",
@ -215,14 +241,17 @@ expression: actual
{
"type": "LabeledArg",
"label": {
"commentStart": 172,
"end": 183,
"name": "endAbsolute",
"start": 172,
"type": "Identifier"
},
"arg": {
"commentStart": 186,
"elements": [
{
"commentStart": 187,
"end": 188,
"raw": "1",
"start": 187,
@ -234,6 +263,7 @@ expression: actual
}
},
{
"commentStart": 190,
"end": 191,
"raw": "0",
"start": 190,
@ -254,12 +284,14 @@ expression: actual
{
"type": "LabeledArg",
"label": {
"commentStart": 194,
"end": 197,
"name": "tag",
"start": 194,
"type": "Identifier"
},
"arg": {
"commentStart": 200,
"end": 210,
"start": 200,
"type": "TagDeclarator",
@ -269,11 +301,13 @@ expression: actual
}
],
"callee": {
"commentStart": 167,
"end": 171,
"name": "line",
"start": 167,
"type": "Identifier"
},
"commentStart": 167,
"end": 211,
"start": 167,
"type": "CallExpressionKw",
@ -283,17 +317,20 @@ expression: actual
{
"arguments": [],
"callee": {
"commentStart": 223,
"end": 228,
"name": "close",
"start": 223,
"type": "Identifier"
},
"commentStart": 223,
"end": 230,
"start": 223,
"type": "CallExpression",
"type": "CallExpression"
}
],
"commentStart": 11,
"end": 230,
"start": 11,
"type": "PipeExpression",
@ -309,6 +346,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 230,
"start": 0
}

View File

@ -5,9 +5,12 @@ expression: actual
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 97,
"id": {
"commentStart": 0,
"end": 8,
"name": "mySketch",
"start": 0,
@ -18,6 +21,7 @@ expression: actual
{
"arguments": [
{
"commentStart": 25,
"end": 27,
"name": "XY",
"start": 25,
@ -26,11 +30,13 @@ expression: actual
}
],
"callee": {
"commentStart": 11,
"end": 24,
"name": "startSketchOn",
"start": 11,
"type": "Identifier"
},
"commentStart": 11,
"end": 28,
"start": 11,
"type": "CallExpression",
@ -39,8 +45,10 @@ expression: actual
{
"arguments": [
{
"commentStart": 47,
"elements": [
{
"commentStart": 48,
"end": 49,
"raw": "0",
"start": 48,
@ -52,6 +60,7 @@ expression: actual
}
},
{
"commentStart": 50,
"end": 51,
"raw": "0",
"start": 50,
@ -69,6 +78,7 @@ expression: actual
"type": "ArrayExpression"
},
{
"commentStart": 54,
"end": 55,
"start": 54,
"type": "PipeSubstitution",
@ -76,11 +86,13 @@ expression: actual
}
],
"callee": {
"commentStart": 32,
"end": 46,
"name": "startProfileAt",
"start": 32,
"type": "Identifier"
},
"commentStart": 32,
"end": 56,
"start": 32,
"type": "CallExpression",
@ -91,14 +103,17 @@ expression: actual
{
"type": "LabeledArg",
"label": {
"commentStart": 65,
"end": 76,
"name": "endAbsolute",
"start": 65,
"type": "Identifier"
},
"arg": {
"commentStart": 79,
"elements": [
{
"commentStart": 80,
"end": 81,
"raw": "1",
"start": 80,
@ -110,6 +125,7 @@ expression: actual
}
},
{
"commentStart": 83,
"end": 84,
"raw": "1",
"start": 83,
@ -129,11 +145,13 @@ expression: actual
}
],
"callee": {
"commentStart": 60,
"end": 64,
"name": "line",
"start": 60,
"type": "Identifier"
},
"commentStart": 60,
"end": 86,
"start": 60,
"type": "CallExpressionKw",
@ -143,17 +161,20 @@ expression: actual
{
"arguments": [],
"callee": {
"commentStart": 90,
"end": 95,
"name": "close",
"start": 90,
"type": "Identifier"
},
"commentStart": 90,
"end": 97,
"start": 90,
"type": "CallExpression",
"type": "CallExpression"
}
],
"commentStart": 11,
"end": 97,
"start": 11,
"type": "PipeExpression",
@ -169,6 +190,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 97,
"start": 0
}

View File

@ -5,9 +5,12 @@ expression: actual
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 49,
"id": {
"commentStart": 0,
"end": 5,
"name": "myBox",
"start": 0,
@ -18,6 +21,7 @@ expression: actual
{
"arguments": [
{
"commentStart": 22,
"end": 24,
"name": "XY",
"start": 22,
@ -26,11 +30,13 @@ expression: actual
}
],
"callee": {
"commentStart": 8,
"end": 21,
"name": "startSketchOn",
"start": 8,
"type": "Identifier"
},
"commentStart": 8,
"end": 25,
"start": 8,
"type": "CallExpression",
@ -39,6 +45,7 @@ expression: actual
{
"arguments": [
{
"commentStart": 44,
"end": 45,
"name": "p",
"start": 44,
@ -46,6 +53,7 @@ expression: actual
"type": "Identifier"
},
{
"commentStart": 47,
"end": 48,
"start": 47,
"type": "PipeSubstitution",
@ -53,17 +61,20 @@ expression: actual
}
],
"callee": {
"commentStart": 29,
"end": 43,
"name": "startProfileAt",
"start": 29,
"type": "Identifier"
},
"commentStart": 29,
"end": 49,
"start": 29,
"type": "CallExpression",
"type": "CallExpression"
}
],
"commentStart": 8,
"end": 49,
"start": 8,
"type": "PipeExpression",
@ -79,6 +90,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 49,
"start": 0
}

View File

@ -1,13 +1,16 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 23,
"id": {
"commentStart": 0,
"end": 5,
"name": "myBox",
"start": 0,
@ -18,6 +21,7 @@ expression: actual
{
"arguments": [
{
"commentStart": 10,
"end": 11,
"raw": "1",
"start": 10,
@ -30,11 +34,13 @@ expression: actual
}
],
"callee": {
"commentStart": 8,
"end": 9,
"name": "f",
"start": 8,
"type": "Identifier"
},
"commentStart": 8,
"end": 12,
"start": 8,
"type": "CallExpression",
@ -43,6 +49,7 @@ expression: actual
{
"arguments": [
{
"commentStart": 18,
"end": 19,
"raw": "2",
"start": 18,
@ -54,6 +61,7 @@ expression: actual
}
},
{
"commentStart": 21,
"end": 22,
"start": 21,
"type": "PipeSubstitution",
@ -61,17 +69,20 @@ expression: actual
}
],
"callee": {
"commentStart": 16,
"end": 17,
"name": "g",
"start": 16,
"type": "Identifier"
},
"commentStart": 16,
"end": 23,
"start": 16,
"type": "CallExpression",
"type": "CallExpression"
}
],
"commentStart": 8,
"end": 23,
"start": 8,
"type": "PipeExpression",
@ -87,6 +98,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 23,
"start": 0
}

View File

@ -5,9 +5,12 @@ expression: actual
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 71,
"id": {
"commentStart": 0,
"end": 5,
"name": "myBox",
"start": 0,
@ -18,6 +21,7 @@ expression: actual
{
"arguments": [
{
"commentStart": 22,
"end": 24,
"name": "XY",
"start": 22,
@ -26,11 +30,13 @@ expression: actual
}
],
"callee": {
"commentStart": 8,
"end": 21,
"name": "startSketchOn",
"start": 8,
"type": "Identifier"
},
"commentStart": 8,
"end": 25,
"start": 8,
"type": "CallExpression",
@ -39,6 +45,7 @@ expression: actual
{
"arguments": [
{
"commentStart": 44,
"end": 45,
"name": "p",
"start": 44,
@ -46,6 +53,7 @@ expression: actual
"type": "Identifier"
},
{
"commentStart": 47,
"end": 48,
"start": 47,
"type": "PipeSubstitution",
@ -53,11 +61,13 @@ expression: actual
}
],
"callee": {
"commentStart": 29,
"end": 43,
"name": "startProfileAt",
"start": 29,
"type": "Identifier"
},
"commentStart": 29,
"end": 49,
"start": 29,
"type": "CallExpression",
@ -68,14 +78,17 @@ expression: actual
{
"type": "LabeledArg",
"label": {
"commentStart": 58,
"end": 61,
"name": "end",
"start": 58,
"type": "Identifier"
},
"arg": {
"commentStart": 64,
"elements": [
{
"commentStart": 65,
"end": 66,
"raw": "0",
"start": 65,
@ -87,6 +100,7 @@ expression: actual
}
},
{
"commentStart": 68,
"end": 69,
"name": "l",
"start": 68,
@ -102,11 +116,13 @@ expression: actual
}
],
"callee": {
"commentStart": 53,
"end": 57,
"name": "line",
"start": 53,
"type": "Identifier"
},
"commentStart": 53,
"end": 71,
"start": 53,
"type": "CallExpressionKw",
@ -114,6 +130,7 @@ expression: actual
"unlabeled": null
}
],
"commentStart": 8,
"end": 71,
"start": 8,
"type": "PipeExpression",
@ -129,6 +146,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 71,
"start": 0
}

View File

@ -5,20 +5,24 @@ expression: actual
{
"body": [
{
"commentStart": 0,
"end": 26,
"expression": {
"arguments": [
{
"type": "LabeledArg",
"label": {
"commentStart": 5,
"end": 16,
"name": "endAbsolute",
"start": 5,
"type": "Identifier"
},
"arg": {
"commentStart": 19,
"elements": [
{
"commentStart": 20,
"end": 21,
"raw": "0",
"start": 20,
@ -30,6 +34,7 @@ expression: actual
}
},
{
"commentStart": 23,
"end": 24,
"raw": "1",
"start": 23,
@ -49,11 +54,13 @@ expression: actual
}
],
"callee": {
"commentStart": 0,
"end": 4,
"name": "line",
"start": 0,
"type": "Identifier"
},
"commentStart": 0,
"end": 26,
"start": 0,
"type": "CallExpressionKw",
@ -65,6 +72,7 @@ expression: actual
"type": "ExpressionStatement"
}
],
"commentStart": 0,
"end": 26,
"start": 0
}

View File

@ -5,9 +5,12 @@ expression: actual
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 56,
"id": {
"commentStart": 0,
"end": 8,
"name": "mySketch",
"start": 0,
@ -18,6 +21,7 @@ expression: actual
{
"arguments": [
{
"commentStart": 25,
"end": 27,
"name": "XY",
"start": 25,
@ -26,11 +30,13 @@ expression: actual
}
],
"callee": {
"commentStart": 11,
"end": 24,
"name": "startSketchOn",
"start": 11,
"type": "Identifier"
},
"commentStart": 11,
"end": 28,
"start": 11,
"type": "CallExpression",
@ -39,8 +45,10 @@ expression: actual
{
"arguments": [
{
"commentStart": 47,
"elements": [
{
"commentStart": 48,
"end": 49,
"raw": "0",
"start": 48,
@ -52,6 +60,7 @@ expression: actual
}
},
{
"commentStart": 50,
"end": 51,
"raw": "0",
"start": 50,
@ -69,6 +78,7 @@ expression: actual
"type": "ArrayExpression"
},
{
"commentStart": 54,
"end": 55,
"start": 54,
"type": "PipeSubstitution",
@ -76,17 +86,20 @@ expression: actual
}
],
"callee": {
"commentStart": 32,
"end": 46,
"name": "startProfileAt",
"start": 32,
"type": "Identifier"
},
"commentStart": 32,
"end": 56,
"start": 32,
"type": "CallExpression",
"type": "CallExpression"
}
],
"commentStart": 11,
"end": 56,
"start": 11,
"type": "PipeExpression",
@ -102,6 +115,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 56,
"start": 0
}

View File

@ -1,14 +1,16 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"end": 28,
"expression": {
"arguments": [
{
"commentStart": 4,
"end": 5,
"raw": "5",
"start": 4,
@ -20,6 +22,7 @@ expression: actual
}
},
{
"commentStart": 7,
"end": 14,
"raw": "\"hello\"",
"start": 7,
@ -28,6 +31,7 @@ expression: actual
"value": "hello"
},
{
"commentStart": 16,
"end": 27,
"name": "aIdentifier",
"start": 16,
@ -36,11 +40,13 @@ expression: actual
}
],
"callee": {
"commentStart": 0,
"end": 3,
"name": "log",
"start": 0,
"type": "Identifier"
},
"commentStart": 0,
"end": 28,
"start": 0,
"type": "CallExpression",
@ -51,6 +57,7 @@ expression: actual
"type": "ExpressionStatement"
}
],
"commentStart": 0,
"end": 28,
"start": 0
}

View File

@ -1,14 +1,17 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"end": 7,
"expression": {
"commentStart": 0,
"end": 7,
"left": {
"commentStart": 0,
"end": 1,
"raw": "5",
"start": 0,
@ -21,6 +24,7 @@ expression: actual
},
"operator": "+",
"right": {
"commentStart": 4,
"end": 7,
"raw": "\"a\"",
"start": 4,
@ -37,6 +41,7 @@ expression: actual
"type": "ExpressionStatement"
}
],
"commentStart": 0,
"end": 7,
"start": 0
}

View File

@ -1,16 +1,19 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"end": 15,
"expression": {
"arguments": [
{
"commentStart": 5,
"elements": [
{
"commentStart": 6,
"end": 7,
"raw": "0",
"start": 6,
@ -22,6 +25,7 @@ expression: actual
}
},
{
"commentStart": 9,
"end": 10,
"name": "l",
"start": 9,
@ -35,6 +39,7 @@ expression: actual
"type": "ArrayExpression"
},
{
"commentStart": 13,
"end": 14,
"start": 13,
"type": "PipeSubstitution",
@ -42,11 +47,13 @@ expression: actual
}
],
"callee": {
"commentStart": 0,
"end": 4,
"name": "line",
"start": 0,
"type": "Identifier"
},
"commentStart": 0,
"end": 15,
"start": 0,
"type": "CallExpression",
@ -57,6 +64,7 @@ expression: actual
"type": "ExpressionStatement"
}
],
"commentStart": 0,
"end": 15,
"start": 0
}

View File

@ -5,9 +5,12 @@ expression: actual
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 6,
"end": 106,
"id": {
"commentStart": 6,
"end": 14,
"name": "cylinder",
"start": 6,
@ -18,6 +21,7 @@ expression: actual
{
"arguments": [
{
"commentStart": 31,
"end": 35,
"raw": "'XY'",
"start": 31,
@ -27,11 +31,13 @@ expression: actual
}
],
"callee": {
"commentStart": 17,
"end": 30,
"name": "startSketchOn",
"start": 17,
"type": "Identifier"
},
"commentStart": 17,
"end": 36,
"start": 17,
"type": "CallExpression",
@ -42,14 +48,17 @@ expression: actual
{
"type": "LabeledArg",
"label": {
"commentStart": 51,
"end": 57,
"name": "center",
"start": 51,
"type": "Identifier"
},
"arg": {
"commentStart": 59,
"elements": [
{
"commentStart": 60,
"end": 61,
"raw": "0",
"start": 60,
@ -61,6 +70,7 @@ expression: actual
}
},
{
"commentStart": 63,
"end": 64,
"raw": "0",
"start": 63,
@ -81,12 +91,14 @@ expression: actual
{
"type": "LabeledArg",
"label": {
"commentStart": 67,
"end": 73,
"name": "radius",
"start": 67,
"type": "Identifier"
},
"arg": {
"commentStart": 75,
"end": 77,
"raw": "22",
"start": 75,
@ -100,11 +112,13 @@ expression: actual
}
],
"callee": {
"commentStart": 44,
"end": 50,
"name": "circle",
"start": 44,
"type": "Identifier"
},
"commentStart": 44,
"end": 78,
"start": 44,
"type": "CallExpressionKw",
@ -116,12 +130,14 @@ expression: actual
{
"type": "LabeledArg",
"label": {
"commentStart": 94,
"end": 100,
"name": "length",
"start": 94,
"type": "Identifier"
},
"arg": {
"commentStart": 103,
"end": 105,
"raw": "14",
"start": 103,
@ -135,11 +151,13 @@ expression: actual
}
],
"callee": {
"commentStart": 86,
"end": 93,
"name": "extrude",
"start": 86,
"type": "Identifier"
},
"commentStart": 86,
"end": 106,
"start": 86,
"type": "CallExpressionKw",
@ -147,6 +165,7 @@ expression: actual
"unlabeled": null
}
],
"commentStart": 17,
"end": 106,
"start": 17,
"type": "PipeExpression",
@ -162,6 +181,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 107,
"start": 0
}

View File

@ -1,13 +1,16 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 3,
"end": 49,
"id": {
"commentStart": 3,
"end": 4,
"name": "f",
"start": 3,
@ -20,6 +23,7 @@ expression: actual
"argument": {
"arguments": [
{
"commentStart": 36,
"end": 41,
"name": "angle",
"start": 36,
@ -27,6 +31,7 @@ expression: actual
"type": "Identifier"
},
{
"commentStart": 43,
"end": 46,
"raw": "360",
"start": 43,
@ -39,30 +44,36 @@ expression: actual
}
],
"callee": {
"commentStart": 28,
"end": 35,
"name": "default",
"start": 28,
"type": "Identifier"
},
"commentStart": 28,
"end": 47,
"start": 28,
"type": "CallExpression",
"type": "CallExpression"
},
"commentStart": 21,
"end": 47,
"start": 21,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"commentStart": 19,
"end": 49,
"start": 19
},
"commentStart": 7,
"end": 49,
"params": [
{
"type": "Parameter",
"identifier": {
"commentStart": 8,
"end": 13,
"name": "angle",
"start": 8,
@ -89,6 +100,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 49,
"start": 0
}

View File

@ -1,21 +1,26 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 4,
"end": 91,
"id": {
"commentStart": 4,
"end": 11,
"name": "numbers",
"start": 4,
"type": "Identifier"
},
"init": {
"commentStart": 14,
"elements": [
{
"commentStart": 28,
"end": 29,
"raw": "1",
"start": 28,
@ -27,6 +32,7 @@ expression: actual
}
},
{
"commentStart": 79,
"end": 80,
"raw": "3",
"start": 79,
@ -43,6 +49,7 @@ expression: actual
"nonCodeNodes": {
"1": [
{
"commentStart": 43,
"end": 48,
"start": 43,
"type": "NonCodeNode",
@ -55,6 +62,7 @@ expression: actual
],
"2": [
{
"commentStart": 61,
"end": 66,
"start": 61,
"type": "NonCodeNode",
@ -82,6 +90,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 91,
"start": 0
}

View File

@ -1,21 +1,26 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 4,
"end": 91,
"id": {
"commentStart": 4,
"end": 11,
"name": "numbers",
"start": 4,
"type": "Identifier"
},
"init": {
"commentStart": 14,
"elements": [
{
"commentStart": 28,
"end": 29,
"raw": "1",
"start": 28,
@ -27,6 +32,7 @@ expression: actual
}
},
{
"commentStart": 43,
"end": 44,
"raw": "2",
"start": 43,
@ -43,6 +49,7 @@ expression: actual
"nonCodeNodes": {
"2": [
{
"commentStart": 58,
"end": 63,
"start": 58,
"type": "NonCodeNode",
@ -55,6 +62,7 @@ expression: actual
],
"3": [
{
"commentStart": 76,
"end": 81,
"start": 76,
"type": "NonCodeNode",
@ -82,6 +90,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 91,
"start": 0
}

View File

@ -1,24 +1,29 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 4,
"end": 80,
"id": {
"commentStart": 4,
"end": 9,
"name": "props",
"start": 4,
"type": "Identifier"
},
"init": {
"commentStart": 12,
"end": 80,
"nonCodeMeta": {
"nonCodeNodes": {
"1": [
{
"commentStart": 44,
"end": 52,
"start": 44,
"type": "NonCodeNode",
@ -34,8 +39,10 @@ expression: actual
},
"properties": [
{
"commentStart": 26,
"end": 30,
"key": {
"commentStart": 26,
"end": 27,
"name": "a",
"start": 26,
@ -44,6 +51,7 @@ expression: actual
"start": 26,
"type": "ObjectProperty",
"value": {
"commentStart": 29,
"end": 30,
"raw": "1",
"start": 29,
@ -56,8 +64,10 @@ expression: actual
}
},
{
"commentStart": 65,
"end": 69,
"key": {
"commentStart": 65,
"end": 66,
"name": "c",
"start": 65,
@ -66,6 +76,7 @@ expression: actual
"start": 65,
"type": "ObjectProperty",
"value": {
"commentStart": 68,
"end": 69,
"raw": "3",
"start": 68,
@ -92,6 +103,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 80,
"start": 0
}

View File

@ -1,24 +1,29 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 4,
"end": 79,
"id": {
"commentStart": 4,
"end": 9,
"name": "props",
"start": 4,
"type": "Identifier"
},
"init": {
"commentStart": 12,
"end": 79,
"nonCodeMeta": {
"nonCodeNodes": {
"1": [
{
"commentStart": 44,
"end": 52,
"start": 44,
"type": "NonCodeNode",
@ -34,8 +39,10 @@ expression: actual
},
"properties": [
{
"commentStart": 26,
"end": 30,
"key": {
"commentStart": 26,
"end": 27,
"name": "a",
"start": 26,
@ -44,6 +51,7 @@ expression: actual
"start": 26,
"type": "ObjectProperty",
"value": {
"commentStart": 29,
"end": 30,
"raw": "1",
"start": 29,
@ -56,8 +64,10 @@ expression: actual
}
},
{
"commentStart": 65,
"end": 69,
"key": {
"commentStart": 65,
"end": 66,
"name": "c",
"start": 65,
@ -66,6 +76,7 @@ expression: actual
"start": 65,
"type": "ObjectProperty",
"value": {
"commentStart": 68,
"end": 69,
"raw": "3",
"start": 68,
@ -92,6 +103,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 79,
"start": 0
}

View File

@ -1,13 +1,16 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 30,
"id": {
"commentStart": 0,
"end": 5,
"name": "myVar",
"start": 0,
@ -16,6 +19,7 @@ expression: actual
"init": {
"arguments": [
{
"commentStart": 12,
"end": 13,
"raw": "5",
"start": 12,
@ -30,6 +34,7 @@ expression: actual
"argument": {
"arguments": [
{
"commentStart": 24,
"end": 25,
"raw": "5",
"start": 24,
@ -41,6 +46,7 @@ expression: actual
}
},
{
"commentStart": 27,
"end": 28,
"raw": "4",
"start": 27,
@ -53,16 +59,19 @@ expression: actual
}
],
"callee": {
"commentStart": 17,
"end": 23,
"name": "legLen",
"start": 17,
"type": "Identifier"
},
"commentStart": 17,
"end": 29,
"start": 17,
"type": "CallExpression",
"type": "CallExpression"
},
"commentStart": 16,
"end": 29,
"operator": "-",
"start": 16,
@ -71,11 +80,13 @@ expression: actual
}
],
"callee": {
"commentStart": 8,
"end": 11,
"name": "min",
"start": 8,
"type": "Identifier"
},
"commentStart": 8,
"end": 30,
"start": 8,
"type": "CallExpression",
@ -91,6 +102,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 30,
"start": 0
}

View File

@ -1,13 +1,16 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 1,
"declaration": {
"commentStart": 1,
"end": 126,
"id": {
"commentStart": 1,
"end": 10,
"name": "sketch001",
"start": 1,
@ -18,6 +21,7 @@ expression: actual
{
"arguments": [
{
"commentStart": 27,
"end": 31,
"raw": "'XY'",
"start": 27,
@ -27,11 +31,13 @@ expression: actual
}
],
"callee": {
"commentStart": 13,
"end": 26,
"name": "startSketchOn",
"start": 13,
"type": "Identifier"
},
"commentStart": 13,
"end": 32,
"start": 13,
"type": "CallExpression",
@ -40,6 +46,7 @@ expression: actual
{
"arguments": [
{
"commentStart": 124,
"end": 125,
"start": 124,
"type": "PipeSubstitution",
@ -47,22 +54,26 @@ expression: actual
}
],
"callee": {
"commentStart": 109,
"end": 123,
"name": "startProfileAt",
"start": 109,
"type": "Identifier"
},
"commentStart": 109,
"end": 126,
"start": 109,
"type": "CallExpression",
"type": "CallExpression"
}
],
"commentStart": 13,
"end": 126,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"commentStart": 35,
"end": 46,
"start": 35,
"type": "NonCodeNode",
@ -73,6 +84,7 @@ expression: actual
}
},
{
"commentStart": 49,
"end": 68,
"start": 49,
"type": "NonCodeNode",
@ -83,6 +95,7 @@ expression: actual
}
},
{
"commentStart": 71,
"end": 92,
"start": 71,
"type": "NonCodeNode",
@ -93,6 +106,7 @@ expression: actual
}
},
{
"commentStart": 95,
"end": 103,
"start": 95,
"type": "NonCodeNode",
@ -120,6 +134,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 127,
"start": 0
}

View File

@ -1,23 +1,29 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 1,
"declaration": {
"commentStart": 1,
"end": 25,
"id": {
"commentStart": 1,
"end": 5,
"name": "my14",
"start": 1,
"type": "Identifier"
},
"init": {
"commentStart": 8,
"end": 25,
"left": {
"commentStart": 8,
"end": 13,
"left": {
"commentStart": 8,
"end": 9,
"raw": "4",
"start": 8,
@ -30,6 +36,7 @@ expression: actual
},
"operator": "^",
"right": {
"commentStart": 12,
"end": 13,
"raw": "2",
"start": 12,
@ -46,10 +53,13 @@ expression: actual
},
"operator": "-",
"right": {
"commentStart": 16,
"end": 25,
"left": {
"commentStart": 16,
"end": 21,
"left": {
"commentStart": 16,
"end": 17,
"raw": "3",
"start": 16,
@ -62,6 +72,7 @@ expression: actual
},
"operator": "^",
"right": {
"commentStart": 20,
"end": 21,
"raw": "2",
"start": 20,
@ -78,6 +89,7 @@ expression: actual
},
"operator": "*",
"right": {
"commentStart": 24,
"end": 25,
"raw": "2",
"start": 24,
@ -106,6 +118,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 26,
"start": 0
}

View File

@ -1,20 +1,25 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 68,
"id": {
"commentStart": 0,
"end": 1,
"name": "x",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 4,
"cond": {
"commentStart": 7,
"end": 11,
"raw": "true",
"start": 7,
@ -28,8 +33,10 @@ expression: actual
"final_else": {
"body": [
{
"commentStart": 57,
"end": 58,
"expression": {
"commentStart": 57,
"end": 58,
"raw": "4",
"start": 57,
@ -45,6 +52,7 @@ expression: actual
"type": "ExpressionStatement"
}
],
"commentStart": 57,
"end": 67,
"start": 57
},
@ -52,8 +60,10 @@ expression: actual
"then_val": {
"body": [
{
"commentStart": 26,
"end": 27,
"expression": {
"commentStart": 26,
"end": 27,
"raw": "3",
"start": 26,
@ -69,6 +79,7 @@ expression: actual
"type": "ExpressionStatement"
}
],
"commentStart": 26,
"end": 36,
"start": 26
},
@ -85,6 +96,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 68,
"start": 0
}

View File

@ -1,20 +1,25 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 115,
"id": {
"commentStart": 0,
"end": 1,
"name": "x",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 4,
"cond": {
"commentStart": 7,
"end": 11,
"raw": "true",
"start": 7,
@ -25,9 +30,11 @@ expression: actual
"digest": null,
"else_ifs": [
{
"commentStart": 38,
"cond": {
"arguments": [
{
"commentStart": 51,
"end": 57,
"name": "radius",
"start": 51,
@ -36,11 +43,13 @@ expression: actual
}
],
"callee": {
"commentStart": 46,
"end": 50,
"name": "func",
"start": 46,
"type": "Identifier"
},
"commentStart": 46,
"end": 58,
"start": 46,
"type": "CallExpression",
@ -52,8 +61,10 @@ expression: actual
"then_val": {
"body": [
{
"commentStart": 73,
"end": 74,
"expression": {
"commentStart": 73,
"end": 74,
"raw": "4",
"start": 73,
@ -69,6 +80,7 @@ expression: actual
"type": "ExpressionStatement"
}
],
"commentStart": 59,
"end": 83,
"start": 59
},
@ -79,8 +91,10 @@ expression: actual
"final_else": {
"body": [
{
"commentStart": 104,
"end": 105,
"expression": {
"commentStart": 104,
"end": 105,
"raw": "5",
"start": 104,
@ -96,6 +110,7 @@ expression: actual
"type": "ExpressionStatement"
}
],
"commentStart": 104,
"end": 114,
"start": 104
},
@ -103,8 +118,10 @@ expression: actual
"then_val": {
"body": [
{
"commentStart": 26,
"end": 27,
"expression": {
"commentStart": 26,
"end": 27,
"raw": "3",
"start": 26,
@ -120,6 +137,7 @@ expression: actual
"type": "ExpressionStatement"
}
],
"commentStart": 26,
"end": 36,
"start": 26
},
@ -136,6 +154,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 115,
"start": 0
}

View File

@ -1,21 +1,26 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 4,
"end": 14,
"id": {
"commentStart": 4,
"end": 5,
"name": "x",
"start": 4,
"type": "Identifier"
},
"init": {
"commentStart": 8,
"end": 14,
"left": {
"commentStart": 8,
"end": 9,
"raw": "3",
"start": 8,
@ -28,6 +33,7 @@ expression: actual
},
"operator": "==",
"right": {
"commentStart": 13,
"end": 14,
"raw": "3",
"start": 13,
@ -52,6 +58,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 14,
"start": 0
}

View File

@ -1,21 +1,26 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 4,
"end": 14,
"id": {
"commentStart": 4,
"end": 5,
"name": "x",
"start": 4,
"type": "Identifier"
},
"init": {
"commentStart": 8,
"end": 14,
"left": {
"commentStart": 8,
"end": 9,
"raw": "3",
"start": 8,
@ -28,6 +33,7 @@ expression: actual
},
"operator": "!=",
"right": {
"commentStart": 13,
"end": 14,
"raw": "3",
"start": 13,
@ -52,6 +58,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 14,
"start": 0
}

View File

@ -1,19 +1,23 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 5,
"id": {
"commentStart": 0,
"end": 1,
"name": "x",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 4,
"end": 5,
"raw": "4",
"start": 4,
@ -34,6 +38,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 5,
"start": 0
}

View File

@ -1,24 +1,30 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 36,
"id": {
"commentStart": 0,
"end": 3,
"name": "obj",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 6,
"end": 36,
"properties": [
{
"commentStart": 7,
"end": 24,
"key": {
"commentStart": 7,
"end": 13,
"name": "center",
"start": 7,
@ -27,8 +33,10 @@ expression: actual
"start": 7,
"type": "ObjectProperty",
"value": {
"commentStart": 16,
"elements": [
{
"commentStart": 17,
"end": 19,
"raw": "10",
"start": 17,
@ -40,6 +48,7 @@ expression: actual
}
},
{
"commentStart": 21,
"end": 23,
"raw": "10",
"start": 21,
@ -58,8 +67,10 @@ expression: actual
}
},
{
"commentStart": 26,
"end": 35,
"key": {
"commentStart": 26,
"end": 32,
"name": "radius",
"start": 26,
@ -68,6 +79,7 @@ expression: actual
"start": 26,
"type": "ObjectProperty",
"value": {
"commentStart": 34,
"end": 35,
"raw": "5",
"start": 34,
@ -94,6 +106,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 36,
"start": 0
}

View File

@ -1,19 +1,23 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 5,
"id": {
"commentStart": 0,
"end": 1,
"name": "x",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 4,
"end": 5,
"raw": "3",
"start": 4,
@ -34,20 +38,26 @@ expression: actual
"type": "VariableDeclaration"
},
{
"commentStart": 14,
"declaration": {
"commentStart": 14,
"end": 30,
"id": {
"commentStart": 14,
"end": 17,
"name": "obj",
"start": 14,
"type": "Identifier"
},
"init": {
"commentStart": 20,
"end": 30,
"properties": [
{
"commentStart": 22,
"end": 23,
"key": {
"commentStart": 22,
"end": 23,
"name": "x",
"start": 22,
@ -56,6 +66,7 @@ expression: actual
"start": 22,
"type": "ObjectProperty",
"value": {
"commentStart": 22,
"end": 23,
"name": "x",
"start": 22,
@ -64,8 +75,10 @@ expression: actual
}
},
{
"commentStart": 25,
"end": 29,
"key": {
"commentStart": 25,
"end": 26,
"name": "y",
"start": 25,
@ -74,6 +87,7 @@ expression: actual
"start": 25,
"type": "ObjectProperty",
"value": {
"commentStart": 28,
"end": 29,
"raw": "4",
"start": 28,
@ -100,6 +114,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 30,
"start": 0
}

View File

@ -1,12 +1,14 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"end": 4,
"expression": {
"commentStart": 0,
"end": 4,
"raw": "true",
"start": 0,
@ -19,6 +21,7 @@ expression: actual
"type": "ExpressionStatement"
}
],
"commentStart": 0,
"end": 4,
"start": 0
}

View File

@ -1,12 +1,14 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"end": 5,
"expression": {
"commentStart": 0,
"end": 5,
"name": "truee",
"start": 0,
@ -18,6 +20,7 @@ expression: actual
"type": "ExpressionStatement"
}
],
"commentStart": 0,
"end": 5,
"start": 0
}

View File

@ -1,13 +1,16 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 9,
"id": {
"commentStart": 0,
"end": 1,
"name": "x",
"start": 0,
@ -15,6 +18,7 @@ expression: actual
},
"init": {
"argument": {
"commentStart": 5,
"end": 9,
"raw": "true",
"start": 5,
@ -22,6 +26,7 @@ expression: actual
"type": "Literal",
"value": true
},
"commentStart": 4,
"end": 9,
"operator": "!",
"start": 4,
@ -38,6 +43,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 9,
"start": 0
}

View File

@ -1,21 +1,26 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 16,
"id": {
"commentStart": 0,
"end": 1,
"name": "x",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 4,
"end": 16,
"left": {
"commentStart": 4,
"end": 8,
"raw": "true",
"start": 4,
@ -25,6 +30,7 @@ expression: actual
},
"operator": "&",
"right": {
"commentStart": 11,
"end": 16,
"raw": "false",
"start": 11,
@ -46,6 +52,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 16,
"start": 0
}

View File

@ -1,21 +1,26 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 16,
"id": {
"commentStart": 0,
"end": 1,
"name": "x",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 4,
"end": 16,
"left": {
"commentStart": 4,
"end": 8,
"raw": "true",
"start": 4,
@ -25,6 +30,7 @@ expression: actual
},
"operator": "|",
"right": {
"commentStart": 11,
"end": 16,
"raw": "false",
"start": 11,
@ -46,6 +52,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 16,
"start": 0
}

View File

@ -1,13 +1,16 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 29,
"id": {
"commentStart": 0,
"end": 5,
"name": "myVar",
"start": 0,
@ -19,6 +22,7 @@ expression: actual
"argument": {
"arguments": [
{
"commentStart": 20,
"end": 21,
"raw": "5",
"start": 20,
@ -30,6 +34,7 @@ expression: actual
}
},
{
"commentStart": 23,
"end": 24,
"raw": "4",
"start": 23,
@ -42,16 +47,19 @@ expression: actual
}
],
"callee": {
"commentStart": 13,
"end": 19,
"name": "legLen",
"start": 13,
"type": "Identifier"
},
"commentStart": 13,
"end": 25,
"start": 13,
"type": "CallExpression",
"type": "CallExpression"
},
"commentStart": 12,
"end": 25,
"operator": "-",
"start": 12,
@ -59,6 +67,7 @@ expression: actual
"type": "UnaryExpression"
},
{
"commentStart": 27,
"end": 28,
"raw": "5",
"start": 27,
@ -71,11 +80,13 @@ expression: actual
}
],
"callee": {
"commentStart": 8,
"end": 11,
"name": "min",
"start": 8,
"type": "Identifier"
},
"commentStart": 8,
"end": 29,
"start": 8,
"type": "CallExpression",
@ -91,6 +102,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 29,
"start": 0
}

View File

@ -1,13 +1,16 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 30,
"id": {
"commentStart": 0,
"end": 5,
"name": "myVar",
"start": 0,
@ -16,8 +19,10 @@ expression: actual
"init": {
"body": [
{
"commentStart": 8,
"end": 13,
"left": {
"commentStart": 8,
"end": 9,
"raw": "5",
"start": 8,
@ -30,6 +35,7 @@ expression: actual
},
"operator": "+",
"right": {
"commentStart": 12,
"end": 13,
"raw": "6",
"start": 12,
@ -47,6 +53,7 @@ expression: actual
{
"arguments": [
{
"commentStart": 24,
"end": 26,
"raw": "45",
"start": 24,
@ -58,6 +65,7 @@ expression: actual
}
},
{
"commentStart": 28,
"end": 29,
"start": 28,
"type": "PipeSubstitution",
@ -65,17 +73,20 @@ expression: actual
}
],
"callee": {
"commentStart": 17,
"end": 23,
"name": "myFunc",
"start": 17,
"type": "Identifier"
},
"commentStart": 17,
"end": 30,
"start": 17,
"type": "CallExpression",
"type": "CallExpression"
}
],
"commentStart": 8,
"end": 30,
"start": 8,
"type": "PipeExpression",
@ -91,6 +102,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 30,
"start": 0
}

View File

@ -1,28 +1,34 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 21,
"id": {
"commentStart": 0,
"end": 1,
"name": "x",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 4,
"end": 21,
"left": {
"argument": {
"commentStart": 5,
"end": 9,
"name": "leg2",
"start": 5,
"type": "Identifier",
"type": "Identifier"
},
"commentStart": 4,
"end": 9,
"operator": "-",
"start": 4,
@ -31,6 +37,7 @@ expression: actual
},
"operator": "+",
"right": {
"commentStart": 12,
"end": 21,
"name": "thickness",
"start": 12,
@ -51,6 +58,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 21,
"start": 0
}

View File

@ -1,21 +1,26 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 4,
"end": 18,
"id": {
"commentStart": 4,
"end": 5,
"name": "x",
"start": 4,
"type": "Identifier"
},
"init": {
"commentStart": 8,
"end": 18,
"left": {
"commentStart": 8,
"end": 9,
"raw": "1",
"start": 8,
@ -28,8 +33,10 @@ expression: actual
},
"operator": "*",
"right": {
"commentStart": 13,
"end": 18,
"left": {
"commentStart": 13,
"end": 14,
"raw": "3",
"start": 13,
@ -42,6 +49,7 @@ expression: actual
},
"operator": "-",
"right": {
"commentStart": 17,
"end": 18,
"raw": "4",
"start": 17,
@ -70,6 +78,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 18,
"start": 0
}

View File

@ -1,19 +1,23 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 5,
"id": {
"commentStart": 0,
"end": 1,
"name": "x",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 4,
"end": 5,
"raw": "1",
"start": 4,
@ -34,11 +38,13 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 34,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"commentStart": 5,
"end": 34,
"start": 5,
"type": "NonCodeNode",

View File

@ -1,13 +1,16 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 3,
"end": 58,
"id": {
"commentStart": 3,
"end": 4,
"name": "x",
"start": 3,
@ -18,12 +21,14 @@ expression: actual
"body": [
{
"argument": {
"commentStart": 30,
"end": 32,
"name": "sg",
"start": 30,
"type": "Identifier",
"type": "Identifier"
},
"commentStart": 23,
"end": 32,
"start": 23,
"type": "ReturnStatement",
@ -31,21 +36,25 @@ expression: actual
},
{
"argument": {
"commentStart": 48,
"end": 50,
"name": "sg",
"start": 48,
"type": "Identifier",
"type": "Identifier"
},
"commentStart": 41,
"end": 50,
"start": 41,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"commentStart": 13,
"end": 58,
"start": 13
},
"commentStart": 7,
"end": 58,
"params": [],
"start": 7,
@ -62,6 +71,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 58,
"start": 0
}

View File

@ -1,24 +1,30 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 20,
"id": {
"commentStart": 0,
"end": 3,
"name": "obj",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 6,
"end": 20,
"properties": [
{
"commentStart": 8,
"end": 12,
"key": {
"commentStart": 8,
"end": 9,
"name": "a",
"start": 8,
@ -27,6 +33,7 @@ expression: actual
"start": 8,
"type": "ObjectProperty",
"value": {
"commentStart": 11,
"end": 12,
"raw": "1",
"start": 11,
@ -39,8 +46,10 @@ expression: actual
}
},
{
"commentStart": 14,
"end": 18,
"key": {
"commentStart": 14,
"end": 15,
"name": "b",
"start": 14,
@ -49,6 +58,7 @@ expression: actual
"start": 14,
"type": "ObjectProperty",
"value": {
"commentStart": 17,
"end": 18,
"raw": "2",
"start": 17,
@ -75,17 +85,22 @@ expression: actual
"type": "VariableDeclaration"
},
{
"commentStart": 25,
"declaration": {
"commentStart": 25,
"end": 43,
"id": {
"commentStart": 25,
"end": 31,
"name": "height",
"start": 25,
"type": "Identifier"
},
"init": {
"commentStart": 34,
"end": 43,
"left": {
"commentStart": 34,
"end": 35,
"raw": "1",
"start": 34,
@ -98,9 +113,11 @@ expression: actual
},
"operator": "-",
"right": {
"commentStart": 38,
"computed": false,
"end": 43,
"object": {
"commentStart": 38,
"end": 41,
"name": "obj",
"start": 38,
@ -108,6 +125,7 @@ expression: actual
"type": "Identifier"
},
"property": {
"commentStart": 42,
"end": 43,
"name": "a",
"start": 42,
@ -132,6 +150,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 43,
"start": 0
}

View File

@ -1,24 +1,30 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 20,
"id": {
"commentStart": 0,
"end": 3,
"name": "obj",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 6,
"end": 20,
"properties": [
{
"commentStart": 8,
"end": 12,
"key": {
"commentStart": 8,
"end": 9,
"name": "a",
"start": 8,
@ -27,6 +33,7 @@ expression: actual
"start": 8,
"type": "ObjectProperty",
"value": {
"commentStart": 11,
"end": 12,
"raw": "1",
"start": 11,
@ -39,8 +46,10 @@ expression: actual
}
},
{
"commentStart": 14,
"end": 18,
"key": {
"commentStart": 14,
"end": 15,
"name": "b",
"start": 14,
@ -49,6 +58,7 @@ expression: actual
"start": 14,
"type": "ObjectProperty",
"value": {
"commentStart": 17,
"end": 18,
"raw": "2",
"start": 17,
@ -75,17 +85,22 @@ expression: actual
"type": "VariableDeclaration"
},
{
"commentStart": 26,
"declaration": {
"commentStart": 26,
"end": 47,
"id": {
"commentStart": 26,
"end": 32,
"name": "height",
"start": 26,
"type": "Identifier"
},
"init": {
"commentStart": 35,
"end": 47,
"left": {
"commentStart": 35,
"end": 36,
"raw": "1",
"start": 35,
@ -98,9 +113,11 @@ expression: actual
},
"operator": "-",
"right": {
"commentStart": 39,
"computed": false,
"end": 47,
"object": {
"commentStart": 39,
"end": 42,
"name": "obj",
"start": 39,
@ -108,6 +125,7 @@ expression: actual
"type": "Identifier"
},
"property": {
"commentStart": 43,
"end": 46,
"raw": "\"a\"",
"start": 43,
@ -133,6 +151,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 47,
"start": 0
}

View File

@ -1,24 +1,30 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 20,
"id": {
"commentStart": 0,
"end": 3,
"name": "obj",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 6,
"end": 20,
"properties": [
{
"commentStart": 8,
"end": 12,
"key": {
"commentStart": 8,
"end": 9,
"name": "a",
"start": 8,
@ -27,6 +33,7 @@ expression: actual
"start": 8,
"type": "ObjectProperty",
"value": {
"commentStart": 11,
"end": 12,
"raw": "1",
"start": 11,
@ -39,8 +46,10 @@ expression: actual
}
},
{
"commentStart": 14,
"end": 18,
"key": {
"commentStart": 14,
"end": 15,
"name": "b",
"start": 14,
@ -49,6 +58,7 @@ expression: actual
"start": 14,
"type": "ObjectProperty",
"value": {
"commentStart": 17,
"end": 18,
"raw": "2",
"start": 17,
@ -75,20 +85,26 @@ expression: actual
"type": "VariableDeclaration"
},
{
"commentStart": 25,
"declaration": {
"commentStart": 25,
"end": 46,
"id": {
"commentStart": 25,
"end": 31,
"name": "height",
"start": 25,
"type": "Identifier"
},
"init": {
"commentStart": 34,
"end": 46,
"left": {
"commentStart": 34,
"computed": false,
"end": 42,
"object": {
"commentStart": 34,
"end": 37,
"name": "obj",
"start": 34,
@ -96,6 +112,7 @@ expression: actual
"type": "Identifier"
},
"property": {
"commentStart": 38,
"end": 41,
"raw": "\"a\"",
"start": 38,
@ -109,6 +126,7 @@ expression: actual
},
"operator": "-",
"right": {
"commentStart": 45,
"end": 46,
"raw": "1",
"start": 45,
@ -133,6 +151,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 46,
"start": 0
}

View File

@ -1,24 +1,30 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 20,
"id": {
"commentStart": 0,
"end": 3,
"name": "obj",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 6,
"end": 20,
"properties": [
{
"commentStart": 8,
"end": 12,
"key": {
"commentStart": 8,
"end": 9,
"name": "a",
"start": 8,
@ -27,6 +33,7 @@ expression: actual
"start": 8,
"type": "ObjectProperty",
"value": {
"commentStart": 11,
"end": 12,
"raw": "1",
"start": 11,
@ -39,8 +46,10 @@ expression: actual
}
},
{
"commentStart": 14,
"end": 18,
"key": {
"commentStart": 14,
"end": 15,
"name": "b",
"start": 14,
@ -49,6 +58,7 @@ expression: actual
"start": 14,
"type": "ObjectProperty",
"value": {
"commentStart": 17,
"end": 18,
"raw": "2",
"start": 17,
@ -75,19 +85,25 @@ expression: actual
"type": "VariableDeclaration"
},
{
"commentStart": 25,
"declaration": {
"commentStart": 25,
"end": 51,
"id": {
"commentStart": 25,
"end": 31,
"name": "height",
"start": 25,
"type": "Identifier"
},
"init": {
"commentStart": 34,
"elements": [
{
"commentStart": 35,
"end": 47,
"left": {
"commentStart": 35,
"end": 36,
"raw": "1",
"start": 35,
@ -100,9 +116,11 @@ expression: actual
},
"operator": "-",
"right": {
"commentStart": 39,
"computed": false,
"end": 47,
"object": {
"commentStart": 39,
"end": 42,
"name": "obj",
"start": 39,
@ -110,6 +128,7 @@ expression: actual
"type": "Identifier"
},
"property": {
"commentStart": 43,
"end": 46,
"raw": "\"a\"",
"start": 43,
@ -126,6 +145,7 @@ expression: actual
"type": "BinaryExpression"
},
{
"commentStart": 49,
"end": 50,
"raw": "0",
"start": 49,
@ -152,6 +172,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 51,
"start": 0
}

View File

@ -5,9 +5,12 @@ expression: actual
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 23,
"id": {
"commentStart": 0,
"end": 3,
"name": "val",
"start": 0,
@ -18,12 +21,14 @@ expression: actual
{
"type": "LabeledArg",
"label": {
"commentStart": 10,
"end": 11,
"name": "x",
"start": 10,
"type": "Identifier"
},
"arg": {
"commentStart": 14,
"end": 15,
"name": "a",
"start": 14,
@ -34,12 +39,14 @@ expression: actual
{
"type": "LabeledArg",
"label": {
"commentStart": 17,
"end": 18,
"name": "y",
"start": 17,
"type": "Identifier"
},
"arg": {
"commentStart": 21,
"end": 22,
"name": "b",
"start": 21,
@ -49,11 +56,13 @@ expression: actual
}
],
"callee": {
"commentStart": 6,
"end": 9,
"name": "foo",
"start": 6,
"type": "Identifier"
},
"commentStart": 6,
"end": 23,
"start": 6,
"type": "CallExpressionKw",
@ -70,6 +79,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 23,
"start": 0
}

View File

@ -5,9 +5,12 @@ expression: actual
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 21,
"id": {
"commentStart": 0,
"end": 3,
"name": "val",
"start": 0,
@ -16,6 +19,7 @@ expression: actual
"init": {
"body": [
{
"commentStart": 6,
"end": 7,
"raw": "1",
"start": 6,
@ -31,12 +35,14 @@ expression: actual
{
"type": "LabeledArg",
"label": {
"commentStart": 13,
"end": 16,
"name": "arg",
"start": 13,
"type": "Identifier"
},
"arg": {
"commentStart": 19,
"end": 20,
"name": "x",
"start": 19,
@ -46,11 +52,13 @@ expression: actual
}
],
"callee": {
"commentStart": 11,
"end": 12,
"name": "f",
"start": 11,
"type": "Identifier"
},
"commentStart": 11,
"end": 21,
"start": 11,
"type": "CallExpressionKw",
@ -58,6 +66,7 @@ expression: actual
"unlabeled": null
}
],
"commentStart": 6,
"end": 21,
"start": 6,
"type": "PipeExpression",
@ -73,6 +82,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 21,
"start": 0
}

View File

@ -5,9 +5,12 @@ expression: actual
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 87,
"id": {
"commentStart": 0,
"end": 3,
"name": "val",
"start": 0,
@ -18,12 +21,14 @@ expression: actual
{
"type": "LabeledArg",
"label": {
"commentStart": 22,
"end": 25,
"name": "arg",
"start": 22,
"type": "Identifier"
},
"arg": {
"commentStart": 28,
"end": 29,
"name": "x",
"start": 28,
@ -34,12 +39,14 @@ expression: actual
{
"type": "LabeledArg",
"label": {
"commentStart": 44,
"end": 47,
"name": "foo",
"start": 44,
"type": "Identifier"
},
"arg": {
"commentStart": 50,
"end": 51,
"name": "x",
"start": 50,
@ -50,12 +57,14 @@ expression: actual
{
"type": "LabeledArg",
"label": {
"commentStart": 66,
"end": 69,
"name": "bar",
"start": 66,
"type": "Identifier"
},
"arg": {
"commentStart": 72,
"end": 73,
"name": "x",
"start": 72,
@ -65,11 +74,13 @@ expression: actual
}
],
"callee": {
"commentStart": 6,
"end": 7,
"name": "f",
"start": 6,
"type": "Identifier"
},
"commentStart": 6,
"end": 87,
"start": 6,
"type": "CallExpressionKw",
@ -86,6 +97,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 87,
"start": 0
}

View File

@ -5,9 +5,12 @@ expression: actual
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 90,
"id": {
"commentStart": 0,
"end": 3,
"name": "val",
"start": 0,
@ -18,12 +21,14 @@ expression: actual
{
"type": "LabeledArg",
"label": {
"commentStart": 22,
"end": 25,
"name": "arg",
"start": 22,
"type": "Identifier"
},
"arg": {
"commentStart": 28,
"end": 29,
"name": "x",
"start": 28,
@ -34,12 +39,14 @@ expression: actual
{
"type": "LabeledArg",
"label": {
"commentStart": 69,
"end": 72,
"name": "bar",
"start": 69,
"type": "Identifier"
},
"arg": {
"commentStart": 75,
"end": 76,
"name": "x",
"start": 75,
@ -49,16 +56,19 @@ expression: actual
}
],
"callee": {
"commentStart": 6,
"end": 7,
"name": "f",
"start": 6,
"type": "Identifier"
},
"commentStart": 6,
"end": 90,
"nonCodeMeta": {
"nonCodeNodes": {
"1": [
{
"commentStart": 44,
"end": 55,
"start": 44,
"type": "NonCodeNode",
@ -87,6 +97,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 90,
"start": 0
}

View File

@ -1,13 +1,16 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 3,
"end": 25,
"id": {
"commentStart": 3,
"end": 6,
"name": "foo",
"start": 3,
@ -18,6 +21,7 @@ expression: actual
"body": [
{
"argument": {
"commentStart": 22,
"end": 23,
"raw": "1",
"start": 22,
@ -28,20 +32,24 @@ expression: actual
"suffix": "None"
}
},
"commentStart": 15,
"end": 23,
"start": 15,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"commentStart": 13,
"end": 25,
"start": 13
},
"commentStart": 6,
"end": 25,
"params": [
{
"type": "Parameter",
"identifier": {
"commentStart": 7,
"end": 8,
"name": "x",
"start": 7,
@ -51,6 +59,7 @@ expression: actual
{
"type": "Parameter",
"identifier": {
"commentStart": 10,
"end": 11,
"name": "y",
"start": 10,
@ -72,6 +81,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 25,
"start": 0
}

View File

@ -1,13 +1,16 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 3,
"end": 26,
"id": {
"commentStart": 3,
"end": 6,
"name": "foo",
"start": 3,
@ -18,6 +21,7 @@ expression: actual
"body": [
{
"argument": {
"commentStart": 23,
"end": 24,
"raw": "1",
"start": 23,
@ -28,20 +32,24 @@ expression: actual
"suffix": "None"
}
},
"commentStart": 16,
"end": 24,
"start": 16,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"commentStart": 14,
"end": 26,
"start": 14
},
"commentStart": 6,
"end": 26,
"params": [
{
"type": "Parameter",
"identifier": {
"commentStart": 8,
"end": 9,
"name": "x",
"start": 8,
@ -52,6 +60,7 @@ expression: actual
{
"type": "Parameter",
"identifier": {
"commentStart": 11,
"end": 12,
"name": "y",
"start": 11,
@ -73,6 +82,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 26,
"start": 0
}

View File

@ -1,13 +1,16 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 3,
"end": 35,
"id": {
"commentStart": 3,
"end": 6,
"name": "foo",
"start": 3,
@ -18,6 +21,7 @@ expression: actual
"body": [
{
"argument": {
"commentStart": 32,
"end": 33,
"raw": "1",
"start": 32,
@ -28,26 +32,31 @@ expression: actual
"suffix": "None"
}
},
"commentStart": 25,
"end": 33,
"start": 25,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"commentStart": 23,
"end": 35,
"start": 23
},
"commentStart": 6,
"end": 35,
"params": [
{
"type": "Parameter",
"identifier": {
"commentStart": 7,
"end": 8,
"name": "x",
"start": 7,
"type": "Identifier"
},
"default_value": {
"commentStart": 20,
"end": 21,
"raw": "2",
"start": 20,
@ -74,6 +83,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 35,
"start": 0
}

View File

@ -1,13 +1,16 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 3,
"end": 27,
"id": {
"commentStart": 3,
"end": 6,
"name": "foo",
"start": 3,
@ -18,6 +21,7 @@ expression: actual
"body": [
{
"argument": {
"commentStart": 24,
"end": 25,
"raw": "1",
"start": 24,
@ -28,26 +32,31 @@ expression: actual
"suffix": "None"
}
},
"commentStart": 17,
"end": 25,
"start": 17,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"commentStart": 15,
"end": 27,
"start": 15
},
"commentStart": 6,
"end": 27,
"params": [
{
"type": "Parameter",
"identifier": {
"commentStart": 7,
"end": 8,
"name": "x",
"start": 7,
"type": "Identifier"
},
"default_value": {
"commentStart": 12,
"end": 13,
"raw": "2",
"start": 12,
@ -74,6 +83,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 27,
"start": 0
}

View File

@ -5,9 +5,12 @@ expression: actual
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 19,
"id": {
"commentStart": 0,
"end": 3,
"name": "val",
"start": 0,
@ -18,12 +21,14 @@ expression: actual
{
"type": "LabeledArg",
"label": {
"commentStart": 13,
"end": 14,
"name": "y",
"start": 13,
"type": "Identifier"
},
"arg": {
"commentStart": 17,
"end": 18,
"name": "z",
"start": 17,
@ -33,16 +38,19 @@ expression: actual
}
],
"callee": {
"commentStart": 6,
"end": 9,
"name": "foo",
"start": 6,
"type": "Identifier"
},
"commentStart": 6,
"end": 19,
"start": 6,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"commentStart": 10,
"end": 11,
"name": "x",
"start": 10,
@ -60,6 +68,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 19,
"start": 0
}

View File

@ -1,24 +1,30 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 20,
"id": {
"commentStart": 0,
"end": 3,
"name": "obj",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 6,
"end": 20,
"properties": [
{
"commentStart": 8,
"end": 12,
"key": {
"commentStart": 8,
"end": 9,
"name": "a",
"start": 8,
@ -27,6 +33,7 @@ expression: actual
"start": 8,
"type": "ObjectProperty",
"value": {
"commentStart": 11,
"end": 12,
"raw": "1",
"start": 11,
@ -39,8 +46,10 @@ expression: actual
}
},
{
"commentStart": 14,
"end": 18,
"key": {
"commentStart": 14,
"end": 15,
"name": "b",
"start": 14,
@ -49,6 +58,7 @@ expression: actual
"start": 14,
"type": "ObjectProperty",
"value": {
"commentStart": 17,
"end": 18,
"raw": "2",
"start": 17,
@ -75,22 +85,29 @@ expression: actual
"type": "VariableDeclaration"
},
{
"commentStart": 25,
"declaration": {
"commentStart": 25,
"end": 51,
"id": {
"commentStart": 25,
"end": 31,
"name": "height",
"start": 25,
"type": "Identifier"
},
"init": {
"commentStart": 34,
"elements": [
{
"commentStart": 35,
"end": 47,
"left": {
"commentStart": 35,
"computed": false,
"end": 43,
"object": {
"commentStart": 35,
"end": 38,
"name": "obj",
"start": 35,
@ -98,6 +115,7 @@ expression: actual
"type": "Identifier"
},
"property": {
"commentStart": 39,
"end": 42,
"raw": "\"a\"",
"start": 39,
@ -111,6 +129,7 @@ expression: actual
},
"operator": "-",
"right": {
"commentStart": 46,
"end": 47,
"raw": "1",
"start": 46,
@ -126,6 +145,7 @@ expression: actual
"type": "BinaryExpression"
},
{
"commentStart": 49,
"end": 50,
"raw": "0",
"start": 49,
@ -152,6 +172,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 51,
"start": 0
}

View File

@ -1,24 +1,30 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 20,
"id": {
"commentStart": 0,
"end": 3,
"name": "obj",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 6,
"end": 20,
"properties": [
{
"commentStart": 8,
"end": 12,
"key": {
"commentStart": 8,
"end": 9,
"name": "a",
"start": 8,
@ -27,6 +33,7 @@ expression: actual
"start": 8,
"type": "ObjectProperty",
"value": {
"commentStart": 11,
"end": 12,
"raw": "1",
"start": 11,
@ -39,8 +46,10 @@ expression: actual
}
},
{
"commentStart": 14,
"end": 18,
"key": {
"commentStart": 14,
"end": 15,
"name": "b",
"start": 14,
@ -49,6 +58,7 @@ expression: actual
"start": 14,
"type": "ObjectProperty",
"value": {
"commentStart": 17,
"end": 18,
"raw": "2",
"start": 17,
@ -75,22 +85,29 @@ expression: actual
"type": "VariableDeclaration"
},
{
"commentStart": 25,
"declaration": {
"commentStart": 25,
"end": 50,
"id": {
"commentStart": 25,
"end": 31,
"name": "height",
"start": 25,
"type": "Identifier"
},
"init": {
"commentStart": 34,
"elements": [
{
"commentStart": 35,
"end": 46,
"left": {
"commentStart": 35,
"computed": false,
"end": 43,
"object": {
"commentStart": 35,
"end": 38,
"name": "obj",
"start": 35,
@ -98,6 +115,7 @@ expression: actual
"type": "Identifier"
},
"property": {
"commentStart": 39,
"end": 42,
"raw": "\"a\"",
"start": 39,
@ -111,6 +129,7 @@ expression: actual
},
"operator": "-",
"right": {
"commentStart": 45,
"end": 46,
"raw": "1",
"start": 45,
@ -126,6 +145,7 @@ expression: actual
"type": "BinaryExpression"
},
{
"commentStart": 48,
"end": 49,
"raw": "0",
"start": 48,
@ -152,6 +172,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 50,
"start": 0
}

View File

@ -1,21 +1,26 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 18,
"id": {
"commentStart": 0,
"end": 6,
"name": "height",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 9,
"end": 18,
"left": {
"commentStart": 9,
"end": 10,
"raw": "1",
"start": 9,
@ -28,9 +33,11 @@ expression: actual
},
"operator": "-",
"right": {
"commentStart": 13,
"computed": false,
"end": 18,
"object": {
"commentStart": 13,
"end": 16,
"name": "obj",
"start": 13,
@ -38,6 +45,7 @@ expression: actual
"type": "Identifier"
},
"property": {
"commentStart": 17,
"end": 18,
"name": "a",
"start": 17,
@ -62,6 +70,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 18,
"start": 0
}

View File

@ -1,23 +1,29 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 15,
"id": {
"commentStart": 0,
"end": 3,
"name": "six",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 6,
"end": 15,
"left": {
"commentStart": 6,
"end": 11,
"left": {
"commentStart": 6,
"end": 7,
"raw": "1",
"start": 6,
@ -30,6 +36,7 @@ expression: actual
},
"operator": "+",
"right": {
"commentStart": 10,
"end": 11,
"raw": "2",
"start": 10,
@ -46,6 +53,7 @@ expression: actual
},
"operator": "+",
"right": {
"commentStart": 14,
"end": 15,
"raw": "3",
"start": 14,
@ -70,6 +78,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 15,
"start": 0
}

View File

@ -1,23 +1,29 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 16,
"id": {
"commentStart": 0,
"end": 4,
"name": "five",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 7,
"end": 16,
"left": {
"commentStart": 7,
"end": 12,
"left": {
"commentStart": 7,
"end": 8,
"raw": "3",
"start": 7,
@ -30,6 +36,7 @@ expression: actual
},
"operator": "*",
"right": {
"commentStart": 11,
"end": 12,
"raw": "1",
"start": 11,
@ -46,6 +53,7 @@ expression: actual
},
"operator": "+",
"right": {
"commentStart": 15,
"end": 16,
"raw": "2",
"start": 15,
@ -70,6 +78,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 16,
"start": 0
}

View File

@ -1,24 +1,30 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 24,
"id": {
"commentStart": 0,
"end": 6,
"name": "height",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 9,
"elements": [
{
"commentStart": 11,
"computed": false,
"end": 19,
"object": {
"commentStart": 11,
"end": 14,
"name": "obj",
"start": 11,
@ -26,6 +32,7 @@ expression: actual
"type": "Identifier"
},
"property": {
"commentStart": 15,
"end": 18,
"raw": "\"a\"",
"start": 15,
@ -38,6 +45,7 @@ expression: actual
"type": "MemberExpression"
},
{
"commentStart": 21,
"end": 22,
"raw": "0",
"start": 21,
@ -64,6 +72,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 24,
"start": 0
}

View File

@ -1,24 +1,30 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 20,
"id": {
"commentStart": 0,
"end": 3,
"name": "obj",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 6,
"end": 20,
"properties": [
{
"commentStart": 8,
"end": 12,
"key": {
"commentStart": 8,
"end": 9,
"name": "a",
"start": 8,
@ -27,6 +33,7 @@ expression: actual
"start": 8,
"type": "ObjectProperty",
"value": {
"commentStart": 11,
"end": 12,
"raw": "1",
"start": 11,
@ -39,8 +46,10 @@ expression: actual
}
},
{
"commentStart": 14,
"end": 18,
"key": {
"commentStart": 14,
"end": 15,
"name": "b",
"start": 14,
@ -49,6 +58,7 @@ expression: actual
"start": 14,
"type": "ObjectProperty",
"value": {
"commentStart": 17,
"end": 18,
"raw": "2",
"start": 17,
@ -75,18 +85,23 @@ expression: actual
"type": "VariableDeclaration"
},
{
"commentStart": 25,
"declaration": {
"commentStart": 25,
"end": 42,
"id": {
"commentStart": 25,
"end": 31,
"name": "height",
"start": 25,
"type": "Identifier"
},
"init": {
"commentStart": 34,
"computed": false,
"end": 42,
"object": {
"commentStart": 34,
"end": 37,
"name": "obj",
"start": 34,
@ -94,6 +109,7 @@ expression: actual
"type": "Identifier"
},
"property": {
"commentStart": 38,
"end": 41,
"raw": "\"a\"",
"start": 38,
@ -115,6 +131,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 42,
"start": 0
}

View File

@ -1,25 +1,31 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 21,
"id": {
"commentStart": 0,
"end": 4,
"name": "prop",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 7,
"computed": true,
"end": 21,
"object": {
"commentStart": 7,
"computed": false,
"end": 16,
"object": {
"commentStart": 7,
"end": 9,
"name": "yo",
"start": 7,
@ -27,6 +33,7 @@ expression: actual
"type": "Identifier"
},
"property": {
"commentStart": 10,
"end": 15,
"raw": "\"one\"",
"start": 10,
@ -39,6 +46,7 @@ expression: actual
"type": "MemberExpression"
},
"property": {
"commentStart": 17,
"end": 20,
"name": "two",
"start": 17,
@ -59,6 +67,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 21,
"start": 0
}

View File

@ -1,22 +1,27 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 11,
"id": {
"commentStart": 0,
"end": 3,
"name": "pt1",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 6,
"computed": true,
"end": 11,
"object": {
"commentStart": 6,
"end": 8,
"name": "b1",
"start": 6,
@ -24,6 +29,7 @@ expression: actual
"type": "Identifier"
},
"property": {
"commentStart": 9,
"end": 10,
"name": "x",
"start": 9,
@ -44,6 +50,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 11,
"start": 0
}

View File

@ -1,31 +1,39 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 28,
"id": {
"commentStart": 0,
"end": 4,
"name": "prop",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 7,
"computed": false,
"end": 28,
"object": {
"commentStart": 7,
"computed": false,
"end": 23,
"object": {
"commentStart": 7,
"computed": false,
"end": 17,
"object": {
"commentStart": 7,
"computed": false,
"end": 13,
"object": {
"commentStart": 7,
"end": 9,
"name": "yo",
"start": 7,
@ -33,6 +41,7 @@ expression: actual
"type": "Identifier"
},
"property": {
"commentStart": 10,
"end": 13,
"name": "one",
"start": 10,
@ -44,6 +53,7 @@ expression: actual
"type": "MemberExpression"
},
"property": {
"commentStart": 14,
"end": 17,
"name": "two",
"start": 14,
@ -55,6 +65,7 @@ expression: actual
"type": "MemberExpression"
},
"property": {
"commentStart": 18,
"end": 23,
"name": "three",
"start": 18,
@ -66,6 +77,7 @@ expression: actual
"type": "MemberExpression"
},
"property": {
"commentStart": 24,
"end": 28,
"name": "four",
"start": 24,
@ -86,6 +98,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 28,
"start": 0
}

View File

@ -1,22 +1,27 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 11,
"id": {
"commentStart": 0,
"end": 3,
"name": "pt1",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 6,
"computed": false,
"end": 11,
"object": {
"commentStart": 6,
"end": 8,
"name": "b1",
"start": 6,
@ -24,6 +29,7 @@ expression: actual
"type": "Identifier"
},
"property": {
"commentStart": 9,
"end": 10,
"raw": "0",
"start": 9,
@ -48,6 +54,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 11,
"start": 0
}

View File

@ -1,22 +1,27 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 16,
"id": {
"commentStart": 0,
"end": 3,
"name": "pt1",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 6,
"computed": false,
"end": 16,
"object": {
"commentStart": 6,
"end": 8,
"name": "b1",
"start": 6,
@ -24,6 +29,7 @@ expression: actual
"type": "Identifier"
},
"property": {
"commentStart": 9,
"end": 15,
"raw": "'zero'",
"start": 9,
@ -45,6 +51,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 16,
"start": 0
}

View File

@ -1,22 +1,27 @@
---
source: kcl/src/parsing/parser.rs
source: kcl-lib/src/parsing/parser.rs
expression: actual
---
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 13,
"id": {
"commentStart": 0,
"end": 3,
"name": "pt1",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 6,
"computed": false,
"end": 13,
"object": {
"commentStart": 6,
"end": 8,
"name": "b1",
"start": 6,
@ -24,6 +29,7 @@ expression: actual
"type": "Identifier"
},
"property": {
"commentStart": 9,
"end": 13,
"name": "zero",
"start": 9,
@ -44,6 +50,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 13,
"start": 0
}

View File

@ -5,9 +5,12 @@ expression: actual
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 48,
"id": {
"commentStart": 0,
"end": 2,
"name": "sg",
"start": 0,
@ -18,6 +21,7 @@ expression: actual
{
"arguments": [
{
"commentStart": 19,
"end": 21,
"name": "XY",
"start": 19,
@ -26,11 +30,13 @@ expression: actual
}
],
"callee": {
"commentStart": 5,
"end": 18,
"name": "startSketchOn",
"start": 5,
"type": "Identifier"
},
"commentStart": 5,
"end": 22,
"start": 5,
"type": "CallExpression",
@ -39,6 +45,7 @@ expression: actual
{
"arguments": [
{
"commentStart": 41,
"end": 44,
"name": "pos",
"start": 41,
@ -46,6 +53,7 @@ expression: actual
"type": "Identifier"
},
{
"commentStart": 46,
"end": 47,
"start": 46,
"type": "PipeSubstitution",
@ -53,17 +61,20 @@ expression: actual
}
],
"callee": {
"commentStart": 26,
"end": 40,
"name": "startProfileAt",
"start": 26,
"type": "Identifier"
},
"commentStart": 26,
"end": 48,
"start": 26,
"type": "CallExpression",
"type": "CallExpression"
}
],
"commentStart": 5,
"end": 48,
"start": 5,
"type": "PipeExpression",
@ -79,6 +90,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 48,
"start": 0
}

View File

@ -5,9 +5,12 @@ expression: actual
{
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 73,
"id": {
"commentStart": 0,
"end": 2,
"name": "sg",
"start": 0,
@ -18,6 +21,7 @@ expression: actual
{
"arguments": [
{
"commentStart": 19,
"end": 21,
"name": "XY",
"start": 19,
@ -26,11 +30,13 @@ expression: actual
}
],
"callee": {
"commentStart": 5,
"end": 18,
"name": "startSketchOn",
"start": 5,
"type": "Identifier"
},
"commentStart": 5,
"end": 22,
"start": 5,
"type": "CallExpression",
@ -39,6 +45,7 @@ expression: actual
{
"arguments": [
{
"commentStart": 45,
"end": 48,
"name": "pos",
"start": 45,
@ -47,11 +54,13 @@ expression: actual
}
],
"callee": {
"commentStart": 30,
"end": 44,
"name": "startProfileAt",
"start": 30,
"type": "Identifier"
},
"commentStart": 30,
"end": 49,
"start": 30,
"type": "CallExpression",
@ -60,8 +69,10 @@ expression: actual
{
"arguments": [
{
"commentStart": 58,
"elements": [
{
"commentStart": 59,
"end": 60,
"raw": "0",
"start": 59,
@ -74,12 +85,14 @@ expression: actual
},
{
"argument": {
"commentStart": 63,
"end": 68,
"name": "scale",
"start": 63,
"type": "Identifier",
"type": "Identifier"
},
"commentStart": 62,
"end": 68,
"operator": "-",
"start": 62,
@ -93,6 +106,7 @@ expression: actual
"type": "ArrayExpression"
},
{
"commentStart": 71,
"end": 72,
"start": 71,
"type": "PipeSubstitution",
@ -100,17 +114,20 @@ expression: actual
}
],
"callee": {
"commentStart": 53,
"end": 57,
"name": "line",
"start": 53,
"type": "Identifier"
},
"commentStart": 53,
"end": 73,
"start": 53,
"type": "CallExpression",
"type": "CallExpression"
}
],
"commentStart": 5,
"end": 73,
"start": 5,
"type": "PipeExpression",
@ -126,6 +143,7 @@ expression: actual
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 73,
"start": 0
}

View File

@ -23,19 +23,31 @@ impl Program {
.map(|sh| format!("{}\n\n", sh.inner.content))
.unwrap_or_default();
for attr in &self.inner_attrs {
result.push_str(&attr.recast(options, indentation_level));
}
for start in &self.non_code_meta.start_nodes {
result.push_str(&start.recast(options, indentation_level));
}
let result = result; // Remove mutation.
for attr in &self.inner_attrs {
result.push_str(&attr.recast(options, indentation_level));
}
if !self.inner_attrs.is_empty() {
result.push('\n');
}
let result = result; // Remove mutation.
let result = self
.body
.iter()
.map(|body_item| {
let mut result = String::new();
for comment in body_item.get_comments() {
if !comment.is_empty() {
result.push_str(&indentation);
result.push_str(comment);
}
if !result.ends_with("\n\n") && result != "\n" {
result.push('\n');
}
}
for attr in body_item.get_attrs() {
result.push_str(&attr.recast(options, indentation_level));
}
@ -173,7 +185,18 @@ impl Node<NonCodeNode> {
impl Node<Annotation> {
fn recast(&self, options: &FormatOptions, indentation_level: usize) -> String {
let mut result = "@".to_owned();
let indentation = options.get_indentation(indentation_level);
let mut result = String::new();
for comment in &self.pre_comments {
if !comment.is_empty() {
result.push_str(&indentation);
result.push_str(comment);
}
if !comment.ends_with("*/") && !result.ends_with("\n\n") && result != "\n" {
result.push('\n');
}
}
result.push('@');
if let Some(name) = &self.name {
result.push_str(&name.name);
}
@ -956,6 +979,7 @@ mod tests {
fn test_recast_annotations_in_function_body() {
let input = r#"fn myFunc() {
@meta(yes = true)
x = 2
}
"#;
@ -975,6 +999,25 @@ mod tests {
assert_eq!(output, input);
}
#[test]
fn recast_annotations_with_comments() {
let input = r#"// Start comment
// Comment on attr
@settings(defaultLengthUnit = in)
// Comment on item
foo = 42
// Comment on another item
@(impl = kcl)
bar = 0
"#;
let program = crate::parsing::top_level_parse(input).unwrap();
let output = program.recast(&Default::default(), 0);
assert_eq!(output, input);
}
#[test]
fn test_recast_if_else_if_same() {
let input = r#"b = if false {
@ -1241,7 +1284,6 @@ outsideRevolve = startSketchOn('XZ')
r#"// Ball Bearing
// A ball bearing is a type of rolling-element bearing that uses balls to maintain the separation between the bearing races. The primary purpose of a ball bearing is to reduce rotational friction and support radial and axial loads.
// Define constants like ball diameter, inside diameter, overhange length, and thickness
sphereDia = 0.5
insideDia = 1
@ -1643,6 +1685,7 @@ tabs_l = startSketchOn({
assert_eq!(
recasted,
r#"@settings(units = mm)
// define nts
radius = 6.0
width = 144.0
@ -2633,4 +2676,35 @@ sketch002 = startSketchOn({
);
}
}
#[test]
fn code_with_comment_and_extra_lines() {
let code = r#"yo = 'c'
/* this is
a
comment */
yo = 'bing'
"#;
let ast = crate::parsing::top_level_parse(code).unwrap();
let recasted = ast.recast(&FormatOptions::new(), 0);
assert_eq!(recasted, code);
}
#[test]
fn comments_in_a_fn_block() {
let code = r#"fn myFn() {
// this is a comment
yo = { a = { b = { c = '123' } } }
/* block
comment */
key = 'c'
// this is also a comment
}
"#;
let ast = crate::parsing::top_level_parse(code).unwrap();
let recasted = ast.recast(&FormatOptions::new(), 0);
assert_eq!(recasted, code);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -6,9 +6,12 @@ description: Result of parsing angled_line.kcl
"Ok": {
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 0,
"id": {
"commentStart": 0,
"end": 0,
"name": "part001",
"start": 0,
@ -19,6 +22,7 @@ description: Result of parsing angled_line.kcl
{
"arguments": [
{
"commentStart": 24,
"end": 0,
"raw": "'XY'",
"start": 0,
@ -28,11 +32,13 @@ description: Result of parsing angled_line.kcl
}
],
"callee": {
"commentStart": 10,
"end": 0,
"name": "startSketchOn",
"start": 0,
"type": "Identifier"
},
"commentStart": 10,
"end": 0,
"start": 0,
"type": "CallExpression",
@ -41,8 +47,10 @@ description: Result of parsing angled_line.kcl
{
"arguments": [
{
"commentStart": 50,
"elements": [
{
"commentStart": 51,
"end": 0,
"raw": "4.83",
"start": 0,
@ -54,6 +62,7 @@ description: Result of parsing angled_line.kcl
}
},
{
"commentStart": 57,
"end": 0,
"raw": "12.56",
"start": 0,
@ -71,6 +80,7 @@ description: Result of parsing angled_line.kcl
"type": "ArrayExpression"
},
{
"commentStart": 65,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
@ -78,11 +88,13 @@ description: Result of parsing angled_line.kcl
}
],
"callee": {
"commentStart": 35,
"end": 0,
"name": "startProfileAt",
"start": 0,
"type": "Identifier"
},
"commentStart": 35,
"end": 0,
"start": 0,
"type": "CallExpression",
@ -93,14 +105,17 @@ description: Result of parsing angled_line.kcl
{
"type": "LabeledArg",
"label": {
"commentStart": 78,
"end": 0,
"name": "end",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 84,
"elements": [
{
"commentStart": 85,
"end": 0,
"raw": "15.1",
"start": 0,
@ -112,6 +127,7 @@ description: Result of parsing angled_line.kcl
}
},
{
"commentStart": 91,
"end": 0,
"raw": "2.48",
"start": 0,
@ -131,11 +147,13 @@ description: Result of parsing angled_line.kcl
}
],
"callee": {
"commentStart": 73,
"end": 0,
"name": "line",
"start": 0,
"type": "Identifier"
},
"commentStart": 73,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
@ -147,14 +165,17 @@ description: Result of parsing angled_line.kcl
{
"type": "LabeledArg",
"label": {
"commentStart": 108,
"end": 0,
"name": "end",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 114,
"elements": [
{
"commentStart": 115,
"end": 0,
"raw": "3.15",
"start": 0,
@ -167,6 +188,7 @@ description: Result of parsing angled_line.kcl
},
{
"argument": {
"commentStart": 122,
"end": 0,
"raw": "9.85",
"start": 0,
@ -177,6 +199,7 @@ description: Result of parsing angled_line.kcl
"suffix": "None"
}
},
"commentStart": 121,
"end": 0,
"operator": "-",
"start": 0,
@ -193,12 +216,14 @@ description: Result of parsing angled_line.kcl
{
"type": "LabeledArg",
"label": {
"commentStart": 129,
"end": 0,
"name": "tag",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 135,
"end": 0,
"start": 0,
"type": "TagDeclarator",
@ -208,11 +233,13 @@ description: Result of parsing angled_line.kcl
}
],
"callee": {
"commentStart": 103,
"end": 0,
"name": "line",
"start": 0,
"type": "Identifier"
},
"commentStart": 103,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
@ -224,15 +251,18 @@ description: Result of parsing angled_line.kcl
{
"type": "LabeledArg",
"label": {
"commentStart": 153,
"end": 0,
"name": "end",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 159,
"elements": [
{
"argument": {
"commentStart": 161,
"end": 0,
"raw": "15.17",
"start": 0,
@ -243,6 +273,7 @@ description: Result of parsing angled_line.kcl
"suffix": "None"
}
},
"commentStart": 160,
"end": 0,
"operator": "-",
"start": 0,
@ -251,6 +282,7 @@ description: Result of parsing angled_line.kcl
},
{
"argument": {
"commentStart": 169,
"end": 0,
"raw": "4.1",
"start": 0,
@ -261,6 +293,7 @@ description: Result of parsing angled_line.kcl
"suffix": "None"
}
},
"commentStart": 168,
"end": 0,
"operator": "-",
"start": 0,
@ -276,11 +309,13 @@ description: Result of parsing angled_line.kcl
}
],
"callee": {
"commentStart": 148,
"end": 0,
"name": "line",
"start": 0,
"type": "Identifier"
},
"commentStart": 148,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
@ -290,10 +325,12 @@ description: Result of parsing angled_line.kcl
{
"arguments": [
{
"commentStart": 191,
"elements": [
{
"arguments": [
{
"commentStart": 199,
"end": 0,
"name": "seg01",
"start": 0,
@ -302,17 +339,20 @@ description: Result of parsing angled_line.kcl
}
],
"callee": {
"commentStart": 192,
"end": 0,
"name": "segAng",
"start": 0,
"type": "Identifier"
},
"commentStart": 192,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
},
{
"commentStart": 207,
"end": 0,
"raw": "12.35",
"start": 0,
@ -330,6 +370,7 @@ description: Result of parsing angled_line.kcl
"type": "ArrayExpression"
},
{
"commentStart": 215,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
@ -337,11 +378,13 @@ description: Result of parsing angled_line.kcl
}
],
"callee": {
"commentStart": 180,
"end": 0,
"name": "angledLine",
"start": 0,
"type": "Identifier"
},
"commentStart": 180,
"end": 0,
"start": 0,
"type": "CallExpression",
@ -352,15 +395,18 @@ description: Result of parsing angled_line.kcl
{
"type": "LabeledArg",
"label": {
"commentStart": 228,
"end": 0,
"name": "end",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 234,
"elements": [
{
"argument": {
"commentStart": 236,
"end": 0,
"raw": "13.02",
"start": 0,
@ -371,6 +417,7 @@ description: Result of parsing angled_line.kcl
"suffix": "None"
}
},
"commentStart": 235,
"end": 0,
"operator": "-",
"start": 0,
@ -378,6 +425,7 @@ description: Result of parsing angled_line.kcl
"type": "UnaryExpression"
},
{
"commentStart": 243,
"end": 0,
"raw": "10.03",
"start": 0,
@ -397,11 +445,13 @@ description: Result of parsing angled_line.kcl
}
],
"callee": {
"commentStart": 223,
"end": 0,
"name": "line",
"start": 0,
"type": "Identifier"
},
"commentStart": 223,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
@ -411,6 +461,7 @@ description: Result of parsing angled_line.kcl
{
"arguments": [
{
"commentStart": 262,
"end": 0,
"start": 0,
"type": "PipeSubstitution",
@ -418,11 +469,13 @@ description: Result of parsing angled_line.kcl
}
],
"callee": {
"commentStart": 256,
"end": 0,
"name": "close",
"start": 0,
"type": "Identifier"
},
"commentStart": 256,
"end": 0,
"start": 0,
"type": "CallExpression",
@ -433,12 +486,14 @@ description: Result of parsing angled_line.kcl
{
"type": "LabeledArg",
"label": {
"commentStart": 278,
"end": 0,
"name": "length",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 287,
"end": 0,
"raw": "4",
"start": 0,
@ -452,11 +507,13 @@ description: Result of parsing angled_line.kcl
}
],
"callee": {
"commentStart": 270,
"end": 0,
"name": "extrude",
"start": 0,
"type": "Identifier"
},
"commentStart": 270,
"end": 0,
"start": 0,
"type": "CallExpressionKw",
@ -464,6 +521,7 @@ description: Result of parsing angled_line.kcl
"unlabeled": null
}
],
"commentStart": 10,
"end": 0,
"start": 0,
"type": "PipeExpression",
@ -479,6 +537,7 @@ description: Result of parsing angled_line.kcl
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 0,
"start": 0
}

View File

@ -22,6 +22,7 @@ description: Variables in memory after executing angled_line.kcl
"id": "[uuid]",
"sourceRange": [],
"tag": {
"commentStart": 135,
"end": 141,
"start": 135,
"type": "TagDeclarator",
@ -91,6 +92,7 @@ description: Variables in memory after executing angled_line.kcl
15.04
],
"tag": {
"commentStart": 135,
"end": 141,
"start": 135,
"type": "TagDeclarator",

View File

@ -6,9 +6,12 @@ description: Result of parsing argument_error.kcl
"Ok": {
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 3,
"end": 0,
"id": {
"commentStart": 3,
"end": 0,
"name": "f",
"start": 0,
@ -19,6 +22,7 @@ description: Result of parsing argument_error.kcl
"body": [
{
"argument": {
"commentStart": 19,
"end": 0,
"raw": "5",
"start": 0,
@ -29,20 +33,24 @@ description: Result of parsing argument_error.kcl
"suffix": "None"
}
},
"commentStart": 12,
"end": 0,
"start": 0,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"commentStart": 8,
"end": 0,
"start": 0
},
"commentStart": 4,
"end": 0,
"params": [
{
"type": "Parameter",
"identifier": {
"commentStart": 5,
"end": 0,
"name": "i",
"start": 0,
@ -64,10 +72,12 @@ description: Result of parsing argument_error.kcl
"type": "VariableDeclaration"
},
{
"commentStart": 22,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 28,
"end": 0,
"name": "f",
"start": 0,
@ -75,8 +85,10 @@ description: Result of parsing argument_error.kcl
"type": "Identifier"
},
{
"commentStart": 31,
"elements": [
{
"commentStart": 32,
"end": 0,
"raw": "0",
"start": 0,
@ -88,6 +100,7 @@ description: Result of parsing argument_error.kcl
}
},
{
"commentStart": 35,
"end": 0,
"raw": "1",
"start": 0,
@ -106,11 +119,13 @@ description: Result of parsing argument_error.kcl
}
],
"callee": {
"commentStart": 24,
"end": 0,
"name": "map",
"start": 0,
"type": "Identifier"
},
"commentStart": 24,
"end": 0,
"start": 0,
"type": "CallExpression",
@ -121,11 +136,13 @@ description: Result of parsing argument_error.kcl
"type": "ExpressionStatement"
}
],
"commentStart": 0,
"end": 0,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"commentStart": 22,
"end": 0,
"start": 0,
"type": "NonCodeNode",

View File

@ -6,17 +6,22 @@ description: Result of parsing array_elem_pop.kcl
"Ok": {
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 0,
"id": {
"commentStart": 0,
"end": 0,
"name": "arr",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 6,
"elements": [
{
"commentStart": 7,
"end": 0,
"raw": "1",
"start": 0,
@ -28,6 +33,7 @@ description: Result of parsing array_elem_pop.kcl
}
},
{
"commentStart": 10,
"end": 0,
"raw": "2",
"start": 0,
@ -39,6 +45,7 @@ description: Result of parsing array_elem_pop.kcl
}
},
{
"commentStart": 13,
"end": 0,
"raw": "3",
"start": 0,
@ -65,9 +72,12 @@ description: Result of parsing array_elem_pop.kcl
"type": "VariableDeclaration"
},
{
"commentStart": 16,
"declaration": {
"commentStart": 16,
"end": 0,
"id": {
"commentStart": 16,
"end": 0,
"name": "new_arr1",
"start": 0,
@ -76,6 +86,7 @@ description: Result of parsing array_elem_pop.kcl
"init": {
"arguments": [
{
"commentStart": 31,
"end": 0,
"name": "arr",
"start": 0,
@ -84,11 +95,13 @@ description: Result of parsing array_elem_pop.kcl
}
],
"callee": {
"commentStart": 27,
"end": 0,
"name": "pop",
"start": 0,
"type": "Identifier"
},
"commentStart": 27,
"end": 0,
"start": 0,
"type": "CallExpression",
@ -104,9 +117,12 @@ description: Result of parsing array_elem_pop.kcl
"type": "VariableDeclaration"
},
{
"commentStart": 36,
"declaration": {
"commentStart": 36,
"end": 0,
"id": {
"commentStart": 36,
"end": 0,
"name": "new_arr2",
"start": 0,
@ -115,6 +131,7 @@ description: Result of parsing array_elem_pop.kcl
"init": {
"arguments": [
{
"commentStart": 51,
"end": 0,
"name": "new_arr1",
"start": 0,
@ -123,11 +140,13 @@ description: Result of parsing array_elem_pop.kcl
}
],
"callee": {
"commentStart": 47,
"end": 0,
"name": "pop",
"start": 0,
"type": "Identifier"
},
"commentStart": 47,
"end": 0,
"start": 0,
"type": "CallExpression",
@ -143,9 +162,12 @@ description: Result of parsing array_elem_pop.kcl
"type": "VariableDeclaration"
},
{
"commentStart": 61,
"declaration": {
"commentStart": 61,
"end": 0,
"id": {
"commentStart": 61,
"end": 0,
"name": "new_arr3",
"start": 0,
@ -154,6 +176,7 @@ description: Result of parsing array_elem_pop.kcl
"init": {
"arguments": [
{
"commentStart": 76,
"end": 0,
"name": "new_arr2",
"start": 0,
@ -162,11 +185,13 @@ description: Result of parsing array_elem_pop.kcl
}
],
"callee": {
"commentStart": 72,
"end": 0,
"name": "pop",
"start": 0,
"type": "Identifier"
},
"commentStart": 72,
"end": 0,
"start": 0,
"type": "CallExpression",
@ -182,13 +207,16 @@ description: Result of parsing array_elem_pop.kcl
"type": "VariableDeclaration"
},
{
"commentStart": 86,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 98,
"computed": false,
"end": 0,
"object": {
"commentStart": 98,
"end": 0,
"name": "new_arr1",
"start": 0,
@ -196,6 +224,7 @@ description: Result of parsing array_elem_pop.kcl
"type": "Identifier"
},
"property": {
"commentStart": 107,
"end": 0,
"raw": "0",
"start": 0,
@ -211,6 +240,7 @@ description: Result of parsing array_elem_pop.kcl
"type": "MemberExpression"
},
{
"commentStart": 111,
"end": 0,
"raw": "1",
"start": 0,
@ -222,6 +252,7 @@ description: Result of parsing array_elem_pop.kcl
}
},
{
"commentStart": 114,
"end": 0,
"raw": "0.00001",
"start": 0,
@ -233,6 +264,7 @@ description: Result of parsing array_elem_pop.kcl
}
},
{
"commentStart": 123,
"end": 0,
"raw": "\"element 0 should not have changed\"",
"start": 0,
@ -242,11 +274,13 @@ description: Result of parsing array_elem_pop.kcl
}
],
"callee": {
"commentStart": 86,
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"commentStart": 86,
"end": 0,
"start": 0,
"type": "CallExpression",
@ -257,13 +291,16 @@ description: Result of parsing array_elem_pop.kcl
"type": "ExpressionStatement"
},
{
"commentStart": 160,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 172,
"computed": false,
"end": 0,
"object": {
"commentStart": 172,
"end": 0,
"name": "new_arr1",
"start": 0,
@ -271,6 +308,7 @@ description: Result of parsing array_elem_pop.kcl
"type": "Identifier"
},
"property": {
"commentStart": 181,
"end": 0,
"raw": "1",
"start": 0,
@ -286,6 +324,7 @@ description: Result of parsing array_elem_pop.kcl
"type": "MemberExpression"
},
{
"commentStart": 185,
"end": 0,
"raw": "2",
"start": 0,
@ -297,6 +336,7 @@ description: Result of parsing array_elem_pop.kcl
}
},
{
"commentStart": 188,
"end": 0,
"raw": "0.00001",
"start": 0,
@ -308,6 +348,7 @@ description: Result of parsing array_elem_pop.kcl
}
},
{
"commentStart": 197,
"end": 0,
"raw": "\"element 1 should not have changed\"",
"start": 0,
@ -317,11 +358,13 @@ description: Result of parsing array_elem_pop.kcl
}
],
"callee": {
"commentStart": 160,
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"commentStart": 160,
"end": 0,
"start": 0,
"type": "CallExpression",
@ -332,13 +375,16 @@ description: Result of parsing array_elem_pop.kcl
"type": "ExpressionStatement"
},
{
"commentStart": 234,
"end": 0,
"expression": {
"arguments": [
{
"commentStart": 246,
"computed": false,
"end": 0,
"object": {
"commentStart": 246,
"end": 0,
"name": "new_arr2",
"start": 0,
@ -346,6 +392,7 @@ description: Result of parsing array_elem_pop.kcl
"type": "Identifier"
},
"property": {
"commentStart": 255,
"end": 0,
"raw": "0",
"start": 0,
@ -361,6 +408,7 @@ description: Result of parsing array_elem_pop.kcl
"type": "MemberExpression"
},
{
"commentStart": 259,
"end": 0,
"raw": "1",
"start": 0,
@ -372,6 +420,7 @@ description: Result of parsing array_elem_pop.kcl
}
},
{
"commentStart": 262,
"end": 0,
"raw": "0.00001",
"start": 0,
@ -383,6 +432,7 @@ description: Result of parsing array_elem_pop.kcl
}
},
{
"commentStart": 271,
"end": 0,
"raw": "\"element 0 should not have changed\"",
"start": 0,
@ -392,11 +442,13 @@ description: Result of parsing array_elem_pop.kcl
}
],
"callee": {
"commentStart": 234,
"end": 0,
"name": "assertEqual",
"start": 0,
"type": "Identifier"
},
"commentStart": 234,
"end": 0,
"start": 0,
"type": "CallExpression",
@ -407,6 +459,7 @@ description: Result of parsing array_elem_pop.kcl
"type": "ExpressionStatement"
}
],
"commentStart": 0,
"end": 0,
"start": 0
}

View File

@ -6,15 +6,19 @@ description: Result of parsing array_elem_pop_empty_fail.kcl
"Ok": {
"body": [
{
"commentStart": 0,
"declaration": {
"commentStart": 0,
"end": 0,
"id": {
"commentStart": 0,
"end": 0,
"name": "arr",
"start": 0,
"type": "Identifier"
},
"init": {
"commentStart": 6,
"elements": [],
"end": 0,
"start": 0,
@ -31,9 +35,12 @@ description: Result of parsing array_elem_pop_empty_fail.kcl
"type": "VariableDeclaration"
},
{
"commentStart": 9,
"declaration": {
"commentStart": 9,
"end": 0,
"id": {
"commentStart": 9,
"end": 0,
"name": "fail",
"start": 0,
@ -42,6 +49,7 @@ description: Result of parsing array_elem_pop_empty_fail.kcl
"init": {
"arguments": [
{
"commentStart": 20,
"end": 0,
"name": "arr",
"start": 0,
@ -50,11 +58,13 @@ description: Result of parsing array_elem_pop_empty_fail.kcl
}
],
"callee": {
"commentStart": 16,
"end": 0,
"name": "pop",
"start": 0,
"type": "Identifier"
},
"commentStart": 16,
"end": 0,
"start": 0,
"type": "CallExpression",
@ -70,6 +80,7 @@ description: Result of parsing array_elem_pop_empty_fail.kcl
"type": "VariableDeclaration"
}
],
"commentStart": 0,
"end": 0,
"start": 0
}

Some files were not shown because too many files have changed in this diff Show More