savi-lang / savi

A fast language for programmers who are passionate about their craft.
BSD 3-Clause "New" or "Revised" License
156 stars 12 forks source link

Add `.format.literal` and `.format.hex_dump` for the `Bytes` type. #306

Closed jemc closed 2 years ago

jemc commented 2 years ago

Bytes.Format.Literal formats Bytes as they could appear in Savi source code. That is, as a string literal with the b prefix and non-printable bytes escaped.

Bytes.Format.HexDump formats Bytes into a "hex dump", much like the output of the xxd command-line utility found on many UNIX platforms.

This latter format shows addresses, hex bytes, and corresponding ASCII characters, in a way that is intended to facilitate debugging of large data sequences.