File Coverage

blib/lib/Marpa/PP.pm
Criterion Covered Total %
statement 30 32 93.7
branch 4 8 50.0
condition n/a
subroutine 10 10 100.0
pod 0 1 0.0
total 44 51 86.2


line stmt bran cond sub pod time code
1             # Copyright 2012 Jeffrey Kegler
2             # This file is part of Marpa::PP. Marpa::PP is free software: you can
3             # redistribute it and/or modify it under the terms of the GNU Lesser
4             # General Public License as published by the Free Software Foundation,
5             # either version 3 of the License, or (at your option) any later version.
6             #
7             # Marpa::PP is distributed in the hope that it will be useful,
8             # but WITHOUT ANY WARRANTY; without even the implied warranty of
9             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10             # Lesser General Public License for more details.
11             #
12             # You should have received a copy of the GNU Lesser
13             # General Public License along with Marpa::PP. If not, see
14             # http://www.gnu.org/licenses/.
15              
16             package Marpa::PP;
17              
18 44     44   1264186 use 5.010;
  44         176  
  44         4963  
19 44     44   276 use strict;
  44         90  
  44         1695  
20 44     44   253 use warnings;
  44         105  
  44         2148  
21              
22 44     44   330 use vars qw($VERSION $STRING_VERSION $DEBUG);
  44         95  
  44         5863  
23             $VERSION = '0.014000';
24             $STRING_VERSION = $VERSION;
25             {
26             ## no critic (BuiltinFunctions::ProhibitStringyEval)
27             ## no critic (ValuesAndExpressions::RequireConstantVersion)
28             $VERSION = eval $VERSION;
29             }
30             $DEBUG = 0;
31              
32 44     44   264 use Carp;
  44         96  
  44         3803  
33 44     44   33428 use English qw( -no_match_vars );
  44         178229  
  44         476  
34              
35             # Die if more than one of the Marpa modules is loaded
36             BEGIN {
37 44 50   44   29633 if ( defined $Marpa::VERSION ) {
38 0         0 Carp::croak( "You can only load one of the Marpa modules at a time\n",
39             'Version ', $Marpa::VERSION, " of Marpa is already loaded\n" );
40             }
41 44 50       2799 if ( defined $Marpa::XS::VERSION ) {
42 0         0 Carp::croak( "You can only load one of the Marpa modules at a time\n",
43             'Version ', $Marpa::XS::VERSION,
44             " of Marpa::XS is already loaded\n" );
45             }
46             } ## end BEGIN
47              
48 44     44   32501 use Marpa::PP::Version;
  44         231  
  44         4914  
49              
50             @Marpa::PP::CARP_NOT = ();
51             for my $middle ( q{}, '::Internal' ) {
52             for my $end ( q{}, qw(::Recognizer ::Callback ::Grammar ::Value) ) {
53             push @Marpa::PP::CARP_NOT, 'Marpa::PP' . $middle . $end;
54             }
55             }
56             PACKAGE: for my $package (@Marpa::PP::CARP_NOT) {
57 44     44   310 no strict 'refs';
  44         88  
  44         66245  
58             next PACKAGE if $package eq 'Marpa';
59             *{ $package . q{::CARP_NOT} } = \@Marpa::PP::CARP_NOT;
60             }
61              
62             if ( not $ENV{'MARPA_AUTHOR_TEST'} ) {
63             $Marpa::PP::DEBUG = 0;
64             }
65             else {
66             $Marpa::PP::DEBUG = 1;
67             }
68              
69             sub version_ok {
70 220     220 0 833 my ($sub_module_version) = @_;
71 220 50       6599 return 'not defined' if not defined $sub_module_version;
72 220 50       1230 return "$sub_module_version does not match Marpa::PP::VERSION " . $VERSION
73             if $sub_module_version != $VERSION;
74 220         1507 return;
75             } ## end sub version_ok
76              
77             my $version_result;
78             require Marpa::PP::Internal;
79             ( $version_result = version_ok($Marpa::PP::Internal::VERSION) )
80             and die 'Marpa::PP::Internal::VERSION ', $version_result;
81              
82             require Marpa::PP::Grammar;
83             ( $version_result = version_ok($Marpa::PP::Grammar::VERSION) )
84             and die 'Marpa::PP::Grammar::VERSION ', $version_result;
85              
86             require Marpa::PP::Recognizer;
87             ( $version_result = version_ok($Marpa::PP::Recognizer::VERSION) )
88             and die 'Marpa::PP::Recognizer::VERSION ', $version_result;
89              
90             require Marpa::PP::Value;
91             ( $version_result = version_ok($Marpa::PP::Value::VERSION) )
92             and die 'Marpa::PP::Value::VERSION ', $version_result;
93              
94             require Marpa::PP::Callback;
95             ( $version_result = version_ok($Marpa::PP::Callback::VERSION) )
96             and die 'Marpa::PP::Callback::VERSION ', $version_result;
97              
98             $Marpa::USING_PP = 1;
99             $Marpa::USING_XS = undef;
100             $Marpa::MODULE = 'Marpa::PP';
101              
102             *Marpa::Grammar::check_terminal = \&Marpa::PP::Grammar::check_terminal;
103             *Marpa::Grammar::new = \&Marpa::PP::Grammar::new;
104             *Marpa::Grammar::precompute = \&Marpa::PP::Grammar::precompute;
105             *Marpa::Grammar::set = \&Marpa::PP::Grammar::set;
106             *Marpa::Grammar::show_AHFA = \&Marpa::PP::Grammar::show_AHFA;
107             *Marpa::Grammar::show_NFA = \&Marpa::PP::Grammar::show_NFA;
108             *Marpa::Grammar::show_accessible_symbols =
109             \&Marpa::PP::Grammar::show_accessible_symbols;
110             *Marpa::Grammar::show_nullable_symbols =
111             \&Marpa::PP::Grammar::show_nullable_symbols;
112             *Marpa::Grammar::show_nulling_symbols =
113             \&Marpa::PP::Grammar::show_nulling_symbols;
114             *Marpa::Grammar::show_productive_symbols =
115             \&Marpa::PP::Grammar::show_productive_symbols;
116             *Marpa::Grammar::show_problems = \&Marpa::PP::Grammar::show_problems;
117             *Marpa::Grammar::show_rules = \&Marpa::PP::Grammar::show_rules;
118             *Marpa::Grammar::show_symbols = \&Marpa::PP::Grammar::show_symbols;
119             *Marpa::Recognizer::alternative = \&Marpa::PP::Recognizer::alternative;
120             *Marpa::Recognizer::check_terminal = \&Marpa::PP::Recognizer::check_terminal;
121             *Marpa::Recognizer::current_earleme =
122             \&Marpa::PP::Recognizer::current_earleme;
123             *Marpa::Recognizer::earleme_complete =
124             \&Marpa::PP::Recognizer::earleme_complete;
125             *Marpa::Recognizer::earley_set_size =
126             \&Marpa::PP::Recognizer::earley_set_size;
127             *Marpa::Recognizer::end_input = \&Marpa::PP::Recognizer::end_input;
128             *Marpa::Recognizer::exhausted = \&Marpa::PP::Recognizer::exhausted;
129             *Marpa::Recognizer::latest_earley_set =
130             \&Marpa::PP::Recognizer::latest_earley_set;
131             *Marpa::Recognizer::new = \&Marpa::PP::Recognizer::new;
132             *Marpa::Recognizer::parse_count = \&Marpa::PP::Recognizer::parse_count;
133             *Marpa::Recognizer::read = \&Marpa::PP::Recognizer::read;
134             *Marpa::Recognizer::reset_evaluation =
135             \&Marpa::PP::Recognizer::reset_evaluation;
136             *Marpa::Recognizer::set = \&Marpa::PP::Recognizer::set;
137             *Marpa::Recognizer::show_and_nodes = \&Marpa::PP::Recognizer::show_and_nodes;
138             *Marpa::Recognizer::show_earley_sets =
139             \&Marpa::PP::Recognizer::show_earley_sets;
140             *Marpa::Recognizer::show_or_nodes = \&Marpa::PP::Recognizer::show_or_nodes;
141             *Marpa::Recognizer::show_progress = \&Marpa::PP::Recognizer::show_progress;
142             *Marpa::Recognizer::status = \&Marpa::PP::Recognizer::status;
143             *Marpa::Recognizer::terminals_expected =
144             \&Marpa::PP::Recognizer::terminals_expected;
145             *Marpa::Recognizer::tokens = \&Marpa::PP::Recognizer::tokens;
146             *Marpa::Recognizer::value = \&Marpa::PP::Recognizer::value;
147             *Marpa::location = \&Marpa::PP::location;
148             *Marpa::token_location = \&Marpa::PP::token_location;
149              
150             1;
151              
152             __END__