Re: [xml] Failure Index Query in RegxpExec

On 8/24/07, Daniel Veillard <veillard redhat com> wrote:
On Fri, Aug 24, 2007 at 04:00:48PM +0530, Ashwin wrote:
>    Hi,
>    In the case of FaRegxpExec function suppose I give an arbitrarily long
>    input string for the grammar :-
>    (0|1|2|3|4|5|6|7|8|9){0,10}.
>    Ideally  I  suppose the execution should stop at 10 and return failure
>    in case of an input more than the range, however the exec->index keeps
>    moving to the end of the input
>    string. In case of very long strings, avoiding this might be helpful.

  There is zillions way you could try to optimize. The problem is making sure
this is exact. At the moment I really don't care to try to optimize performances
like that, this is useless IMHO, it would just make the code even more complex
and even harder to make sure it is right.

>    Also  is  there  any way to catch hold of the index where the matching
>    fails?

>  No you generally can't as we use stateful parsing. If I wasn't using stateful
> parsing then you would have *real* performance problems. Hopefully you
> understand my answer, if that's not the case, it means you still need to study
> that code a lot more before suggesting to change it ;-)

       You are on the button, I mean I know i still have lots to learn, especially with respect to the  regular _expression_ code. The thing is I have to deal with a requirement wherein I need to return the index in case of a partial match. So I was trying to use the exec->index variable to get the failure index, however no matter how much i tried there was always some case which i did not consider, so I thought of having a second opinion on whether it could actually be done or not......



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]