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

bug: error while parsing semicolon following inline constructor #285

Closed
1 of 2 tasks
geniusisme opened this issue Aug 29, 2024 · 1 comment · Fixed by #286
Closed
1 of 2 tasks

bug: error while parsing semicolon following inline constructor #285

geniusisme opened this issue Aug 29, 2024 · 1 comment · Fixed by #286
Labels

Comments

@geniusisme
Copy link

geniusisme commented Aug 29, 2024

Did you check existing issues?

  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues of tree-sitter-cpp

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

No response

Describe the bug

Notice the semicolon at line 2.

Steps To Reproduce/Bad Parse Tree

Just paste the code in playground: https://tree-sitter.github.io/tree-sitter/playground

[translation_unit](https://tree-sitter.github.io/tree-sitter/playground#) [0, 0] - [4, 0]
  [struct_specifier](https://tree-sitter.github.io/tree-sitter/playground#) [0, 0] - [3, 1]
    name: [type_identifier](https://tree-sitter.github.io/tree-sitter/playground#) [0, 7] - [0, 8]
    body: [field_declaration_list](https://tree-sitter.github.io/tree-sitter/playground#) [1, 0] - [3, 1]
      [function_definition](https://tree-sitter.github.io/tree-sitter/playground#) [2, 4] - [2, 9]
        declarator: [function_declarator](https://tree-sitter.github.io/tree-sitter/playground#) [2, 4] - [2, 7]
          declarator: [identifier](https://tree-sitter.github.io/tree-sitter/playground#) [2, 4] - [2, 5]
          parameters: [parameter_list](https://tree-sitter.github.io/tree-sitter/playground#) [2, 5] - [2, 7]
        body: [compound_statement](https://tree-sitter.github.io/tree-sitter/playground#) [2, 7] - [2, 9]
      [ERROR](https://tree-sitter.github.io/tree-sitter/playground#) [2, 9] - [2, 10]

Expected Behavior/Parse Tree

Semicolon at that position is allowed. Don't know how should it represented in the tree, but there was a similar problem, may be simillar solution will suffice: #35

Repro

struct S
{
    S(){};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@geniusisme and others