File Coverage

blib/lib/Petal/CodePerl/GrammarLoader.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1 1     1   12 use strict;
  1         3  
  1         61  
2 1     1   10 use warnings;
  1         4  
  1         747  
3              
4             my $CompiledGrammar = $ENV{CODEPERL_DEV} ? 0 : 1;
5              
6             # handy for being able alter the grammar during development
7              
8             my $parser;
9              
10             if($CompiledGrammar)
11             {
12             require Petal::CodePerl::Parser;
13             $parser = Petal::CodePerl::Parser->new;
14             }
15             else
16             {
17             require Parse::RecDescent;
18              
19             my $petales_grammar = do "grammar" || die "No grammar";
20              
21             local $Parse::RecDescent::skip = "";
22             $::RD_HINT = 1;
23             #$::RD_TRACE = 1;
24              
25             $parser = Parse::RecDescent->new($petales_grammar) || die "Parser didn't compile";
26             }
27              
28             $Petal::CodePerl::Compiler::Parser = $parser;