rizin/test/db/tools
Anton Kochkov 689bafb7a4
Rewrite the RzNum parser and calculator on tree-sitter (#4326)
Replace the hand-written parser in calc.c with a tree-sitter grammar
(subprojects/rizin-math-parser) and a typed evaluator. The old parser
could only ever produce a ut64 and folded anything it failed to read to
0, which left callers unable to tell a failed expression from one that
evaluated to zero.

Expressions now evaluate to an RzNumValue, a tagged union over ut64,
double, RzBitVector, arbitrary-precision integer and arbitrary-precision
decimal, carrying an RzNumError rather than signalling failure as 0.
Literals keep the width they were written with (5u8, 0xffu128, any width
from 1 to 65536), results that outgrow 64 bits promote to a big number on
their own, and a parse error, division by zero or unresolved identifier
reaches the caller.

rz_num_math() is deprecated. rz_num_math_ut64() keeps its exact behaviour
for callers that want a ut64, and rz_num_math_value() exposes the typed
result. rz_core_math() adds the RzCore-backed form used by the % command,
with rz_core_math_ut64() deprecated alongside it. rz-ax routes through the
typed API, so it prints values at full precision, reports errors on stderr
and exits non-zero. rz_il_lift_num() converts an expression to an
RzILOpPure, so a numeric argument can be lifted instead of pre-evaluated.

Legacy input still works: trailing base suffixes (101b, 35o, 212t), the
trailing-'h' hex form and the k/m/g scale suffixes are all accepted and
warn once, pointing at the 0b/0o/0t prefixes. doc/math.md documents the
language and doc/math-il-lift.md the lift; the grammar, the evaluator,
rz-ax and the % command are covered by unit and db tests.
2026-07-24 02:57:27 +08:00
..
rz Rewrite the RzNum parser and calculator on tree-sitter (#4326) 2026-07-24 02:57:27 +08:00
rz_ar rz-ar: add archive extraction utility (#6036) 2026-03-18 03:51:18 +08:00
rz_asm rz-asm: show an error when -m arg is invalid (#6519) 2026-06-17 11:22:17 +08:00
rz_ax Rewrite the RzNum parser and calculator on tree-sitter (#4326) 2026-07-24 02:57:27 +08:00
rz_bin Rewrite the RzNum parser and calculator on tree-sitter (#4326) 2026-07-24 02:57:27 +08:00
rz_diff Implement lcs-roll distance (myers+fastcdc) (#6512) 2026-06-15 23:23:54 +08:00
rz_find rz-find: flush output to avoid undeterminism (#6527) 2026-06-18 14:56:02 +08:00
rz_gg librz/egg: fix endian-dependent x86/x64 string immediates and refresh rz-gg tests (#6481) 2026-06-08 00:20:46 +08:00
rz_hash implement shake-128 and shake-256 (#6490) 2026-06-23 11:47:13 +08:00
rz_run Allow rizin tools to run as standalone binaries (#6011) 2026-03-11 16:24:23 +00:00
rz_sign Allow rizin tools to run as standalone binaries (#6011) 2026-03-11 16:24:23 +00:00
rz_test Add the Qualcomm Peripheral Image loader (MDT files, 32bit only). 2025-06-11 15:41:03 +00:00