Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whitespace issues #111

Closed
marcoscaceres opened this issue Nov 3, 2017 · 4 comments
Closed

Whitespace issues #111

marcoscaceres opened this issue Nov 3, 2017 · 4 comments

Comments

@marcoscaceres
Copy link
Member

I think we might have introduced a new bug.

Given:

interface X {
    // this is comment 1

    // this is comment 2

    // this is comment 3
};

The third item of the members array is missing "\n". It's retuning:

{type: "ws", value: "     "}

And the same for the other whitespace, except for the first item.

@saschanaz
Copy link
Member

Couldn't repro with:

> widl = require("."); w = widl.parse(`interface X {\n    // this is comment 1\n\n    // this is comment 2\n\n    // this is comment 3\n};`, { ws: true }); console.log(JSON.stringify(w, null, 2))
[
  {
    "type": "interface",
    "name": "X",
    "partial": false,
    "members": [
      {
        "type": "ws",
        "value": "\n    "
      },
      {
        "type": "line-comment",
        "value": " this is comment 1"
      },
      {
        "type": "ws",
        "value": "\n    "
      },
      {
        "type": "line-comment",
        "value": " this is comment 2"
      },
      {
        "type": "ws",
        "value": "\n    "
      },
      {
        "type": "line-comment",
        "value": " this is comment 3"
      }
    ],
    "inheritance": null,
    "extAttrs": []
  }
]

@saschanaz
Copy link
Member

(Am I missing something?)

@marcoscaceres
Copy link
Member Author

Probably no. I must have screwed something up or not updated properly. I’ll try it out again soon!

@marcoscaceres
Copy link
Member Author

Yeah, it was me :) Sorry for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants