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 integers #283

Open
masak opened this issue Mar 25, 2018 · 0 comments
Open

Hexadecimal integers #283

masak opened this issue Mar 25, 2018 · 0 comments

Comments

@masak
Copy link
Owner

masak commented Mar 25, 2018

Like this:

my one = 0x1;

(Binary 0b and octal 0o is fine too, but not as important.)

This one should be fairly straightforward, actually... once we have the ability to inject arbitrary grammar terms. Here's a possible implementation:

macro term:hexint (digits) is parsed(/ "0x" (<[\d a..f A..F]>+)/) {
    my value = parseHexdigits(digits);
    return new Q::Literal::Int { value: value };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant