You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, parsus only supports fully parsing a string. If the string doesn't completely parse, it returns an error noting an index noting how far it was able to parse.
It would be very helpful if it also returned what it had succesfully parsed up until that point.
Because it doesn't have that feature, I've resorted to this hack:
classGrammar<Expression>() {
// ... the grammar I've ported overabstractval bind:Parser<T>
privateval any by token { input, fromIndex -> input.length - fromIndex }
val remain by parser {
val v = bind() to currentOffset
while (true) {
when (val t = currentToken?.token) {
EofToken, null->breakelse-> skip(t)
}
}
v
}
}
The text was updated successfully, but these errors were encountered:
Context: I'm porting an existing handwritten parser to use parsus.
Right now, parsus only supports fully parsing a string. If the string doesn't completely parse, it returns an error noting an index noting how far it was able to parse.
It would be very helpful if it also returned what it had succesfully parsed up until that point.
Because it doesn't have that feature, I've resorted to this hack:
The text was updated successfully, but these errors were encountered: