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

Parse hexadecimal notation #63

Merged
merged 2 commits into from
Nov 2, 2019
Merged

Conversation

bfontaine
Copy link
Collaborator

Also, disallow 0-prefixed integers such as 0644 per the spec:

No integer other than 0 may begin with 0. 64-bit (signed integer) precision is expected.

I had to add a negative lookahead in the t_INTEGER regexp so that 0xABC is not parsed as 0 xABC. The current implementation allows an integer to be followed by a symbol or a keyword:

>>> edn_format.loads_all("123abc")
[123, Symbol(abc)]
>>> edn_format.loads_all("123NNN")
[123, Symbol(NN)]
>>> edn_format.loads_all("123:abc")
[123, Keyword(abc)]

The spec doesn’t explicitely say this is incorrect (emphasis mine):

Elements are generally separated by whitespace.

This fixes #62.

From the spec:

> No integer other than 0 may begin with 0.
Copy link
Owner

@swaroopch swaroopch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@bfontaine bfontaine merged commit eba8686 into swaroopch:master Nov 2, 2019
@bfontaine bfontaine deleted the hex-numbers branch November 2, 2019 15:05
@swaroopch
Copy link
Owner

@bfontaine Can I request to please make a minor release to pypi? Thanks!

@bfontaine
Copy link
Collaborator Author

Sure! 09add5d

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

Successfully merging this pull request may close these issues.

HEX Numeric notation not supported
2 participants