Package lepl :: Package bin :: Module literal
[hide private]
[frames] | no frames]

Module literal

source code

Specify and construct binary structures.

This is necessary for tests and may be useful in its own right. Note that it is also quite easy to construct Node instances with BitString data directly in Python.

The construction of binary values is a two-stage process. First, we describe a Python structure. Then we encode that structure as a binary value. As is standard in LEPL, the Python construct consists of Node instances.

The description of values has the form:
Node(byte=0xff/8, 0*100, Node(...), (...))
In more detail:
() is used for grouping, must exist outside the entire description, and
defines a Node. If preceded by a name, then that is used to create a subclass of Node (unless it is "Node", in which case it is the default). For now, repeated names are not validated in any way for consistency.
name=value/length is used for defining a value, in various ways:
value anonymous value (byte or array) value/length anonymous value with specified length name=value named byte or array name=value/length named value with given length
Functions [hide private]
Create a parser for binary data.
source code
Use the parser.
source code
Variables [hide private]
  __PARSER = None