-
Notifications
You must be signed in to change notification settings - Fork 52
skipSpaces
always commits to branch even if no spaces are consumed
#200
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
Comments
I'm not sure I agree with this. There are cases where it makes sense to commit to a branch even when the input stream slice is unchanged, such as with |
However, if |
Probably one of semantics. I'm not sure if the current behavior is different than the previous one. |
Yeah, both of these parsers succeed for both of these inputs, but have different consumed states afterwards if the input has no spaces.
I think the prior version of purescript-parsing/src/Text/Parsing/Parser/String.purs Lines 149 to 151 in 24d6693
|
So, which should be the correction version? If the current one (where |
I think that it should have the semantics similar to
Which is If we don't want to change the type, which I think makes sense for now, then I would make |
Describe the bug
skipSpaces
always commits to its path, even if it doesn't consume any spaces. This occurs because it uses theconsumeWith
function.To Reproduce
See https://try.purescript.org/?gist=a37247868f0f7aaf3244f8c07fc304f6
In the line 4, no spaces are consumed. So, the
(singleLineComment <|> newline)
parse shouldn't occur and we should instead move to the next part of the parserstring "@" *> string "value"
.Expected behavior
skipSpaces
should only commit to its path if it actually consumes content.Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: