Metadata-Version: 2.1
Name: struct-parse
Version: 0.0.1
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: UNKNOWN
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][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

```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 unpack packed 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


