C
Clint Olsen
Hi:
I posted earlier about how to speed up writing lexical analyzers in Perl.
With that effort in mind, I was curious to know if Perl combines multiple
patterns like:
if (/pat/) {
} elsif (/pat1/) {
....
} elsif (/pat2/) {
....
....
....
} else {
}
so that pat[\d]+ are in a sense combined via alternation with each branch
working like embedded action code?
The reason why I ask is that someone suggested I try to do this manually in
order to help speed up the pattern matching process (presumably using the
"(?{ code })" feature documented in perlre. Is it really faster to do it
this way?
When I'm in the debugger in Perl, I've noticed that the execution path gets
sort of muddied. I don't see Perl executing each match as a separate
statement. It's as if it jumps right to the code for the pattern match.
If that's the case, then there's not much of a compelling argument to embed
action code and cobmine REs.
Thanks,
-Clint
I posted earlier about how to speed up writing lexical analyzers in Perl.
With that effort in mind, I was curious to know if Perl combines multiple
patterns like:
if (/pat/) {
} elsif (/pat1/) {
....
} elsif (/pat2/) {
....
....
....
} else {
}
so that pat[\d]+ are in a sense combined via alternation with each branch
working like embedded action code?
The reason why I ask is that someone suggested I try to do this manually in
order to help speed up the pattern matching process (presumably using the
"(?{ code })" feature documented in perlre. Is it really faster to do it
this way?
When I'm in the debugger in Perl, I've noticed that the execution path gets
sort of muddied. I don't see Perl executing each match as a separate
statement. It's as if it jumps right to the code for the pattern match.
If that's the case, then there's not much of a compelling argument to embed
action code and cobmine REs.
Thanks,
-Clint