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

empty BlockComment breaks parser #66

Open
lucasterra opened this issue Jan 27, 2020 · 0 comments · May be fixed by #67 or grepdemos/thrift-parser#9
Open

empty BlockComment breaks parser #66

lucasterra opened this issue Jan 27, 2020 · 0 comments · May be fixed by #67 or grepdemos/thrift-parser#9

Comments

@lucasterra
Copy link

If you have this IDL:

/* */
const string asdf = 'sdf'

The AST will return an empty document:

{
  "type": "ThriftDocument",
  "body": []
}

Another example:

/* */
some string
*/
const string test = 'asdf'

You get:

{
  "type": "ThriftDocument",
  "body": [
    {
      "type": "ConstDefinition",
      "name": {
        "type": "Identifier",
        "value": "test",
        "loc": {
          "start": {
            "line": 3,
            "column": 14,
            "index": 34
          },
          "end": {
            "line": 3,
            "column": 18,
            "index": 38
          }
        }
      },
      "fieldType": {
        "type": "StringKeyword",
        "loc": {
          "start": {
            "line": 3,
            "column": 7,
            "index": 27
          },
          "end": {
            "line": 3,
            "column": 13,
            "index": 33
          }
        }
      },
      "initializer": {
        "type": "StringLiteral",
        "value": "asdf",
        "loc": {
          "start": {
            "line": 3,
            "column": 21,
            "index": 41
          },
          "end": {
            "line": 3,
            "column": 27,
            "index": 47
          }
        }
      },
      "comments": [
        {
          "type": "CommentBlock",
          "value": [
            "some string"
          ],
          "loc": {
            "start": {
              "line": 1,
              "column": 1,
              "index": 0
            },
            "end": {
              "line": 2,
              "column": 15,
              "index": 20
            }
          }
        }
      ],
      "loc": {
        "start": {
          "line": 3,
          "column": 1,
          "index": 21
        },
        "end": {
          "line": 3,
          "column": 27,
          "index": 47
        }
      }
    }
  ]
}
@lucasterra lucasterra linked a pull request Jan 27, 2020 that will close this issue
@lizard-boy lizard-boy linked a pull request Oct 5, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant