1#!/usr/bin/perl -w
2
3# *.lm = old format, uses '_' as separator
4# *.ln = new format, uses NULL as separator
5#
6# <@LICENSE>
7# Licensed to the Apache Software Foundation (ASF) under one or more
8# contributor license agreements.  See the NOTICE file distributed with
9# this work for additional information regarding copyright ownership.
10# The ASF licenses this file to you under the Apache License, Version 2.0
11# (the "License"); you may not use this file except in compliance with
12# the License.  You may obtain a copy of the License at:
13#
14#     http://www.apache.org/licenses/LICENSE-2.0
15#
16# Unless required by applicable law or agreed to in writing, software
17# distributed under the License is distributed on an "AS IS" BASIS,
18# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19# See the License for the specific language governing permissions and
20# limitations under the License.
21# </@LICENSE>
22
23@files = <*.l[mn]>;
24open(STDOUT, "> ../rules/languages");
25foreach $file (sort @files) {
26	$lang = $file;
27	$lang =~ s@(.*/)?(.*)\.l[mn]$@$2@;
28	open(L, $file);
29	while(<L>) {
30		s/^([^0-9\s]+).*/$1/;
31		if ($file =~ /\.lm$/) {
32		    s/^_/\000/;
33		    s/_$/\000/;
34		}
35		print;
36	}
37	close(L);
38	print "0 $lang\n";
39}
40