Next | Making Programs Faster | 80 |
Here's an excerpt:
785 ## capturing parens keeps the delimiters)
786+ 1440 0.10 1.87 $_ = $text;
787 # my @tokens = split /([A-Z]<(?:<+\s)?)/;
788+ 1440 0.09 1.69 my @tokens = split /([A-Z] < # Escap
789 (?: [^<>]* > # ... and the re
790 | (?: <+ \s )? # OR a possible
791 ))/x;
792 # { local $" = ")\n("; warn "tokens: (@tokens)\
793* 7160 0.64 11.99 while ( @tokens ) {
794* 5720 0.22 4.12 $_ = shift @tokens;
795* 5720 0.25 4.68 next unless length;
796 ## Look for an entire simple sequence 2003
797+ 5652 0.14 2.62 if ( /^([A-Z])<([^<>]*)>$/ ) {
798* 2083 0.19 3.56 $seq = Pod::InteriorSequence->new(
799 -name => $1,
800 -ldelim => "<", -rdelim =>
801 -file => $file, -line
802 );
803+ 2083 0.10 1.87 $seq->append($2) if length($2);
804+ 2083 0.10 1.87 $seq->nested($seq_stack[-1]) if @seq_s
805+ 2083 0.10 1.87 $seq_stack[-1]->append($expand_seq ? &
806 }
807 ## Look for the beginning of a sequence
808 elsif ( /^([A-Z])(<(?:<+\s)?)$/ ) {
809 ## Push a new sequence onto the stack
810- 38 0.01 0.19 ($cmd, $ldelim) = ($1, $2);
811 38 0.00 0.00 $seq = Pod::InteriorSequence->new(
812 -name => $cmd,
813 -ldelim => $ldelim, -rdeli
814 -file => $file, -line
815 );
Some of this might be suggestive
For example, we might try to adjust the tokenizer to avoid generating empty tokens
This would obviate line 795
Next | Copyright © 2003 M. J. Dominus |