Currently trying to write a recovery tactic for sequences, which is proving quite tricky.
Parser.Advanced.sequence
lets you specify how you want the Trailing
separators handled with its Forbidden
, Optional
and Mandatory
choices. A recoverable parser has to deal with missing values in the sequence, including at the very end, which is going to interact with the trailing separators choice. I suppose I just need to enemerate all the possibilities and figure out what the outcome should be for each.
For example:
For a sequence like [1,]
, supposed to be an Elm-style List of Ints.
Forbidden trailing ,
- so error is ‘skipped ahead to the end token’, with the Partial
result [1]
.
… other options
… other error sequences that are possible