protected function expHelper($lhs, $minP)
    {
        $operators = static::$operatorPattern;

        $ss = $this->seek();
        $whiteBefore = isset($this->buffer[$this->count - 1]) &&
            ctype_space($this->buffer[$this->count - 1]);

        while ($this->match($operators, $m, false) && static::$precedence[$m[1]] >= $minP) {
            $whiteAfter = isset($this->buffer[$this->count]) &&
                ctype_space($this->buffer[$this->count]);
            $varAfter = isset($this->buffer[$this->count]) &&
                $this->buffer[$this->count] === '$';

            $this->whitespace();

            $op = $m[1];

            // don't turn negative numbers into expressions
            if ($op === '-' && $whiteBefore && ! $whiteAfter && ! $varAfter) {
                break;
            }

            if (! $this->value($rhs)) {
                break;
            }

            // peek and see if rhs belongs to next operator
            if ($this->peek($operators, $next) && static::$precedence[$next[1]] > static::$precedence[$op]) {
                $rhs = $this->expHelper($rhs, static::$precedence[$next[1]]);
            }

            $lhs = [Type::T_EXPRESSION, $op, $lhs, $rhs, $this->inParens, $whiteBefore, $whiteAfter];
            $ss = $this->seek();
            $whiteBefore = isset($this->buffer[$this->count - 1]) &&
                ctype_space($this->buffer[$this->count - 1]);
        }

        $this->seek($ss);

        return $lhs;
    }
protected function expHelper($lhs, $minP)
    {
        $operators = static::$operatorPattern;

        $ss = $this->seek();
        $whiteBefore = isset($this->buffer[$this->count - 1]) &&
            ctype_space($this->buffer[$this->count - 1]);

        while ($this->match($operators, $m, false) && static::$precedence[$m[1]] >= $minP) {
            $whiteAfter = isset($this->buffer[$this->count]) &&
                ctype_space($this->buffer[$this->count]);
            $varAfter = isset($this->buffer[$this->count]) &&
                $this->buffer[$this->count] === '$';

            $this->whitespace();

            $op = $m[1];

            // don't turn negative numbers into expressions
            if ($op === '-' && $whiteBefore && ! $whiteAfter && ! $varAfter) {
                break;
            }

            if (! $this->value($rhs)) {
                break;
            }

            // peek and see if rhs belongs to next operator
            if ($this->peek($operators, $next) && static::$precedence[$next[1]] > static::$precedence[$op]) {
                $rhs = $this->expHelper($rhs, static::$precedence[$next[1]]);
            }

            $lhs = [Type::T_EXPRESSION, $op, $lhs, $rhs, $this->inParens, $whiteBefore, $whiteAfter];
            $ss = $this->seek();
            $whiteBefore = isset($this->buffer[$this->count - 1]) &&
                ctype_space($this->buffer[$this->count - 1]);
        }

        $this->seek($ss);

        return $lhs;
    }
protected function expHelper ( $ lhs , $ minP ) { $ operators = static :: $ operatorPattern ; $ ss = $ this -> seek ( ) ; $ whiteBefore = isset ( $ this -> buffer [ $ this -> count - 1 ] ) && ctype_space ( $ this -> buffer [ $ this -> count - 1 ] ) ; while ( $ this -> match ( $ operators , $ m , false ) && static :: $ precedence [ $ m [ 1 ] ] >= $ minP ) { $ whiteAfter = isset ( $ this -> buffer [ $ this -> count ] ) && ctype_space ( $ this -> buffer [ $ this -> count ] ) ; $ varAfter = isset ( $ this -> buffer [ $ this -> count ] ) && $ this -> buffer [ $ this -> count ] === '$' ; $ this -> whitespace ( ) ; $ op = $ m [ 1 ] ; // don't turn negative numbers into expressions if ( $ op === '-' && $ whiteBefore && ! $ whiteAfter && ! $ varAfter ) { break ; } if ( ! $ this -> value ( $ rhs ) ) { break ; } // peek and see if rhs belongs to next operator if ( $ this -> peek ( $ operators , $ next ) && static :: $ precedence [ $ next [ 1 ] ] > static :: $ precedence [ $ op ] ) { $ rhs = $ this -> expHelper ( $ rhs , static :: $ precedence [ $ next [ 1 ] ] ) ; } $ lhs = [ Type :: T_EXPRESSION , $ op , $ lhs , $ rhs , $ this -> inParens , $ whiteBefore , $ whiteAfter ] ; $ ss = $ this -> seek ( ) ; $ whiteBefore = isset ( $ this -> buffer [ $ this -> count - 1 ] ) && ctype_space ( $ this -> buffer [ $ this -> count - 1 ] ) ; } $ this -> seek ( $ ss ) ; return $ lhs ; }
Parse left-hand side of subexpression

@param array   $lhs
@param integer $minP

@return array
Parse left - hand side of subexpression