lib/scripts/keywords.pl
author wenzelm
Sun, 07 Oct 2007 13:32:16 +0200
changeset 24886 ce449d6aef3f
parent 24875 8e6ca75bf5aa
child 24890 5ce94680922e
permissions -rw-r--r--
added target tool specification; added jEdit output;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24875
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
     1
#
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
     2
# $Id$
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
     3
# Author: Makarius
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
     4
#
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
     5
# keywords.pl - generate outer syntax keyword files from session logs
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
     6
#
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
     7
24886
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
     8
## arguments
24875
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
     9
24886
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    10
my ($keywords_name, $target_tool, $sessions) = @ARGV;
24875
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    11
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    12
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    13
## keywords
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    14
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    15
my %keywords;
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    16
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    17
sub set_keyword {
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    18
  my ($name, $kind) = @_;
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    19
  if (defined $keywords{$name} and $keywords{$name} ne $kind) {
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    20
    print STDERR "### Inconsistent declaration of keyword \"${name}\": $keywords{$name} vs ${kind}\n";
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    21
  }
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    22
  $keywords{$name} = $kind;
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    23
}
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    24
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    25
sub collect_keywords {
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    26
  while(<STDIN>) {
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    27
    if (m/^Outer syntax keyword:\s*"(.*)"/) {
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    28
      my $name = $1;
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    29
      &set_keyword($name, "minor");
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    30
    }
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    31
    elsif (m/^Outer syntax command:\s*"(.*)"\s*\((.*)\)/) {
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    32
      my $name = $1;
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    33
      my $kind = $2;
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    34
      &set_keyword($name, $kind);
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    35
    }
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    36
  }
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    37
}
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    38
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    39
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    40
## Emacs output
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    41
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    42
sub emacs_output {
24886
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    43
  my @kinds = (
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    44
    "major",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    45
    "minor",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    46
    "control",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    47
    "diag",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    48
    "theory-begin",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    49
    "theory-switch",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    50
    "theory-end",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    51
    "theory-heading",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    52
    "theory-decl",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    53
    "theory-script",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    54
    "theory-goal",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    55
    "qed",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    56
    "qed-block",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    57
    "qed-global",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    58
    "proof-heading",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    59
    "proof-goal",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    60
    "proof-block",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    61
    "proof-open",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    62
    "proof-close",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    63
    "proof-chain",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    64
    "proof-decl",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    65
    "proof-asm",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    66
    "proof-asm-goal",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    67
    "proof-script"
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
    68
  );
24875
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    69
  my $file = $keywords_name eq "" ? "isar-keywords.el" : "isar-keywords-${keywords_name}.el";
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    70
  open (OUTPUT, "> ${file}") || die "$!";
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    71
  select OUTPUT;
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    72
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    73
  print ";;\n";
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    74
  print ";; Keyword classification tables for Isabelle/Isar.\n";
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    75
  print ";; This file was generated from ${sessions} -- DO NOT EDIT!\n";
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    76
  print ";;\n";
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    77
  print ";; \$", "Id\$\n";
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    78
  print ";;\n";
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    79
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    80
  for my $kind (@kinds) {
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    81
    my @names;
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    82
    for my $name (keys(%keywords)) {
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    83
      if ($kind eq "major" ? $keywords{$name} ne "minor" : $keywords{$name} eq $kind) {
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    84
        if ($kind ne "minor" or $name =~ m/^[A-Za-z0-9_]+$/) {
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    85
          push @names, $name;
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    86
        }
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    87
      }
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    88
    }
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    89
    @names = sort(@names);
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    90
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    91
    print "\n(defconst isar-keywords-${kind}";
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    92
    print "\n  '(";
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    93
    my $first = 1;
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    94
    for my $name (@names) {
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    95
      $name =~ s/([\.\*\+\?\[\]\^\$])/\\\\$1/g;
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    96
      if ($first) {
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    97
        print "\"${name}\"";
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    98
        $first = 0;
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
    99
      }
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
   100
      else {
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
   101
        print "\n    \"${name}\"";
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
   102
      }
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
   103
    }
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
   104
    print "))\n";
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
   105
  }
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
   106
  print "\n(provide 'isar-keywords)\n";
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
   107
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
   108
  close OUTPUT;
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
   109
  select;
24886
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   110
  print STDERR "${target_tool}: ${file}\n";
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   111
}
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   112
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   113
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   114
## jEdit output
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   115
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   116
sub jedit_output {
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   117
  my %keyword_types = (
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   118
    "minor"           => "KEYWORD4",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   119
    "control"         => "INVALID",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   120
    "diag"            => "LABEL",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   121
    "theory-begin"    => "KEYWORD3",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   122
    "theory-switch"   => "KEYWORD3",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   123
    "theory-end"      => "KEYWORD3",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   124
    "theory-heading"  => "OPERATOR",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   125
    "theory-decl"     => "OPERATOR",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   126
    "theory-script"   => "KEYWORD1",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   127
    "theory-goal"     => "OPERATOR",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   128
    "qed"             => "OPERATOR",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   129
    "qed-block"       => "OPERATOR",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   130
    "qed-global"      => "OPERATOR",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   131
    "proof-heading"   => "OPERATOR",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   132
    "proof-goal"      => "OPERATOR",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   133
    "proof-block"     => "OPERATOR",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   134
    "proof-open"      => "OPERATOR",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   135
    "proof-close"     => "OPERATOR",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   136
    "proof-chain"     => "OPERATOR",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   137
    "proof-decl"      => "OPERATOR",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   138
    "proof-asm"       => "KEYWORD2",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   139
    "proof-asm-goal"  => "KEYWORD2",
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   140
    "proof-script"    => "KEYWORD1"
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   141
  );
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   142
  my $file = "isabelle.xml";
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   143
  open (OUTPUT, "> ${file}") || die "$!";
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   144
  select OUTPUT;
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   145
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   146
  print <<'EOF';
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   147
<?xml version="1.0"?>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   148
<!DOCTYPE MODE SYSTEM "xmode.dtd">
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   149
<MODE>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   150
  <PROPS>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   151
    <PROPERTY NAME="commentStart" VALUE="(*"/>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   152
    <PROPERTY NAME="commentEnd" VALUE="*)"/>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   153
    <PROPERTY NAME="noWordSep" VALUE="_'.?"/>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   154
    <PROPERTY NAME="indentOpenBrackets" VALUE="{"/>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   155
    <PROPERTY NAME="indentCloseBrackets" VALUE="}"/>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   156
    <PROPERTY NAME="unalignedOpenBrackets" VALUE="(" />
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   157
    <PROPERTY NAME="unalignedCloseBrackets" VALUE=")" />
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   158
    <PROPERTY NAME="tabSize" VALUE="2" />
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   159
    <PROPERTY NAME="indentSize" VALUE="2" />
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   160
  </PROPS>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   161
  <RULES IGNORE_CASE="FALSE" HIGHLIGHT_DIGITS="FALSE" ESCAPE="\">
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   162
    <SPAN TYPE="COMMENT1" NO_ESCAPE="TRUE">
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   163
      <BEGIN>(*</BEGIN>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   164
      <END>*)</END>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   165
    </SPAN>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   166
    <SPAN TYPE="COMMENT3" NO_ESCAPE="TRUE">
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   167
      <BEGIN>{*</BEGIN>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   168
      <END>*}</END>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   169
    </SPAN>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   170
    <SPAN TYPE="LITERAL1">
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   171
      <BEGIN>`</BEGIN>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   172
      <END>`</END>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   173
    </SPAN>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   174
    <SPAN TYPE="LITERAL3">
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   175
      <BEGIN>"</BEGIN>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   176
      <END>"</END>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   177
    </SPAN>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   178
    <KEYWORDS>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   179
EOF
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   180
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   181
  for my $name (sort(keys(%keywords))) {
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   182
    my $kind = $keywords{$name};
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   183
    my $type = $keyword_types{$kind};
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   184
    if ($kind ne "minor" or $name =~ m/^[A-Za-z0-9_]+$/) {
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   185
      $name =~ s/&/&amp;/g;
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   186
      $name =~ s/</&lt;/g;
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   187
      $name =~ s/>/&lt;/g;
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   188
      print "      <${type}>${name}</${type}>\n";
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   189
    }
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   190
  }
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   191
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   192
  print <<'EOF';
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   193
    </KEYWORDS>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   194
  </RULES>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   195
</MODE>
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   196
EOF
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   197
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   198
  close OUTPUT;
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   199
  select;
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   200
  print STDERR "${target_tool}: ${file}\n";
24875
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
   201
}
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
   202
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
   203
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
   204
## main
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
   205
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
   206
&collect_keywords();
24886
ce449d6aef3f added target tool specification;
wenzelm
parents: 24875
diff changeset
   207
eval "${target_tool}_output()";
24875
8e6ca75bf5aa generate outer syntax keyword files from session logs;
wenzelm
parents:
diff changeset
   208