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

fix: allow dictionary values to be empty #3

Merged

Conversation

slarse
Copy link
Contributor

@slarse slarse commented Mar 12, 2024

Partial fix for #2 addressing only the value part of it.

I've encountered a lot of empty values in dictionaries in the wild, which currently breaks parsing. The fix here is to simply make dictionary values "zero or more", as specified in Bruno's grammar.

Making dictionary keys (and assert keys) zero or more is much more problematic, it leads to tons of parsing errors. I found through trial and error that marking them as optional instead appears to work fine, but then you end up with dictionary pairs that lack keys in the syntax tree which also isn't quite right.

Anyway, just having the value be zero or more characters solves my current issue, I just have a lot of empty values in files I'm working with.

@Scalamando
Copy link
Owner

Thanks for the PR!

Bruno's grammar is a little weird in that regard. I've also tried to get empty keys to work without removing the key token, but no luck yet.

Nevertheless, your contribution is already very valuable. Having empty values likely is a common scenario, as you pointed out.

@Scalamando Scalamando merged commit dd27fe0 into Scalamando:main Mar 25, 2024
@slarse slarse deleted the issue#2-allow-empty-dictionary-values branch March 26, 2024 17:48
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

Successfully merging this pull request may close these issues.

2 participants