Lisp HUG Maillist Archive

parsergen error handling

Hi,

Does anyone know of a good way to do error recovery using parsergen?
I see that the default error recovery function sometimes inserts,
skips, or replaces tokens; is there any way to control this process?
For example, can I handle a condition and call an INSERT-TOKEN restart
or anything like that?

I've looked at using error productions of the form ((non-terminal
:error) forms*), but they don't seem to be powerful enough for what I
need.  They appear to be intended more for making subsequent error
messages more helpful rather than for recovering to a successful
parse.

I realize that "recovering to a successful parse" is not a feasible
goal in general, but it's exactly what I want in my current project.
I'm trying to implement Javascript's execrable semicolon-insertion;
the spec wants you to parse until you encounter an "offending token"
and then insert a semicolon in front of it. (!)

Thanks,
     James
--
James Wright
Ask me about my vow of silence!


Updated at: 2020-12-10 08:47 UTC