m4rw3r/chomp

Maybe move the core of Chomp into an inner crate?

m4rw3r opened this issue · 1 comments

To separate the core and the provided combinators, parsers and buffers it might be a good idea to move the core of Chomp into an inner crate. It would still be the same repository and the crate people use would still be chomp, but for the cases where people want a bare-bones parser-combinator, chomp-core could be used directly from the repository.

Items considered chomp-core

struct Input;
struct ParseResult;

macro_rules parse!;
macro_rules parser!;

mod primitives {
    trait InputBuffer;
    trait InputClone;
    trait IntoInner;

    struct State;

    mod input {
        const DEFAULT;
        const END_OF_INPUT;

        fn new;
    }

    mod parse_result {
        fn new;
    }
}

Items not considered core

(Despite looking like they belong)

  • SimpleResult, U8Result and mod parsers

    These are just provided parsers, users might want to provide their own. The error type involved in SimpleResult and U8Result is only specific to the parsers in the parsers module.

  • ascii module

    Just utilities

  • buffer module

    Same, but for reading from Read and Iterator sources.

  • combinators module

    Pretty generic, since they do not have a fixed error type of any kind. The user might want to provide their own though.

Moving it into another crate will make all examples stop working, since the parsers are not part of the core. So that is a no-go.

And moving it into an inner module makes rustdoc fail to actually document the stuff inside of the inner non-public module, despite the pub use reexports (the code works as before, but nothing actually gets documented, just displays reexports).

Seems like this is a no-go for now.