diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/mc-h-renum.pl	Mon May 16 11:53:56 2005 +0900
@@ -0,0 +1,37 @@
+#!/usr/local/bin/perl
+
+my $mode = 0;
+
+my $reserve = -1;
+my $tags = 1;
+my $error = 1;
+my $modnum = 0;
+
+while(<>) {
+    if(m+/\* reserved word start \*/+) { $mode = 1; }
+    elsif(m+/\* reserved word end \*/+) { $mode = 0; }
+    elsif(m+/\* tree node tags start \*/+) { $mode = 2; }
+    elsif(m+/\* tree node tags end \*/+) { $mode = 0; }
+    elsif(m+/\* error number start \*/+) { $mode = 3; }
+    elsif(m+/\* error number end \*/+) { $mode = 0; }
+    elsif(m+/\* mode start \*/+) { $mode = 4; }
+    elsif(m+/\* mode end \*/+) { $mode = 0; }
+    elsif(m+/\* statement start \*/+) { $mode = 5; }
+    elsif(m+/\* statement end \*/+) { $mode = 0; }
+    else {
+	if ($mode==0) { ; }
+	elsif ($mode==1) {
+	    s/-(\d+)/$reserve--/e;
+	} elsif ($mode==2) {
+	    s/\s(\d+)/"\t".$tags++/e;
+	} elsif ($mode==3) {
+	    s/(\d+)/$error++/e;
+	} elsif ($mode==4) {
+	    s/(\d+)/$modenum++/e;
+	} elsif ($mode==5) {
+	    s/(\d+)/$tags++/e;
+	}
+    }
+    print;
+}
+