cfallin requested fitzgen for a review on PR #4559.
cfallin opened PR #4559 from isle-int-constants
to main
:
The ISLE language's lexer previously used a very primitive
i64::from_str_radix
call to parse integer constants, allowing values
in the range -2^63..2^63 only. Also, underscores to separate digits (as
is allwoed in Rust) were not supported. Finally, 128-bit constants were
not supported at all.This PR addresses all issues above:
- Integer constants are internally stored as 128-bit values.
Parsing supports either signed (-2^127..2^127) or unsigned (0..2^128)
range. Negation works independently of that, so one can write
-0xffff..ffff
(128 bits wide, i.e., -(2^128-1)) to get a1
.Underscores are supported to separate groups of digits, so one can
write0xffff_ffff
.A minor oversight was fixed: hex constants can start with
0X
(uppercase) as well as0x
, for consistency with Rust and C.This PR also adds a new kind of ISLE test that actually runs a driver
linked to compiled ISLE code; we previously didn't have any such tests,
but it is now quite useful to assert correct interpretation of constant
values.<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
cfallin requested akirilov-arm for a review on PR #4559.
alexcrichton submitted PR review.
cfallin updated PR #4559 from isle-int-constants
to main
.
cfallin has enabled auto merge for PR #4559.
cfallin merged PR #4559.
Last updated: Dec 23 2024 at 12:05 UTC