changeset 171:3902240d4930

*** empty log message ***
author kono
date Mon, 24 Nov 2003 20:28:19 +0900
parents 6e0f67b7d200
children 096559f07a70
files mc-h-renum.pl
diffstat 1 files changed, 33 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mc-h-renum.pl	Mon Nov 24 20:28:19 2003 +0900
@@ -0,0 +1,33 @@
+#!/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; }
+    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;
+	}
+    }
+    print;
+}
+