Skip to main content

Module bytes

Module bytes 

Source
Expand description

Byte strings, GV35: how one is written down and how one is read back.

A byte string is a sequence of octets, and there is no encoding to guess at: the value is the bytes. What there is, is a spelling, and ISO 21.3 gives it as X'00AB', two hexits to a byte. Writing and reading that spelling is the whole of this module, and it is here rather than beside the lexer because the same spelling comes back out of a result column, so a value that went in as X'00ab' and came back as X'00AB' is the same value and reads as one.

Functionsยง

from_hexits
The bytes a run of hexits names, None for anything that is not a run of hexits or names half a byte.
hexits
The hexits of a byte string, upper case, no quotes and no X.
literal
The literal a byte string is written as, quotes and X and all.