Re: Understanding resynchronization

[email protected] (Damian Conway)
Newsgroups perl.recdescent
Message-ID <[email protected]>
Doug writes:
 
   > My problem is in understanding error recovery and resychronization.
   > 
   >   If parsing fails on a statement, I'd like to report an error, skip
   > that statement, and continue with the rest of the source; hoping to pick
   > up multiple errors in one run.
   > Unfortunately, parsing seems to quit with the first error (the text
   > remaining goes back to the full input text and the process stops).

Your problem is that you've added a <reject> after the <resync>:

   > Line: Line1
   >     | Line2
   >     | <resync: [^;]*;> <reject>

The <reject> causes the Line rule to fail, whereas a <resync> by itself
would allow it to succeed.

Damian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.