I was looking through the source code, and apparently there is no way to add a parser dynamically, since the function repeatable is not available :(
it'd be nice if you could add something like
|
return repeatable(this, l => l < occurrence, l => l === occurrence); |
optoccurrence(occurrence) {
return repeatable(this, l => l < occurrence, () => true);
}
or even
occurrencerange(start,end) {
return repeatable(this, l => l < end, l => l >= start);
}
or both?
I would love to do a pull request, but I have no idea about haskell, and I can't understand what something like "// Parser 'a 'c => unit -> Parser (List 'a) 'c" means, so out of fear of just being wrong, I will just ask politely here 😁.
Yes, I know you could use something like .opt().occurrence(x) however, it seems wasteful, when x is big
I was looking through the source code, and apparently there is no way to add a parser dynamically, since the function repeatable is not available :(
it'd be nice if you could add something like
masala-parser/src/lib/parsec/parser.js
Line 170 in 3fa77a2
or even
or both?
I would love to do a pull request, but I have no idea about haskell, and I can't understand what something like "// Parser 'a 'c => unit -> Parser (List 'a) 'c" means, so out of fear of just being wrong, I will just ask politely here 😁.
Yes, I know you could use something like
.opt().occurrence(x)however, it seems wasteful, when x is big