summaryrefslogtreecommitdiff
path: root/scripts/acronyms.pl
blob: d78afad28d876570848cb0495aaf0a196c8e4822 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env perl

use strict;
use warnings;
use 5.010;

my $re_line = qr{
	^
	(?<acronym> [A-Z]{2}[A-Z ]{0,3} )
	\s
	(?<name> .+)
	$
}x;

say <<'EOF';
package Travel::Status::DE::IRIS::Acronyms;

use strict;
use warnings;
use 5.010;
use utf8;

our $VERSION = '0.00';

my @acronyms = (
EOF

while (my $line = <STDIN>) {
	chomp $line;

	if ($line =~ $re_line) {
		my ($acronym, $name) = @+{qw{acronym name}};
		$name =~ s{'}{\\'}g;

		printf("\t['%s','%s'],\n", $acronym, $name);
	}
}

say <<'EOF';
);

sub get_acronyms {
	return @acronyms;
}

1;
EOF