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

Possible fix for int parsing #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

nico202
Copy link
Contributor

@nico202 nico202 commented Nov 24, 2017

Just a way to manage it, probably exists a better way.
With tests

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 74.88% when pulling 03d0034 on nico202:master into b469dad on dcjones:master.

@sglyon
Copy link
Collaborator

sglyon commented Nov 28, 2017

Will you please rebase this off current master?

@nico202 nico202 force-pushed the master branch 2 times, most recently from b4fbbab to edb2c97 Compare November 28, 2017 09:35
@nico202
Copy link
Contributor Author

nico202 commented Nov 28, 2017

Done. I noticed the removal of the two issue tests because of this rebase :)

@kescobo
Copy link
Collaborator

kescobo commented Dec 7, 2017

I just ran into an issue in scanner.jl where there are two instances of int(string(c)) (ln 1100 and 1108) that are giving me "int not defined" error. Those should probably now be changed to parse(Int, string(c)) right? I can make a separate PR, but they probably fit here too yeah?

@nico202
Copy link
Contributor Author

nico202 commented Dec 7, 2017

Hi, it's after midnight here, I'll look at it tomorrow.
In case, if you don't mind I'll add+stash it to my PR. Else I think you can PR to my branch so that you have credits for the changes.

However, I'll look at it tomorrow. Thanks :)

@kescobo
Copy link
Collaborator

kescobo commented Dec 7, 2017

@nico202 It's super minor, I don't feel strongly about getting credit. If you don't mind adding it here I have no objection

@sglyon
Copy link
Collaborator

sglyon commented Dec 16, 2017

Thank you for the implementation here.

I would really like a second opinion from another pseudo maintainer.

Can any of the watchers of this repo provide their take.

Also pinging @albop

@nico202
Copy link
Contributor Author

nico202 commented Jan 26, 2018

bump

@jdlangs
Copy link
Contributor

jdlangs commented Jan 29, 2018

It's always good to avoid catching errors as part of a program's normal logic and instead use them for actual exceptional situations.

The best options to me seem to be:

  • Drop the leading zero octal parsing option and only use the 0oXXX format.
  • Introduce a small validation function that returns a bool and decide to return to string immediately if it returns false.

I would vote for the first option since I find the leading zero parsing potentially confusing but that's just my preference. Note that if we don't want to parse a leading zero number as octal, there's no need for the if statements in this function. The parse function itself can handle "0xFF" or "0o777" input.

@nico202
Copy link
Contributor Author

nico202 commented Jan 29, 2018

@jdlangs thanks for your feedback. Dropping the leading 0 does not seem a good idea to me because it's in the specs: http://www.yaml.org/spec/current.html#id2503753.
Unless we want to to yaml-flavor-julia, we need to address it.

@jdlangs
Copy link
Contributor

jdlangs commented Jan 29, 2018

Ah ok, that does seem to expect it then.

@jdlangs
Copy link
Contributor

jdlangs commented Jan 29, 2018

Another option is to modify the implicit int resolver to not match to the int tag if it sees "0329".

@kescobo
Copy link
Collaborator

kescobo commented Aug 27, 2020

@nico202 Really sorry for this languishing. Is this PR still live, or has it been fixed elsewhere?

@ScottPJones
Copy link

@nico202 Really sorry for this languishing. Is this PR still live, or has it been fixed elsewhere?

This is still broken (I've found another number parsing issue as well, with using _ as a separator).

@DSGeoff
Copy link

DSGeoff commented Aug 1, 2023

The title appears to be referencing issue #41, but I'm not seeing that directly linked anywhere, so doing that now.

I just made some comments in issue #133 (which is linked here) to explain that how this is "fixed" should depend on which version of YAML is implemented in this package, which may not have been clearly mentioned anywhere. If it's 1.2+, I believe octals should require the letter o, e.g., 0o14. And, if that octal change is implemented here, then it might be good for the test to also include an octal. But, that depends on #133.

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

Successfully merging this pull request may close these issues.

7 participants