Draft
Conversation
Member
|
Worth pointing out that @yaakov-h wrote a different keyvalue parser and it has good test coverage: https://github.com/SteamDatabase/ValveKeyValue |
Member
Author
|
I only did that after stumbling across this and needing a better solution. 😄 |
Member
|
I've copied tests from this PR into master: 0c6b643 At this point I'm thinking we should just intentionally not support parsing conditionals and tell people to use the VKV lib if they need to support it. |
Member
Author
|
Is there anything where SteamKit2 parses the KV and makes decisions from that, or where we parse it without letting the consumer access the raw data to parse it themselves? |
Member
|
We only parse appinfo which has no conditionals EDIT: Can also be used by webapi, but that also comes with no conditionals. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As pointed out by @xPaw, we crash when reading
tf_english.txt.I narrowed this down to our handling of conditionals - it's completely broken. We count the conditional as a key, then read the next key as a value, etc. until our keys and values are swapped.
Therefore, an empty value after a conditional will trigger the exception that fails a parse on an empty key.
I don't think this is necessarily the best way to handle them, but at least it doesn't crash 😄
Do not merge (yet), I'm only posting this for discussion. How do we want to handle conditionals, and is this the best way?
I think I can see some implementation flaws in this code (i.e. the green part of the diff) but it's getting late and I need to go to bed so I'm stopping for tonight. I know it's not perfect.
Previous PR and discussion at #232.