While working on #36 I noticed a few things about the parser, that are part of this pr, since addressing them helped me understand the issue.
The helper parser combinators expect_non_empty, preferred over the |i| { Parser::expect_non_empty(i)? style, and traced_context, unifying #[test] debug!(...) have been added.
Parser::sp was always used as opt(Self::sp) and has been rewritten to reflect that.
Parser::sp now includes comments, which are hence parsed as if they were whitespace. This was the conclusion of asking on the nom gitter how to best ignore comments in arbitrary positions.
closes #36
There is potential for a follow up that looks over all the parsers and tries to rewrite things so that Self::sp is not called twice at the same input position, but that is not necessarily a part of this, but let me know if I should do that @futursolo.
While working on #36 I noticed a few things about the parser, that are part of this pr, since addressing them helped me understand the issue.
expect_non_empty
, preferred over the|i| { Parser::expect_non_empty(i)?
style, andtraced_context
, unifying#[test] debug!(...)
have been added.Parser::sp
was always used asopt(Self::sp)
and has been rewritten to reflect that.Parser::sp
now includes comments, which are hence parsed as if they were whitespace. This was the conclusion of asking on the nom gitter how to best ignore comments in arbitrary positions.There is potential for a follow up that looks over all the parsers and tries to rewrite things so that
Self::sp
is not called twice at the same input position, but that is not necessarily a part of this, but let me know if I should do that @futursolo.