Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Inter-format-string splicing #20

Open
ToxicFrog opened this issue Jul 5, 2013 · 1 comment
Open

[feature] Inter-format-string splicing #20

ToxicFrog opened this issue Jul 5, 2013 · 1 comment
Assignees

Comments

@ToxicFrog
Copy link
Owner

It is often convenient to incrementally build a format string, creating format strings describing individual sub-records before combining them into something larger. This is currently unwieldy and must be done with .. or string.format.

It would be nice to be able to do something like, say:

vstruct.register("toc_entry", "path:c4 size:u4")
vstruct.register("toc", "count:u4 toc:{ $count * <toc_entry> }")
vstruct.unpack("<toc>", buffer)

Syntax is still a work in progress, and this can be considered an intermediate step towards format string combinators (which I need to open an issue for).

@ToxicFrog
Copy link
Owner Author

848fd72 implements this, although the syntax and API are still a work in progress; I'm not ready to mark this closed (or cut a new release) until I'm happy with them.

Syntax uses &name, since $name is reserved for future expansion (backreferences).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant