mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-26 22:09:26 +01:00
CGrammar: Improve logic of precompiling grammar
This commit is contained in:
parent
7f84708a5e
commit
78419de052
@ -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;
|
||||
|
@ -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};
|
||||
|
Loading…
Reference in New Issue
Block a user