Skip to content

minimize nom macros #3

@benkay86

Description

@benkay86

With nom 5.0 the author, Geoffroy, has soft-deprecated macros in nom. Although macros used to be needed to write concise parsers with nom, as Rust has evolved it is now possible to write equally concise parsers without macros. The advantages of minimizing macro use include more comprehensible error messages and less of a learning curve for newcomers since they do not have to learn and understand nom's niche macro conventions.

I'm interested in contributing to matfile and would prefer to write code using nom methods instead of nom macros. I realize that as the library author you may have strong preferences about this. I've rewritten parse_header() as an example of what parsing would look like with less reliance on nom macros. (I also removed panics and removed the assumption that the host machine is little endian.) Of course, the rewritten version still passes cargo test.

Please let me know what you think. I would be happy to work on the rest of the nom parsing code, but I don't want to waste time if you hate the macro-less syntax.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions