# Copyright 2010 Jeffrey Kegler
# This file is part of Marpa::XS.  Marpa::XS is free software: you can
# redistribute it and/or modify it under the terms of the GNU Lesser
# General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# Marpa::XS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser
# General Public License along with Marpa::XS.  If not, see
# http://www.gnu.org/licenses/.

Recce_C * T_MARPA_R_C
Grammar * T_MARPA_G_C

Marpa_Grammar_ID T_IV
Marpa_Symbol_ID T_IV
Marpa_Rule_ID T_IV

Earley_Item * T_MARPA_EARLEY_ITEM
Rule * T_MARPA_RULE

INPUT

T_MARPA_G_C
	if (sv_isa($arg, \"Marpa::XS::Internal::G_C\")) {
	    IV tmp = SvIV((SV*)SvRV($arg));
	    $var = INT2PTR(Grammar *, tmp);
	} else
	    Perl_croak(aTHX_ \"%s: %s is not of type Marpa::XS::Internal::G_C\",
			${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
			\"$var\")

T_MARPA_RULE
	if (sv_isa($arg, \"Marpa::XS::Internal::Rule_C\")) {
	    IV tmp = SvIV((SV*)SvRV($arg));
	    $var = INT2PTR(Rule *, tmp);
	} else
	    Perl_croak(aTHX_ \"%s: %s is not of type Marpa::XS::Internal::Rule_C\",
			${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
			\"$var\")

T_MARPA_R_C
	if (sv_isa($arg, \"Marpa::XS::Internal::R_C\")) {
            $var = (Recce_C *)SvPV_nolen((SV*)SvRV($arg));
	} else
	    Perl_croak(aTHX_ \"%s: %s is not of type Marpa::XS::Internal::R_C\",
			${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
			\"$var\")

T_MARPA_EARLEY_ITEM
	if (sv_isa($arg, \"Marpa::XS::Internal::Earley_Item_C\")) {
	    IV tmp = SvIV((SV*)SvRV($arg));
	    $var = INT2PTR(Earley_Item*, tmp);
	} else
	    Perl_croak(aTHX_ \"%s: %s is not of type Marpa::XS::Internal::Earley_Item_C\",
			${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
			\"$var\")
