Thanks for reply to Perl core dump issue .. i have found a work around ...

G

Gancy

Hi,
I really appreciate for time you people (Bob, Xhos, Anno, ...) took to
reply to my posting. Off late i posted a message asking a help for
perl core dump issues for the following regex.

$np = qr{
\(
(?:
(?>[^()]+ )
|
(??{ $np })
)*
\)
}x;
}

Though there were many possible solution to the problem, i have a
workaround for time being. I just had to increase the stack limit on
my solaris box to allow recursing to go deeper. I know this is not the
brightest solution, but fine till i come up with something solid for
production code.
Once again thank you very much for your replies.

- Ganesh
 
A

Anno Siegel

Gancy said:
Hi,
I really appreciate for time you people (Bob, Xhos, Anno, ...) took to
reply to my posting. Off late i posted a message asking a help for
perl core dump issues for the following regex.

$np = qr{
\(
(?:
(?>[^()]+ )
|
(??{ $np })
)*
\)
}x;
}

Though there were many possible solution to the problem, i have a
workaround for time being. I just had to increase the stack limit on
my solaris box to allow recursing to go deeper.

Oh dear...
I know this is not the
brightest solution, but fine till i come up with something solid for
production code.

Well, the regex above was never meant for production. It's a demonstration
that it *can be done*, no more no less.

A water-tight solution would have to parse the code, much like a compiler
does. A regex-only solution is not going to do.

Even an approximation would first have to recognize C (or C++) comments and
strings (and characters), as toke.c shows. I think there are regex solutions
for each, but both must be done together, not one after the other:

/* this " doesn't start a string */
s = "this /* doesn't start a comment";

I don't think there's a regex that does both.

Unless you involve rather high-level tools, a production solution doesn't
seem to be around the corner.

Anno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top