-
Notifications
You must be signed in to change notification settings - Fork 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
Detect start of line #165
Comments
I would make a parser for a separator: val sep = (P.start | P.char('\n')).soft *> P.string("###") Then I would define your white space to be something like now. you can use repSep or something. |
Yup, I'm using something like this right now, but the problem with such defined separator is that it consumes the |
I implement few utils for my use case, but the problem is I had to do part of it in
|
I'm definitely open to having some mechanism to look back. The most general would be to access the whole String. But a more constrained would be to match the previous N characters with a given parser. I tend to think accessing the String and then a convenience method to implement what you need (hopefully without flatMap which is generally more costly). |
Note, we added You can use that to implement line start with |
I'm trying to parse a format where different parts are separated by
<start_of_line>####
fragment and so, I would like to be able to detect the<start_of_line>
.IMHO the logic should be similar to
P.start | <prev_char = '\n'>
.I'm not sure if that matters, but I'm trying to parse Intellij HTTP client file format with an explicit requirement of supporting
###
in the first line, so for exampleThe text was updated successfully, but these errors were encountered: