Support comments on attributes (#5850)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
		@ -6,6 +6,7 @@ description: Result of parsing import_cycle1.kcl
 | 
			
		||||
  "Ok": {
 | 
			
		||||
    "body": [
 | 
			
		||||
      {
 | 
			
		||||
        "commentStart": 33,
 | 
			
		||||
        "end": 0,
 | 
			
		||||
        "path": {
 | 
			
		||||
          "type": "Kcl",
 | 
			
		||||
@ -16,8 +17,10 @@ description: Result of parsing import_cycle1.kcl
 | 
			
		||||
          "items": [
 | 
			
		||||
            {
 | 
			
		||||
              "alias": null,
 | 
			
		||||
              "commentStart": 42,
 | 
			
		||||
              "end": 0,
 | 
			
		||||
              "name": {
 | 
			
		||||
                "commentStart": 42,
 | 
			
		||||
                "end": 0,
 | 
			
		||||
                "name": "two",
 | 
			
		||||
                "start": 0,
 | 
			
		||||
@ -33,9 +36,12 @@ description: Result of parsing import_cycle1.kcl
 | 
			
		||||
        "type": "ImportStatement"
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "commentStart": 70,
 | 
			
		||||
        "declaration": {
 | 
			
		||||
          "commentStart": 82,
 | 
			
		||||
          "end": 0,
 | 
			
		||||
          "id": {
 | 
			
		||||
            "commentStart": 82,
 | 
			
		||||
            "end": 0,
 | 
			
		||||
            "name": "one",
 | 
			
		||||
            "start": 0,
 | 
			
		||||
@ -46,15 +52,18 @@ description: Result of parsing import_cycle1.kcl
 | 
			
		||||
              "body": [
 | 
			
		||||
                {
 | 
			
		||||
                  "argument": {
 | 
			
		||||
                    "commentStart": 99,
 | 
			
		||||
                    "end": 0,
 | 
			
		||||
                    "left": {
 | 
			
		||||
                      "arguments": [],
 | 
			
		||||
                      "callee": {
 | 
			
		||||
                        "commentStart": 99,
 | 
			
		||||
                        "end": 0,
 | 
			
		||||
                        "name": "two",
 | 
			
		||||
                        "start": 0,
 | 
			
		||||
                        "type": "Identifier"
 | 
			
		||||
                      },
 | 
			
		||||
                      "commentStart": 99,
 | 
			
		||||
                      "end": 0,
 | 
			
		||||
                      "start": 0,
 | 
			
		||||
                      "type": "CallExpression",
 | 
			
		||||
@ -62,6 +71,7 @@ description: Result of parsing import_cycle1.kcl
 | 
			
		||||
                    },
 | 
			
		||||
                    "operator": "-",
 | 
			
		||||
                    "right": {
 | 
			
		||||
                      "commentStart": 107,
 | 
			
		||||
                      "end": 0,
 | 
			
		||||
                      "raw": "1",
 | 
			
		||||
                      "start": 0,
 | 
			
		||||
@ -76,15 +86,18 @@ description: Result of parsing import_cycle1.kcl
 | 
			
		||||
                    "type": "BinaryExpression",
 | 
			
		||||
                    "type": "BinaryExpression"
 | 
			
		||||
                  },
 | 
			
		||||
                  "commentStart": 92,
 | 
			
		||||
                  "end": 0,
 | 
			
		||||
                  "start": 0,
 | 
			
		||||
                  "type": "ReturnStatement",
 | 
			
		||||
                  "type": "ReturnStatement"
 | 
			
		||||
                }
 | 
			
		||||
              ],
 | 
			
		||||
              "commentStart": 88,
 | 
			
		||||
              "end": 0,
 | 
			
		||||
              "start": 0
 | 
			
		||||
            },
 | 
			
		||||
            "commentStart": 85,
 | 
			
		||||
            "end": 0,
 | 
			
		||||
            "params": [],
 | 
			
		||||
            "start": 0,
 | 
			
		||||
@ -102,11 +115,14 @@ description: Result of parsing import_cycle1.kcl
 | 
			
		||||
        "visibility": "export"
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "commentStart": 0,
 | 
			
		||||
    "end": 0,
 | 
			
		||||
    "innerAttrs": [
 | 
			
		||||
      {
 | 
			
		||||
        "commentStart": 0,
 | 
			
		||||
        "end": 0,
 | 
			
		||||
        "name": {
 | 
			
		||||
          "commentStart": 1,
 | 
			
		||||
          "end": 0,
 | 
			
		||||
          "name": "settings",
 | 
			
		||||
          "start": 0,
 | 
			
		||||
@ -114,8 +130,10 @@ description: Result of parsing import_cycle1.kcl
 | 
			
		||||
        },
 | 
			
		||||
        "properties": [
 | 
			
		||||
          {
 | 
			
		||||
            "commentStart": 10,
 | 
			
		||||
            "end": 0,
 | 
			
		||||
            "key": {
 | 
			
		||||
              "commentStart": 10,
 | 
			
		||||
              "end": 0,
 | 
			
		||||
              "name": "defaultLengthUnit",
 | 
			
		||||
              "start": 0,
 | 
			
		||||
@ -124,6 +142,7 @@ description: Result of parsing import_cycle1.kcl
 | 
			
		||||
            "start": 0,
 | 
			
		||||
            "type": "ObjectProperty",
 | 
			
		||||
            "value": {
 | 
			
		||||
              "commentStart": 30,
 | 
			
		||||
              "end": 0,
 | 
			
		||||
              "name": "in",
 | 
			
		||||
              "start": 0,
 | 
			
		||||
@ -140,6 +159,7 @@ description: Result of parsing import_cycle1.kcl
 | 
			
		||||
      "nonCodeNodes": {
 | 
			
		||||
        "0": [
 | 
			
		||||
          {
 | 
			
		||||
            "commentStart": 70,
 | 
			
		||||
            "end": 0,
 | 
			
		||||
            "start": 0,
 | 
			
		||||
            "type": "NonCodeNode",
 | 
			
		||||
@ -149,7 +169,17 @@ description: Result of parsing import_cycle1.kcl
 | 
			
		||||
          }
 | 
			
		||||
        ]
 | 
			
		||||
      },
 | 
			
		||||
      "startNodes": []
 | 
			
		||||
      "startNodes": [
 | 
			
		||||
        {
 | 
			
		||||
          "commentStart": 33,
 | 
			
		||||
          "end": 0,
 | 
			
		||||
          "start": 0,
 | 
			
		||||
          "type": "NonCodeNode",
 | 
			
		||||
          "value": {
 | 
			
		||||
            "type": "newLine"
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      ]
 | 
			
		||||
    },
 | 
			
		||||
    "start": 0
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -7,10 +7,10 @@ KCL ImportCycle error
 | 
			
		||||
  × import cycle: circular import of modules is not allowed: tests/
 | 
			
		||||
  │ import_cycle1/import_cycle2.kcl -> tests/import_cycle1/import_cycle3.kcl
 | 
			
		||||
  │ -> tests/import_cycle1/input.kcl
 | 
			
		||||
   ╭─[2:1]
 | 
			
		||||
 1 │ @settings(defaultLengthUnit = in)
 | 
			
		||||
 2 │ import two from "import_cycle2.kcl"
 | 
			
		||||
   ╭─[3:1]
 | 
			
		||||
 2 │ 
 | 
			
		||||
 3 │ import two from "import_cycle2.kcl"
 | 
			
		||||
   · ─────────────────┬─────────────────
 | 
			
		||||
   ·                  ╰── tests/import_cycle1/input.kcl
 | 
			
		||||
 3 │ 
 | 
			
		||||
 4 │ 
 | 
			
		||||
   ╰────
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,5 @@
 | 
			
		||||
@settings(defaultLengthUnit = mm)
 | 
			
		||||
 | 
			
		||||
import three from "import_cycle3.kcl"
 | 
			
		||||
 | 
			
		||||
export fn two() {
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,5 @@
 | 
			
		||||
@settings(defaultLengthUnit = in)
 | 
			
		||||
 | 
			
		||||
import one from "input.kcl"
 | 
			
		||||
 | 
			
		||||
export fn three() {
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,5 @@
 | 
			
		||||
@settings(defaultLengthUnit = in)
 | 
			
		||||
 | 
			
		||||
import two from "import_cycle2.kcl"
 | 
			
		||||
 | 
			
		||||
export fn one() {
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,7 @@ source: kcl-lib/src/simulation_tests.rs
 | 
			
		||||
description: Result of unparsing import_cycle1.kcl
 | 
			
		||||
---
 | 
			
		||||
@settings(defaultLengthUnit = in)
 | 
			
		||||
 | 
			
		||||
import two from "import_cycle2.kcl"
 | 
			
		||||
 | 
			
		||||
export fn one() {
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,7 @@ source: kcl-lib/src/simulation_tests.rs
 | 
			
		||||
description: Result of unparsing tests/import_cycle1/import_cycle2.kcl
 | 
			
		||||
---
 | 
			
		||||
@settings(defaultLengthUnit = mm)
 | 
			
		||||
 | 
			
		||||
import three from "import_cycle3.kcl"
 | 
			
		||||
 | 
			
		||||
export fn two() {
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,7 @@ source: kcl-lib/src/simulation_tests.rs
 | 
			
		||||
description: Result of unparsing tests/import_cycle1/import_cycle3.kcl
 | 
			
		||||
---
 | 
			
		||||
@settings(defaultLengthUnit = in)
 | 
			
		||||
 | 
			
		||||
import one from "input.kcl"
 | 
			
		||||
 | 
			
		||||
export fn three() {
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user