diff options
author | Yves Orton <demerphq@gmail.com> | 2006-11-02 13:35:10 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-11-02 12:26:47 +0000 |
commit | 24b23f37fefbcc71a881f6805d87449a234dc645 (patch) | |
tree | d7d4e050bd8ca74d9f9ca74ded7a2eb0f91e56b7 /regcomp.pl | |
parent | 68d3ba501ed4219f9b173a4c9e373c024180d087 (diff) | |
download | perl-24b23f37fefbcc71a881f6805d87449a234dc645.tar.gz |
Add more backtracking control verbs to regex engine (?CUT), (?ERROR)
Message-ID: <9b18b3110611020335h7ea469a8g28ca483f6832816d@mail.gmail.com>
p4raw-id: //depot/perl@29189
Diffstat (limited to 'regcomp.pl')
-rw-r--r-- | regcomp.pl | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/regcomp.pl b/regcomp.pl index 2e84604b5f..700268d83d 100644 --- a/regcomp.pl +++ b/regcomp.pl @@ -48,7 +48,7 @@ while (<DESC>) { $ind++; $name[$ind]="$real$suffix"; $type[$ind]=$type; - $rest[$ind]="Regmatch state for $type"; + $rest[$ind]="state for $type"; } } } @@ -92,13 +92,16 @@ EOP -$width, REGMATCH_STATE_MAX => $tot - 1 ; -$ind = 0; -while (++$ind <= $tot) { + +for ($ind=1; $ind <= $lastregop ; $ind++) { my $oind = $ind - 1; printf OUT "#define\t%*s\t%d\t/* %#04x %s */\n", -$width, $name[$ind], $ind-1, $ind-1, $rest[$ind]; - print OUT "\n\t/* ------------ States ------------- */\n\n" - if $ind == $lastregop and $lastregop != $tot; +} +print OUT "\t/* ------------ States ------------- */\n"; +for ( ; $ind <= $tot ; $ind++) { + printf OUT "#define\t%*s\t(REGNODE_MAX + %d)\t/* %s */\n", + -$width, $name[$ind], $ind - $lastregop, $rest[$ind]; } print OUT <<EOP; @@ -164,13 +167,19 @@ const char * reg_name[] = { EOP $ind = 0; +my $ofs = 1; +my $sym = ""; while (++$ind <= $tot) { my $size = $longj[$ind] || 0; - printf OUT "\t%*s\t/* %#04x */\n", - -3-$width,qq("$name[$ind]",),$ind-1; - print OUT "\t/* ------------ States ------------- */\n" - if $ind == $lastregop and $lastregop != $tot; + printf OUT "\t%*s\t/* $sym%#04x */\n", + -3-$width,qq("$name[$ind]",), $ind - $ofs; + if ($ind == $lastregop and $lastregop != $tot) { + print OUT "\t/* ------------ States ------------- */\n"; + $ofs = $lastregop; + $sym = 'REGNODE_MAX +'; + } + } print OUT <<EOP; |