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
|
#
# precompile script: Grammar.prd -> Config::Scoped::Precomp.pm
#
use strict;
use warnings;
use File::Spec;
use lib 'patched';
use Parse::RecDescent;
die "Can't find the patched P::RD in %INC, stopped"
unless $INC{'Parse/RecDescent.pm'} =~ /patched/;
my $version = shift or die "Version information needed, stopped";
# wrap it into single quotes
$version = "'$version'";
my $class = 'Config::Scoped::Precomp';
my $grammar_file = 'Grammar.prd';
chdir File::Spec->catdir(qw(lib Config Scoped))
or die "Can't chdir: $!,";
open GRAMMAR, $grammar_file
or die "Can't open grammarfile '$grammar_file': $!,";
my $grammar = join '', <GRAMMAR>
or die "Can't slurp '$grammar_file': $!";
$::RD_HINT = 1;
Parse::RecDescent->Precompile( $grammar, $class, $grammar_file, $version );
exit 0;
# vim: cindent sm nohls sw=2 sts=2
|