Skip to content

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

@slarse

Description

@slarse

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions