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: Parsing fails when identifiers are split across lines #290

Open
2 tasks done
surr34 opened this issue Oct 14, 2024 · 0 comments
Open
2 tasks done

bug: Parsing fails when identifiers are split across lines #290

surr34 opened this issue Oct 14, 2024 · 0 comments
Labels

Comments

@surr34
Copy link

surr34 commented Oct 14, 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

When splitting identifiers across multiple lines tree-sitter fails to parse them, see the example code below. (As far as I know this is technically valid C++~)

Steps To Reproduce/Bad Parse Tree

  1. Go to https://tree-sitter.github.io/tree-sitter/playground
  2. Pase the sample code
  3. Observe the "ERROR" node in the declaration [1, 0] - [9, 2]
    image

Expected Behavior/Parse Tree

As far as I know this is valid C++ code and all three major compilers compile it without any warning, I would have expected tree-sitter being able to parse it.

Repro

// https://godbolt.org/z/z5Mjjhnq1

extern "C" {
static 
i\
n\
t 
FOO\
Ba\
r
=
3;

int qux();
int qux() {
    return FOOBar;
}
}
@surr34 surr34 added the bug label Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant