mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-23 12:29:27 +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
|
# These are set automatically by the build/commit script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 643,
|
BUILD_REVISION => 644,
|
||||||
BUILD_DATE => "2014-06-14",
|
BUILD_DATE => "2014-06-15",
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -31,17 +31,13 @@ $Parse::RecDescent::skip = '\s*';
|
|||||||
|
|
||||||
my $parser;
|
my $parser;
|
||||||
|
|
||||||
if($opt_P) {
|
if($opt_P or !eval { require PCGrammar }) {
|
||||||
precompile_grammar();
|
precompile_grammar();
|
||||||
exit 0;
|
|
||||||
} else {
|
|
||||||
if(!eval { require PCGrammar }) {
|
|
||||||
precompile_grammar();
|
|
||||||
}
|
|
||||||
require PCGrammar;
|
require PCGrammar;
|
||||||
$parser = PCGrammar->new() or die "Bad grammar!\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$parser = PCGrammar->new() or die "Bad grammar!\n";
|
||||||
|
|
||||||
if ($opt_o) {
|
if ($opt_o) {
|
||||||
open(OUTFILE, ">>$opt_o");
|
open(OUTFILE, ">>$opt_o");
|
||||||
*STDOUT = *OUTFILE{IO};
|
*STDOUT = *OUTFILE{IO};
|
||||||
|
Loading…
Reference in New Issue
Block a user