-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
Feature/3161 parse tuples json #3165
Conversation
…tan-dev/stan into feature/3161-parse-tuples-json
re-review? |
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest changes seemed to have introduced a regression, which suggests a new case to test against! (tuple-of-array-of-tuple seems to not trigger the array-of-tuple logic)
And a few more concrete failure tests I'd like to see
…tan-dev/stan into feature/3161-parse-tuples-json
…tan-dev/stan into feature/3161-parse-tuples-json
…tan-dev/stan into feature/3161-parse-tuples-json
Added logic to ignore top-level entries with names that aren't legal Stan varnames and corresponding unit tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the work on this! I think it's ready to merge
"_x_desc_" : "array of tuples", | ||
"_x_def_" : "array[2] (array[3] real, array[2, 2] real, real) x;", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Comment] I think this is very nice that we can have this kind of thing now
|
||
"_legal.JSON" : ["but invalid.stanvar", "-inf", [2.2, 3.3]], | ||
"_also" : "the following", | ||
"x.2" : [ {"1": 0, "2": 1}, {"1": 1}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Comment] This is probably a problem for the documentation later, but part of me does worry someone will try to write something like this and it will be silently ignored.
Making it always issue a warning is too much (and I don't think we have an ostream laying around to push warnings to), so I don't think we should do anything, just wanted to flag it as a concern
Submission Checklist
./runTests.py src/test/unit
make cpplint
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: