diff options
| author | 2024-07-21 09:36:23 -0500 | |
|---|---|---|
| committer | 2024-07-21 09:45:44 -0500 | |
| commit | 872b39cc327db562857defdd4ed7b0db7502f18b (patch) | |
| tree | ca141c7a7e15db0f73a754b1c68e2dd34d53643e /src/include | |
| parent | Merge pull request #1476 from sogaiu/no-warning-for-empty-body-loop (diff) | |
Add syntax literals for signed and unsigned 64 bit integers.
Number literals can now take an optional "representation" suffix
- Use `:n` for normal numbers (IEEE-754 doubles)
- Use `:s` for signed 64 bit integers
- Use `:u` for unsigned 64 bit integers
- Other suffix will fallthrough the usual parseing logic. This means
that they will only possibly resolve to symbols if they start with -,
+, or .
The syntax does not collide with any existing valid Janet and is only
enabled with JANET_INTTYPES. This also leaves open a syntax for other
number types such as bignums, ratios, decimals, etc.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/janet.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/include/janet.h b/src/include/janet.h index 88e7f066..cc3fe1cf 100644 --- a/src/include/janet.h +++ b/src/include/janet.h @@ -1598,6 +1598,9 @@ JANET_API int janet_scan_number(const uint8_t *str, int32_t len, double *out); JANET_API int janet_scan_number_base(const uint8_t *str, int32_t len, int32_t base, double *out); JANET_API int janet_scan_int64(const uint8_t *str, int32_t len, int64_t *out); JANET_API int janet_scan_uint64(const uint8_t *str, int32_t len, uint64_t *out); +#ifdef JANET_INT_TYPES +JANET_API int janet_scan_numeric(const uint8_t *str, int32_t len, Janet *out); +#endif /* Debugging */ JANET_API void janet_debug_break(JanetFuncDef *def, int32_t pc); |
