lib/ParserGenerator/PHP/ParserGenerator/Data.php
function compute_action($ap)
    {
        switch ($ap->type) {
            case PHP_ParserGenerator_Action::SHIFT:
                $act = $ap->x->statenum;
                break;
            case PHP_ParserGenerator_Action::REDUCE:
                $act = $ap->x->index + $this->nstate;
                break;
            case PHP_ParserGenerator_Action::ERROR:
                $act = $this->nstate + $this->nrule;
                break;
            case PHP_ParserGenerator_Action::ACCEPT:
                $act = $this->nstate + $this->nrule + 1;
                break;
            default:
                $act = -1;
                break;
        }
        return $act;
    }
function compute_action($ap)
    {
        switch ($ap->type) {
            case PHP_ParserGenerator_Action::SHIFT:
                $act = $ap->x->statenum;
                break;
            case PHP_ParserGenerator_Action::REDUCE:
                $act = $ap->x->index + $this->nstate;
                break;
            case PHP_ParserGenerator_Action::ERROR:
                $act = $this->nstate + $this->nrule;
                break;
            case PHP_ParserGenerator_Action::ACCEPT:
                $act = $this->nstate + $this->nrule + 1;
                break;
            default:
                $act = -1;
                break;
        }
        return $act;
    }
function compute_action ( $ ap ) { switch ( $ ap -> type ) { case PHP_ParserGenerator_Action :: SHIFT : $ act = $ ap -> x -> statenum ; break ; case PHP_ParserGenerator_Action :: REDUCE : $ act = $ ap -> x -> index + $ this -> nstate ; break ; case PHP_ParserGenerator_Action :: ERROR : $ act = $ this -> nstate + $ this -> nrule ; break ; case PHP_ParserGenerator_Action :: ACCEPT : $ act = $ this -> nstate + $ this -> nrule + 1 ; break ; default : $ act = - 1 ; break ; } return $ act ; }
Given an action, compute the integer value for that action
which is to be put in the action table of the generated machine.
Return negative if no action should be generated.
@param PHP_ParserGenerator_Action
Given an action compute the integer value for that action which is to be put in the action table of the generated machine . Return negative if no action should be generated .