comparison tools/mc-h-renum.pl @ 466:7c3d8237b625 gcc40

*** empty log message ***
author kono
date Mon, 16 May 2005 11:53:56 +0900
parents
children e055df7c1082
comparison
equal deleted inserted replaced
465:cdf827b1fcd9 466:7c3d8237b625
1 #!/usr/local/bin/perl
2
3 my $mode = 0;
4
5 my $reserve = -1;
6 my $tags = 1;
7 my $error = 1;
8 my $modnum = 0;
9
10 while(<>) {
11 if(m+/\* reserved word start \*/+) { $mode = 1; }
12 elsif(m+/\* reserved word end \*/+) { $mode = 0; }
13 elsif(m+/\* tree node tags start \*/+) { $mode = 2; }
14 elsif(m+/\* tree node tags end \*/+) { $mode = 0; }
15 elsif(m+/\* error number start \*/+) { $mode = 3; }
16 elsif(m+/\* error number end \*/+) { $mode = 0; }
17 elsif(m+/\* mode start \*/+) { $mode = 4; }
18 elsif(m+/\* mode end \*/+) { $mode = 0; }
19 elsif(m+/\* statement start \*/+) { $mode = 5; }
20 elsif(m+/\* statement end \*/+) { $mode = 0; }
21 else {
22 if ($mode==0) { ; }
23 elsif ($mode==1) {
24 s/-(\d+)/$reserve--/e;
25 } elsif ($mode==2) {
26 s/\s(\d+)/"\t".$tags++/e;
27 } elsif ($mode==3) {
28 s/(\d+)/$error++/e;
29 } elsif ($mode==4) {
30 s/(\d+)/$modenum++/e;
31 } elsif ($mode==5) {
32 s/(\d+)/$tags++/e;
33 }
34 }
35 print;
36 }
37