-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add a repSplit(p)
function to Parser
#138
Comments
nicolas-zozol
changed the title
Add a
Add a May 12, 2019
repJoin(p)
function to Parser
split(p)
function to Parser
nicolas-zozol
changed the title
Add a
Add a May 12, 2019
split(p)
function to Parser
repSplit(p)
function to Parser
This should be written:
Indeed the |
The |
For the record, here is a way to go back if ever needed. const parser = C.string('this is wanted').then(C.char(';'));
const backParser = new Parser(function (input, index) {
return parser.parse(input, index) // parsing with regular parser
.fold( // then modifing the response
accept =>
response.accept(
accept.value,
accept.input,
accept.offset - 1, // moving back of one offset
accept.consumed
),
reject =>
response.reject(
reject.input, reject.offset, reject.consumed
)
);
});
const resp = backParser.parse(Streams.ofString(line)); |
nicolas-zozol
added a commit
that referenced
this issue
May 12, 2019
…ser, like the BackParser in #138.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A simple exemple would be for bullet points
If we use
bullet().then(eol()).rep()
, then the lasteol()
is eaten by the parser, so we can't separate easily bullet block by at least twoeol()
.So the idea would be
bullet().repSplit(eol())
and would return aTupleParser<Bullet>
.Other option maybe more general but maybe less in the Parsec philosohy is to make
It could be use in many more situations (including bad ones)
The text was updated successfully, but these errors were encountered: