mirror of
https://github.com/imapsync/imapsync.git
synced 2025-07-24 19:18:16 +02:00
37 lines
879 B
Perl
Executable file
37 lines
879 B
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
use warnings;
|
|
use strict;
|
|
|
|
use Parse::RecDescent 1.94;
|
|
use File::Slurp qw/read_file/;
|
|
use File::Copy qw/move/;
|
|
|
|
sub build_parser($$);
|
|
|
|
build_parser 'lib/Mail/IMAPClient/BodyStructure/Parse.grammar'
|
|
, 'Mail::IMAPClient::BodyStructure::Parse';
|
|
|
|
build_parser 'lib/Mail/IMAPClient/Thread.grammar'
|
|
, 'Mail::IMAPClient::Thread';
|
|
|
|
sub build_parser($$)
|
|
{ my ($grammarfn, $package) = @_;
|
|
|
|
print "* building $package\n";
|
|
|
|
my $grammar = read_file $grammarfn
|
|
or die "cannot read grammar from $grammarfn: $!\n";
|
|
|
|
Parse::RecDescent->Precompile($grammar, $package);
|
|
|
|
# clumpsy output by Parse::RecDescent
|
|
my $outfn = $package . '.pm';
|
|
$outfn =~ s/.*\:\://;
|
|
|
|
my $realfn = $grammarfn;
|
|
$realfn =~ s/\.\w+$/.pm/;
|
|
|
|
move $outfn, $realfn
|
|
or die "cannot move $outfn to $realfn: $!\n";
|
|
}
|