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

Parsing error on dictionary pairs that have empty key or value (or both) #2

Open
slarse opened this issue Mar 8, 2024 · 0 comments

Comments

@slarse
Copy link
Contributor

slarse commented Mar 8, 2024

Hello!

Encountered an issue today with dictionary pairs with empty values (which is valid for Bruno, both keys and values can be empty). Then I realized that for some reason you can also have an empty key if you'd like. I'm not sure what the point of that is but Bruno can execute a file with for example the following:

assert {
    :
}

But this completely breaks parsing with tree-sitter-bruno, you get the following syntax tree.

(source_file [0, 0] - [3, 0]
  tag: (auths [0, 0] - [2, 1]
    (authbearer [0, 0] - [2, 1]
      (keyword [0, 0] - [0, 11])
      (dictionary [0, 12] - [2, 1]
        (ERROR [0, 13] - [1, 2]
          (rawtext [0, 13] - [1, 2]))))))

This should be fine according to bruno's syntax. There's a similar issue for regular dictionaries.

I tried fiddling about with the grammar a little bit but just created more problems than I solved. The liberal use of negative lookaheads combined with "zero or more" in Bruno was more than I could manage to carry over to tree-sitter tonight. But I'll give it another go as soon as I have some time left over.

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

1 participant