feat(flatzinc-serde): Support for the original FZN format#295
Draft
maartenflippo wants to merge 29 commits intoshackle-rs:developfrom
Draft
feat(flatzinc-serde): Support for the original FZN format#295maartenflippo wants to merge 29 commits intoshackle-rs:developfrom
maartenflippo wants to merge 29 commits intoshackle-rs:developfrom
Conversation
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.
The
flatzinc-serdecrate has a great AST that is based on the JSON format for FlatZinc. Having a single crate that can parse both the FZN JSON and original FZN formats would be great. Hence, this PR introduces a parser for FZN based on the winnow parser combinator library.The implementation comes with both unit and integration tests for the parser. The integration tests are taken from the libminizinc spec tests. Since
flatzinc-serdedoes not have explicit integration tests, these are also included in thefzn/mod.rsfile. There is a single test function that reads the fixtures fromcrates/flatzinc-serde/corpus/fznand parses them all. Similar to the JSON parser tests,expect_fileis used to handle snapshots.TODO
FlatZinctype does not have a field for parameters. In my opinion, this means we should resolve parameters in the FZN parser. That way, the parameters are not visible to a user of this functionality. The other option would be to add a parameters field toFlatZinc, but I would expect that is not a desired solution.crates/flatzinc-serde/corpus/fzn/).Questions
tests/directory? This would support easy filtering of the tests usingcargo test --libandcargo test --tests(which runs the tests in thetests/directory).