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

Improve VAR parsing for arrays #284

Open
gustason opened this issue Dec 20, 2024 · 2 comments
Open

Improve VAR parsing for arrays #284

gustason opened this issue Dec 20, 2024 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed to create 🌳 Create and link tree-sitter ticket

Comments

@gustason
Copy link
Collaborator

For example, in the code

VAR INT[4] myArray = [10,11,12,13].

it would be nice if [4] would get parsed as an array_literal.

@gustason gustason added bug Something isn't working to create 🌳 Create and link tree-sitter ticket labels Dec 20, 2024
@eglekaz
Copy link
Collaborator

eglekaz commented Jan 10, 2025

@gustason could you please give a bit more insight on why it is needed?
As I can see in the documentation, it is just an indication that variable is array, not array itself. And it must be an integer.
So having number_literal in brackets does not look wrong.

@eglekaz eglekaz added the help wanted Extra attention is needed label Jan 10, 2025
@gustason
Copy link
Collaborator Author

When we have an array access statement (for example, myArray[4]), the [4] part gets parsed as an array_literal. In the case of a var statement, it would be helpful if it behaved similarly. This would treat both the brackets and the numbers inside them as a single entity, and the same formatting that's currently already implemented would work on both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed to create 🌳 Create and link tree-sitter ticket
Projects
None yet
Development

No branches or pull requests

2 participants