Skip to content
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

Bad argument on splitted float #26

Closed
kpy3 opened this issue Nov 21, 2012 · 6 comments
Closed

Bad argument on splitted float #26

kpy3 opened this issue Nov 21, 2012 · 6 comments

Comments

@kpy3
Copy link
Contributor

kpy3 commented Nov 21, 2012

Hi,

just found incorrect decoder behaviour on splitted float number:

(bocore@tommy.local)40> {incomplete, F} = jsx:decode(<<"{"library": "jsx", "awesome":0">>).
{incomplete,#Fun<jsx_decoder.37.8673461>}
(bocore@tommy.local)41> F(<<".21}">>).
** exception error: bad argument
in function jsx_decoder:maybe_done/4
called as jsx_decoder:maybe_done(<<".21}">>,
{jsx_to_term,{[[{<<"awesome">>,0},{<<"library">>,<<"jsx">>}],
[]],
{opts,binary,false}}},
[object],
{opts,false,false,false,false,false,false,false,false,false,
false})

@kpy3
Copy link
Contributor Author

kpy3 commented Nov 21, 2012

Hm, jsx works well with explicit_end option.

@kpy3 kpy3 closed this as completed Nov 21, 2012
@talentdeficit
Copy link
Owner

I'm happy you found the solution, but this behaviour is inconsistent with what I want jsx to do. I'm going to make it more intuitive. Thanks for finding it

@talentdeficit
Copy link
Owner

the decoder is now much smarter about what's unambiguously incomplete and what is not. you should no longer need the explicit_end flag for cases that aren't ambiguous

Eshell V5.9.1 (abort with ^G)
1> {incomplete, F} = jsx:decode(<<"{"library": "jsx", "awesome":0">>).
{incomplete,#Fun}
2> F(<<".21}">>).
[{<<"library">>,<<"jsx">>},{<<"awesome">>,0.21}]

@kpy3
Copy link
Contributor Author

kpy3 commented Nov 22, 2012

It works for integer() too, thanks a lot.
Is develop brach is stable enough for production use or should I wait for merge this patch into master?

@talentdeficit
Copy link
Owner

this is the only significant difference between develop and master so it should be safe to use but there could be lurking edge cases i haven't considered. if you don't use explicit_end ever it's definitely safe

@kpy3
Copy link
Contributor Author

kpy3 commented Nov 22, 2012

Ok, I'll try, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants