I tried to keep the API idential to Parser.Advanced, so switching over to it should be relatively easy. All the functions should behave the same way as the corresponding functions in Parser.Advanced. The behaviour should only change when you apply one of the recovery tactics.
I cannot export (|.) and (|=) though, due to kernel code restrictions :-(. So you have to re-write those:
import Parser.Advanced as PA exposing ((|=), (|.))
parser =
PA.succeed identity
|. PA.spaces
|= PA.int
|. PA.spaces
to
import Parser.Recoverable as PR
parser =
PR.succeed identity
|> PR.ignore PR.spaces
|> PR.keep PR.int
|> PR.ignore PR.spaces
Another difference is that where functions like Parser.Advanced.keyword take a Token argument, I thought just passing in the String and problem without wrapping as a Token was neater:
PA.keyword (PA.Token "let" ExpectingLet)
PR.keyword "let" ExpectingLet
I’ll likely make a release soon - I’m trying to figure out how to make a recoverable version of sequence first. The fast-forward recovery at the moment fast forwards to a sentinal Char, then continues. But sequence uses Strings as separators not Chars, so I need to implement a slightly different fast-forward mechanism, then it will be good to go. I’ll just push it out with the recovery tactics I implemented so far, it will be interesting to hear if they work for you, or if you find they need to be modified to cover situations you are encountering.