-
Notifications
You must be signed in to change notification settings - Fork 19
impl Trait for Version 2.0.0 of Chomp
#53
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
base: master
Are you sure you want to change the base?
Conversation
…I is not yet bound
…bug implementations
|
I should probably rename this branch, it is no longer an experiment :) |
|
How to properly handle the case of Example: macro_rules! ret { ( $e:expr ) => { any().then(ret($e)) } }
peek_next().bind(|c| match c {
b'{' => ret!(Token::StartObject),
b'}' => ret!(Token::EndObject),
b'(' => ret!(Token::StartArray),
b')' => // ...
b'"' => quoted_string(),
_ => tagged!(b"true", Token::True).or(
tagged!(b"false", Token::False).or(
tagged!(b"null", Token::Null).or(
number.or(whitespace))))
}) |
|
Seems like https://docs.rs solves the documentation issue, except for providing documentation for |
|
Great stuff! It looks though as this implementation would currently suffer from the lack the "anonymized enums" capability of |
|
I hope I can find the time soon to continue working on Chomp. @aldanor I have encountered that issue, or something close to it, with the But the more general case will require boxing, if no object-safe enum can be used. Maybe a macro can be used to build an enum for the static case to avoid boxing. |
…t implemented by Fn* traits
|
|
This is the
impl Traitbased monad implementation of Chomp for Rust Nightly. It is not intended to become the 1.0.0 of Chomp, currentmasteris using the monad-like syntax where an input is manually threaded. Instead version 2.0.0 will be the full-monad. See #50 for the reasoning why.Still heavily work in progress. An alpha is intended for release once the documentation-issue is solved.
Tests for
MonadPluslaws.Also write the laws in the documentation for the
Parsertrait.Fix tests for
Parser::inspectandparsers::*Tests for
Parser::then,Paser::map,Parser::map_err,Parser::skipandParser::boxedFrom::fromsupport in fundamental combinatorsThis needs to be investigated, it is definitely a good thing in general, but being able to not have to use type-inference on some chains would be awesome (investigate default types).
Formalize changes to grammar of the
parse!macro.Documentation updates
Describe how the monad executes
Add documentation regarding the two different versions in README.md,
1.0.0and this2.0.0, with links between the two so it is easy to look at both of them (and make sure that users understand which works on stable and which one on nightly, and their benefits and drawbacks).Implement support for hosting documentation of both the
1.0.0and2.0.0branch at the same time.Investigate feasibility of using a
ParserFactorytrait as a parameter to repeating combinators likemanyinstead of using aFnMut() -> impl Parser<I>generic. This would get rid of the requirements onfn_traitsandunboxed_closuresfeatures.How to solve the issue with
peek_next+switchhaving differently typed parsers for each branch in theswitch?