lib/ParserGenerator/PHP/ParserGenerator/Data.php
function resolve_conflict($apx, $apy, $errsym)
    {
        $errcnt = 0;
        if ($apx->sp !== $apy->sp) {
            throw new Exception('no conflict but resolve_conflict called');
        }
        if ($apx->type == PHP_ParserGenerator_Action::SHIFT && $apy->type == PHP_ParserGenerator_Action::REDUCE) {
            $spx = $apx->sp;
            $spy = $apy->x->precsym;
            if ($spy === 0 || $spx->prec < 0 || $spy->prec < 0) {
                /* Not enough precedence information. */
                $apy->type = PHP_ParserGenerator_Action::CONFLICT;
                $errcnt++;
            } elseif ($spx->prec > $spy->prec) {    /* Lower precedence wins */
                $apy->type = PHP_ParserGenerator_Action::RD_RESOLVED;
            } elseif ($spx->prec < $spy->prec) {
                $apx->type = PHP_ParserGenerator_Action::SH_RESOLVED;
            } elseif ($spx->prec === $spy->prec && $spx->assoc == PHP_ParserGenerator_Symbol::RIGHT) {
                /* Use operator */
                $apy->type = PHP_ParserGenerator_Action::RD_RESOLVED;                       /* associativity */
            } elseif ($spx->prec === $spy->prec && $spx->assoc == PHP_ParserGenerator_Symbol::LEFT) {
                /* to break tie */
                $apx->type = PHP_ParserGenerator_Action::SH_RESOLVED;
            } else {
                if ($spx->prec !== $spy->prec || $spx->assoc !== PHP_ParserGenerator_Symbol::NONE) {
                    throw new Exception('$spx->prec !== $spy->prec || $spx->assoc !== PHP_ParserGenerator_Symbol::NONE');
                }
                $apy->type = PHP_ParserGenerator_Action::CONFLICT;
                $errcnt++;
            }
        } elseif ($apx->type == PHP_ParserGenerator_Action::REDUCE && $apy->type == PHP_ParserGenerator_Action::REDUCE) {
            $spx = $apx->x->precsym;
            $spy = $apy->x->precsym;
            if ($spx === 0 || $spy === 0 || $spx->prec < 0 ||
                  $spy->prec < 0 || $spx->prec === $spy->prec) {
                $apy->type = PHP_ParserGenerator_Action::CONFLICT;
                $errcnt++;
            } elseif ($spx->prec > $spy->prec) {
                $apy->type = PHP_ParserGenerator_Action::RD_RESOLVED;
            } elseif ($spx->prec < $spy->prec) {
                $apx->type = PHP_ParserGenerator_Action::RD_RESOLVED;
            }
        } else {
            if ($apx->type!== PHP_ParserGenerator_Action::SH_RESOLVED &&
                $apx->type!== PHP_ParserGenerator_Action::RD_RESOLVED &&
                $apx->type!== PHP_ParserGenerator_Action::CONFLICT &&
                $apy->type!== PHP_ParserGenerator_Action::SH_RESOLVED &&
                $apy->type!== PHP_ParserGenerator_Action::RD_RESOLVED &&
                $apy->type!== PHP_ParserGenerator_Action::CONFLICT) {
                throw new Exception('$apx->type!== PHP_ParserGenerator_Action::SH_RESOLVED &&
                $apx->type!== PHP_ParserGenerator_Action::RD_RESOLVED &&
                $apx->type!== PHP_ParserGenerator_Action::CONFLICT &&
                $apy->type!== PHP_ParserGenerator_Action::SH_RESOLVED &&
                $apy->type!== PHP_ParserGenerator_Action::RD_RESOLVED &&
                $apy->type!== PHP_ParserGenerator_Action::CONFLICT');
            }
            /* The REDUCE/SHIFT case cannot happen because SHIFTs come before
            ** REDUCEs on the list.  If we reach this point it must be because
            ** the parser conflict had already been resolved. */
        }
        return $errcnt;
    }
function resolve_conflict($apx, $apy, $errsym)
    {
        $errcnt = 0;
        if ($apx->sp !== $apy->sp) {
            throw new Exception('no conflict but resolve_conflict called');
        }
        if ($apx->type == PHP_ParserGenerator_Action::SHIFT && $apy->type == PHP_ParserGenerator_Action::REDUCE) {
            $spx = $apx->sp;
            $spy = $apy->x->precsym;
            if ($spy === 0 || $spx->prec < 0 || $spy->prec < 0) {
                /* Not enough precedence information. */
                $apy->type = PHP_ParserGenerator_Action::CONFLICT;
                $errcnt++;
            } elseif ($spx->prec > $spy->prec) {    /* Lower precedence wins */
                $apy->type = PHP_ParserGenerator_Action::RD_RESOLVED;
            } elseif ($spx->prec < $spy->prec) {
                $apx->type = PHP_ParserGenerator_Action::SH_RESOLVED;
            } elseif ($spx->prec === $spy->prec && $spx->assoc == PHP_ParserGenerator_Symbol::RIGHT) {
                /* Use operator */
                $apy->type = PHP_ParserGenerator_Action::RD_RESOLVED;                       /* associativity */
            } elseif ($spx->prec === $spy->prec && $spx->assoc == PHP_ParserGenerator_Symbol::LEFT) {
                /* to break tie */
                $apx->type = PHP_ParserGenerator_Action::SH_RESOLVED;
            } else {
                if ($spx->prec !== $spy->prec || $spx->assoc !== PHP_ParserGenerator_Symbol::NONE) {
                    throw new Exception('$spx->prec !== $spy->prec || $spx->assoc !== PHP_ParserGenerator_Symbol::NONE');
                }
                $apy->type = PHP_ParserGenerator_Action::CONFLICT;
                $errcnt++;
            }
        } elseif ($apx->type == PHP_ParserGenerator_Action::REDUCE && $apy->type == PHP_ParserGenerator_Action::REDUCE) {
            $spx = $apx->x->precsym;
            $spy = $apy->x->precsym;
            if ($spx === 0 || $spy === 0 || $spx->prec < 0 ||
                  $spy->prec < 0 || $spx->prec === $spy->prec) {
                $apy->type = PHP_ParserGenerator_Action::CONFLICT;
                $errcnt++;
            } elseif ($spx->prec > $spy->prec) {
                $apy->type = PHP_ParserGenerator_Action::RD_RESOLVED;
            } elseif ($spx->prec < $spy->prec) {
                $apx->type = PHP_ParserGenerator_Action::RD_RESOLVED;
            }
        } else {
            if ($apx->type!== PHP_ParserGenerator_Action::SH_RESOLVED &&
                $apx->type!== PHP_ParserGenerator_Action::RD_RESOLVED &&
                $apx->type!== PHP_ParserGenerator_Action::CONFLICT &&
                $apy->type!== PHP_ParserGenerator_Action::SH_RESOLVED &&
                $apy->type!== PHP_ParserGenerator_Action::RD_RESOLVED &&
                $apy->type!== PHP_ParserGenerator_Action::CONFLICT) {
                throw new Exception('$apx->type!== PHP_ParserGenerator_Action::SH_RESOLVED &&
                $apx->type!== PHP_ParserGenerator_Action::RD_RESOLVED &&
                $apx->type!== PHP_ParserGenerator_Action::CONFLICT &&
                $apy->type!== PHP_ParserGenerator_Action::SH_RESOLVED &&
                $apy->type!== PHP_ParserGenerator_Action::RD_RESOLVED &&
                $apy->type!== PHP_ParserGenerator_Action::CONFLICT');
            }
            /* The REDUCE/SHIFT case cannot happen because SHIFTs come before
            ** REDUCEs on the list.  If we reach this point it must be because
            ** the parser conflict had already been resolved. */
        }
        return $errcnt;
    }
function resolve_conflict ( $ apx , $ apy , $ errsym ) { $ errcnt = 0 ; if ( $ apx -> sp !== $ apy -> sp ) { throw new Exception ( 'no conflict but resolve_conflict called' ) ; } if ( $ apx -> type == PHP_ParserGenerator_Action :: SHIFT && $ apy -> type == PHP_ParserGenerator_Action :: REDUCE ) { $ spx = $ apx -> sp ; $ spy = $ apy -> x -> precsym ; if ( $ spy === 0 || $ spx -> prec < 0 || $ spy -> prec < 0 ) { /* Not enough precedence information. */ $ apy -> type = PHP_ParserGenerator_Action :: CONFLICT ; $ errcnt ++ ; } elseif ( $ spx -> prec > $ spy -> prec ) { /* Lower precedence wins */ $ apy -> type = PHP_ParserGenerator_Action :: RD_RESOLVED ; } elseif ( $ spx -> prec < $ spy -> prec ) { $ apx -> type = PHP_ParserGenerator_Action :: SH_RESOLVED ; } elseif ( $ spx -> prec === $ spy -> prec && $ spx -> assoc == PHP_ParserGenerator_Symbol :: RIGHT ) { /* Use operator */ $ apy -> type = PHP_ParserGenerator_Action :: RD_RESOLVED ; /* associativity */ } elseif ( $ spx -> prec === $ spy -> prec && $ spx -> assoc == PHP_ParserGenerator_Symbol :: LEFT ) { /* to break tie */ $ apx -> type = PHP_ParserGenerator_Action :: SH_RESOLVED ; } else { if ( $ spx -> prec !== $ spy -> prec || $ spx -> assoc !== PHP_ParserGenerator_Symbol :: NONE ) { throw new Exception ( '$spx->prec !== $spy->prec || $spx->assoc !== PHP_ParserGenerator_Symbol::NONE' ) ; } $ apy -> type = PHP_ParserGenerator_Action :: CONFLICT ; $ errcnt ++ ; } } elseif ( $ apx -> type == PHP_ParserGenerator_Action :: REDUCE && $ apy -> type == PHP_ParserGenerator_Action :: REDUCE ) { $ spx = $ apx -> x -> precsym ; $ spy = $ apy -> x -> precsym ; if ( $ spx === 0 || $ spy === 0 || $ spx -> prec < 0 || $ spy -> prec < 0 || $ spx -> prec === $ spy -> prec ) { $ apy -> type = PHP_ParserGenerator_Action :: CONFLICT ; $ errcnt ++ ; } elseif ( $ spx -> prec > $ spy -> prec ) { $ apy -> type = PHP_ParserGenerator_Action :: RD_RESOLVED ; } elseif ( $ spx -> prec < $ spy -> prec ) { $ apx -> type = PHP_ParserGenerator_Action :: RD_RESOLVED ; } } else { if ( $ apx -> type !== PHP_ParserGenerator_Action :: SH_RESOLVED && $ apx -> type !== PHP_ParserGenerator_Action :: RD_RESOLVED && $ apx -> type !== PHP_ParserGenerator_Action :: CONFLICT && $ apy -> type !== PHP_ParserGenerator_Action :: SH_RESOLVED && $ apy -> type !== PHP_ParserGenerator_Action :: RD_RESOLVED && $ apy -> type !== PHP_ParserGenerator_Action :: CONFLICT ) { throw new Exception ( '$apx->type!== PHP_ParserGenerator_Action::SH_RESOLVED &&
                $apx->type!== PHP_ParserGenerator_Action::RD_RESOLVED &&
                $apx->type!== PHP_ParserGenerator_Action::CONFLICT &&
                $apy->type!== PHP_ParserGenerator_Action::SH_RESOLVED &&
                $apy->type!== PHP_ParserGenerator_Action::RD_RESOLVED &&
                $apy->type!== PHP_ParserGenerator_Action::CONFLICT' ) ; } /* The REDUCE/SHIFT case cannot happen because SHIFTs come before
            ** REDUCEs on the list.  If we reach this point it must be because
            ** the parser conflict had already been resolved. */ } return $ errcnt ; }
Resolve a conflict between the two given actions.  If the
conflict can't be resolve, return non-zero.

NO LONGER TRUE:
To resolve a conflict, first look to see if either action
is on an error rule.  In that case, take the action which
is not associated with the error rule.  If neither or both
actions are associated with an error rule, then try to
use precedence to resolve the conflict.

If either action is a SHIFT, then it must be apx.  This
function won't work if apx->type==REDUCE and apy->type==SHIFT.
@param PHP_ParserGenerator_Action
@param PHP_ParserGenerator_Action
@param PHP_ParserGenerator_Symbol|null The error symbol (if defined.  NULL otherwise)
Resolve a conflict between the two given actions . If the conflict can t be resolve return non - zero .