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 16package Marpa::PP; 17 18use 5.010; 19use strict; 20use warnings; 21 22use vars qw($VERSION $STRING_VERSION $DEBUG); 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 32use Carp; 33use English qw( -no_match_vars ); 34 35# Die if more than one of the Marpa modules is loaded 36BEGIN { 37 if ( defined $Marpa::VERSION ) { 38 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 if ( defined $Marpa::XS::VERSION ) { 42 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 48use Marpa::PP::Version; 49 50@Marpa::PP::CARP_NOT = (); 51for 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} 56PACKAGE: for my $package (@Marpa::PP::CARP_NOT) { 57 no strict 'refs'; 58 next PACKAGE if $package eq 'Marpa'; 59 *{ $package . q{::CARP_NOT} } = \@Marpa::PP::CARP_NOT; 60} 61 62if ( not $ENV{'MARPA_AUTHOR_TEST'} ) { 63 $Marpa::PP::DEBUG = 0; 64} 65else { 66 $Marpa::PP::DEBUG = 1; 67} 68 69sub version_ok { 70 my ($sub_module_version) = @_; 71 return 'not defined' if not defined $sub_module_version; 72 return "$sub_module_version does not match Marpa::PP::VERSION " . $VERSION 73 if $sub_module_version != $VERSION; 74 return; 75} ## end sub version_ok 76 77my $version_result; 78require Marpa::PP::Internal; 79( $version_result = version_ok($Marpa::PP::Internal::VERSION) ) 80 and die 'Marpa::PP::Internal::VERSION ', $version_result; 81 82require Marpa::PP::Grammar; 83( $version_result = version_ok($Marpa::PP::Grammar::VERSION) ) 84 and die 'Marpa::PP::Grammar::VERSION ', $version_result; 85 86require Marpa::PP::Recognizer; 87( $version_result = version_ok($Marpa::PP::Recognizer::VERSION) ) 88 and die 'Marpa::PP::Recognizer::VERSION ', $version_result; 89 90require Marpa::PP::Value; 91( $version_result = version_ok($Marpa::PP::Value::VERSION) ) 92 and die 'Marpa::PP::Value::VERSION ', $version_result; 93 94require 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 1501; 151 152__END__ 153