Re: [SimpleParse] Graceful failure ?
Brought to you by:
mcfletch
|
From: H. T. H. <hi...@co...> - 2004-03-19 00:27:44
|
On Thu, Mar 18, 2004 at 06:08:01PM -0500, Mike C. Fletcher wrote:
> H. T. Hind wrote:
>
> >Hello,
> >
> >Is there a way to get Simpleparse to gracefully exit instead
> >of going into an infinite loop ?
> >
> >For example if I have a grammar definition like this
> >
> >column_specs := '<s>',ws,('<c>',ws)+,'\n'
> >
> >then the system would go into an infinite loop if the input
> >contains '<S>' '<c>'
> >
> >
> I don't see how it could with the given definition. Infinite loops
> occur when you have a grammar like this:
>
> column_specs := '<s>',ws,('<c>'?,ws)+,'\n'
>
> that is, where you have a group that can match entirely with a null
> group and then you add an outer repeating modifier. As defined, the
> engine allows for external parsers and the like which may, in fact, have
> a null-length match, so to catch this, would need to extend how
> mxTextTools communicates success/failure to allow for another state.
Is there another way to define the above that avoids the loop ?
We might not be able to anticipate all the data that we might
encounter, hence it is essential to have the ability to fail with
an error such that a human can intervene and fix the data.
> It's possible to catch it, yes, but it would require some considerable
> work to modify the engine to be able to support the feature.
>
Would you recommend then something like PLY ?
Regards,
hth
|