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

Hexadecimal support #96

Open
jotego opened this issue Jun 2, 2023 · 2 comments
Open

Hexadecimal support #96

jotego opened this issue Jun 2, 2023 · 2 comments

Comments

@jotego
Copy link

jotego commented Jun 2, 2023

Thank you for this great package.

It would be nice if 0x for hexadecimal numbers was usable by default. I think the way around it now is to define some sort of hex function within the application.

@imirkin
Copy link

imirkin commented Jun 9, 2023

Pretty sure the core tokenization logic supports it since it goes through scanner.Int. However parseNumber doesn't deal with it -- you could change that to fallback on strconv.ParseInt with a base of 0. (Just saying this based on glancing at the code, didn't do any actual tests.)

@imirkin
Copy link

imirkin commented Jun 9, 2023

Worth noting that gval's base/arithmetic language can't represent actual integers, only float64's. You'll run into precision issues once you go above 1<<53 in magnitude. But of course you could specify a language based on int64's, see e.g. how decimal is handled.

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