CGrammar: Improve logic of precompiling grammar

This commit is contained in:
Pragmatic Software 2014-06-15 15:42:20 +00:00
parent 7f84708a5e
commit 78419de052
2 changed files with 5 additions and 9 deletions

View File

@ -13,8 +13,8 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 643,
BUILD_DATE => "2014-06-14",
BUILD_REVISION => 644,
BUILD_DATE => "2014-06-15",
};
1;

View File

@ -31,17 +31,13 @@ $Parse::RecDescent::skip = '\s*';
my $parser;
if($opt_P) {
if($opt_P or !eval { require PCGrammar }) {
precompile_grammar();
exit 0;
} else {
if(!eval { require PCGrammar }) {
precompile_grammar();
}
require PCGrammar;
$parser = PCGrammar->new() or die "Bad grammar!\n";
}
$parser = PCGrammar->new() or die "Bad grammar!\n";
if ($opt_o) {
open(OUTFILE, ">>$opt_o");
*STDOUT = *OUTFILE{IO};