C
Clint O
Hi:
Unfortunately, the program I have is way too complex to post here, but
I wrote a lexical analyzer in Perl which makes heavy use of these code
blocks because it more closely approximates the behavior of lex/flex
than anything else I've found. I've tried both 5.8.7 and 5.10.0 with
varying results, and I've noticed that when I attempt to call the
regular expression engine inside I get two possible outcomes:
1) Out of memory
2) Segmentation fault
my $macro_text = qr/^(.*?[^\\]\n)
(?{
$text = $^N;
#$text_lines = $text =~ s|\\\n|\n|
gs;
@text_lines = split('\n', $text);
@r = ('MACRO_TEXT', $text, scalar
(@text_lines), 0);
})
/sx;
The following attempts to snarf arbitrary replacement text in a
textual macro up to a newline not preceded by a backslash. One of the
things I need to do is a few transformations according the user guide
like strip the backslashes out of the macro text. There are a few
others.
I've also noticed that declaring 'my' variables local to these blocks
can cause Perl segfaults etc. as well. I do realize these code blocks
are experimental, but this simplifies my life quite a bit by allowing
the inline code to make pattern specific calculations before the match
is complete.
Any suggestions you could offer would be much appreciated.
Thanks,
-Clint
Unfortunately, the program I have is way too complex to post here, but
I wrote a lexical analyzer in Perl which makes heavy use of these code
blocks because it more closely approximates the behavior of lex/flex
than anything else I've found. I've tried both 5.8.7 and 5.10.0 with
varying results, and I've noticed that when I attempt to call the
regular expression engine inside I get two possible outcomes:
1) Out of memory
2) Segmentation fault
my $macro_text = qr/^(.*?[^\\]\n)
(?{
$text = $^N;
#$text_lines = $text =~ s|\\\n|\n|
gs;
@text_lines = split('\n', $text);
@r = ('MACRO_TEXT', $text, scalar
(@text_lines), 0);
})
/sx;
The following attempts to snarf arbitrary replacement text in a
textual macro up to a newline not preceded by a backslash. One of the
things I need to do is a few transformations according the user guide
like strip the backslashes out of the macro text. There are a few
others.
I've also noticed that declaring 'my' variables local to these blocks
can cause Perl segfaults etc. as well. I do realize these code blocks
are experimental, but this simplifies my life quite a bit by allowing
the inline code to make pattern specific calculations before the match
is complete.
Any suggestions you could offer would be much appreciated.
Thanks,
-Clint