lib/ParserGenerator/PHP/ParserGenerator/Data.php
function ResortStates()
    {
        for ($i = 0; $i < $this->nstate; $i++) {
            $stp = $this->sorted[$i]->data;
            $stp->nTknAct = $stp->nNtAct = 0;
            $stp->iDflt = $this->nstate + $this->nrule;
            $stp->iTknOfst = PHP_ParserGenerator_Data::NO_OFFSET;
            $stp->iNtOfst = PHP_ParserGenerator_Data::NO_OFFSET;
            for ($ap = $stp->ap; $ap; $ap = $ap->next) {
                if ($this->compute_action($ap) >= 0) {
                    if ($ap->sp->index < $this->nterminal) {
                        $stp->nTknAct++;
                    } elseif ($ap->sp->index < $this->nsymbol) {
                        $stp->nNtAct++;
                    } else {
                        $stp->iDflt = $this->compute_action($ap);
                    }
                }
            }
            $this->sorted[$i] = $stp;
        }
        $save = $this->sorted[0];
        unset($this->sorted[0]);
        usort($this->sorted, array('PHP_ParserGenerator_State', 'stateResortCompare'));
        array_unshift($this->sorted, $save);
        for($i = 0; $i < $this->nstate; $i++) {
            $this->sorted[$i]->statenum = $i;
        }
    }
function ResortStates()
    {
        for ($i = 0; $i < $this->nstate; $i++) {
            $stp = $this->sorted[$i]->data;
            $stp->nTknAct = $stp->nNtAct = 0;
            $stp->iDflt = $this->nstate + $this->nrule;
            $stp->iTknOfst = PHP_ParserGenerator_Data::NO_OFFSET;
            $stp->iNtOfst = PHP_ParserGenerator_Data::NO_OFFSET;
            for ($ap = $stp->ap; $ap; $ap = $ap->next) {
                if ($this->compute_action($ap) >= 0) {
                    if ($ap->sp->index < $this->nterminal) {
                        $stp->nTknAct++;
                    } elseif ($ap->sp->index < $this->nsymbol) {
                        $stp->nNtAct++;
                    } else {
                        $stp->iDflt = $this->compute_action($ap);
                    }
                }
            }
            $this->sorted[$i] = $stp;
        }
        $save = $this->sorted[0];
        unset($this->sorted[0]);
        usort($this->sorted, array('PHP_ParserGenerator_State', 'stateResortCompare'));
        array_unshift($this->sorted, $save);
        for($i = 0; $i < $this->nstate; $i++) {
            $this->sorted[$i]->statenum = $i;
        }
    }
function ResortStates ( ) { for ( $ i = 0 ; $ i < $ this -> nstate ; $ i ++ ) { $ stp = $ this -> sorted [ $ i ] -> data ; $ stp -> nTknAct = $ stp -> nNtAct = 0 ; $ stp -> iDflt = $ this -> nstate + $ this -> nrule ; $ stp -> iTknOfst = PHP_ParserGenerator_Data :: NO_OFFSET ; $ stp -> iNtOfst = PHP_ParserGenerator_Data :: NO_OFFSET ; for ( $ ap = $ stp -> ap ; $ ap ; $ ap = $ ap -> next ) { if ( $ this -> compute_action ( $ ap ) >= 0 ) { if ( $ ap -> sp -> index < $ this -> nterminal ) { $ stp -> nTknAct ++ ; } elseif ( $ ap -> sp -> index < $ this -> nsymbol ) { $ stp -> nNtAct ++ ; } else { $ stp -> iDflt = $ this -> compute_action ( $ ap ) ; } } } $ this -> sorted [ $ i ] = $ stp ; } $ save = $ this -> sorted [ 0 ] ; unset ( $ this -> sorted [ 0 ] ) ; usort ( $ this -> sorted , array ( 'PHP_ParserGenerator_State' , 'stateResortCompare' ) ) ; array_unshift ( $ this -> sorted , $ save ) ; for ( $ i = 0 ; $ i < $ this -> nstate ; $ i ++ ) { $ this -> sorted [ $ i ] -> statenum = $ i ; } }
Renumber and resort states so that states with fewer choices
occur at the end.  Except, keep state 0 as the first state.
Renumber and resort states so that states with fewer choices occur at the end . Except keep state 0 as the first state .