171
|
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 else {
|
|
20 if ($mode==0) { ; }
|
|
21 elsif ($mode==1) {
|
|
22 s/-(\d+)/$reserve--/e;
|
|
23 } elsif ($mode==2) {
|
|
24 s/\s(\d+)/"\t".$tags++/e;
|
|
25 } elsif ($mode==3) {
|
|
26 s/(\d+)/$error++/e;
|
|
27 } elsif ($mode==4) {
|
|
28 s/(\d+)/$modenum++/e;
|
|
29 }
|
|
30 }
|
|
31 print;
|
|
32 }
|
|
33
|