-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Allow EOF IO passed to JSON::PullParser.new #10864
Allow EOF IO passed to JSON::PullParser.new #10864
Conversation
This is good for another review @asterite. |
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.
Looks good. On second thought, what's the use case for this? An empty json is invalid. I think json pull parser only produces valid json expressions, and eof is not one of them.
@asterite The use case is for oq -i yaml -o yaml '.[] | select(.name != "foo")' <<<$'- name: foo'
oq error: Unexpected token: <EOF> at line 1, column 1 The solution in |
@asterite This change does not parse an empty document as valid. It just makes sure to properly forward the information that it has reached EOF on the input stream. |
Thanks! Feel free to merge. |
I'm actually unsure if this qualifies as a bug-fix or should wait for the end of the feature freeze. |
I need an emoji for a horizontal thumb :-D really, both interpretations are valid here. I vote for merging it. BTW @Blacksmoke16 thanks for refactoring the case, that's also a nice improvement. |
I think I'd rather postpone this to 1.2. We're about to release 1.1 and there's an off chance that this might have any unforeseeable effect. It's not an urgent bug fix and easy to work around. |
EOF
is a valid pull parser token type. Because of this, it makes sense to set the initial kind toEOF
if that's the initial state of the input versus raising an exception.Discovered via Blacksmoke16/oq#82