stan-dev / stan

Stan development repository. The master branch contains the current release. The develop branch contains the latest stable development. See the Developer Process Wiki for details.
https://mc-stan.org
BSD 3-Clause "New" or "Revised" License
2.57k stars 368 forks source link

Feature/3161 parse tuples json #3165

Closed mitzimorris closed 1 year ago

mitzimorris commented 1 year ago

Submission Checklist

Summary

Updates json parser and data handler to allow tuples, including tuples of tuples, arrays of tuples, tuples of arrays of tuples, etc.

Intended Effect

Allow users to supply init files of JSON data corresponding to Stan program tuple variables.

How to Verify

Unit tests.

Side Effects

Parser allows nested objects.

Documentation

N/A

Copyright and Licensing

Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company): Columbia University

By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:

mitzimorris commented 1 year ago

ready for re-review.

mitzimorris commented 1 year ago

re-review?

mitzimorris commented 1 year ago

I broke the unit tests for ill-formed JSON which the handler should detect and report into from file "json_data_test.cpp" into a new test file, "ill_formed_json_test.cpp", and then added more tests for redefining tuple and array of tuple vars.

mitzimorris commented 1 year ago

Added logic to ignore top-level entries with names that aren't legal Stan varnames and corresponding unit tests. Ready for re-review.