Metadata-Version: 2.1
Name: struct-parse
Version: 0.0.2
Summary: Parse struct definitions like those used in the struct module
Home-page: https://github.com/zmarvel/struct_parse
Author: Zack Marvel
Author-email: zpmarvel@gmail.com
License: MIT
Project-URL: Bug Tracker, https://github.com/zmarvel/struct_parse/issues
Project-URL: Documentation, https://struct-parse.readthedocs.io/
Project-URL: Source Code, https://github.com/zmarvel/struct_parse
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown


struct-parse
============

``struct_parse`` builds on the struct_ module in the standard library.
``struct`` lets you parse buffers by describing the format similarly to C struct
definitions. ``struct_parse`` aims to comply with the ``struct`` module's format
strings, but instead returns a (very flat) abstract syntax tree (AST).


Example
-------

.. code-block:: python

  import struct_parse

  field_list = struct_parse.parse('hhl')
  print(field_list.fields)

This will print::

  [<FieldType.FLOAT: 16>, <FieldType.FLOAT: 16>, <FieldType.LONG: 9>]


Use cases
---------

For simply unpacking packed binary data, the ``struct`` module does the trick.
The goal of this module is to enable the user to do other stuff with the format
string--we return a sequence of types instead of a sequence of values.


Compatibility
-------------

This library supports only Python 3.

.. _struct: https://docs.python.org/3/library/struct.html


