public function parseSubscript($out)
    {
        while (true) {
            if ($this->stream->nextIf('.')) {

                if (!$this->stream->test(T_STRING)) {
                    $this->stream->prev();
                    break;
                }

                $val = $this->stream->next()->getValue();
                $out = sprintf("\$this->getAttribute(%s, '%s'", $out, $val);

                if ($this->stream->test('(')) {
                    $out .= sprintf(", array%s, 'method')", $this->parseExpression());
                } else {
                    $out .= ")";
                }

            } elseif ($this->stream->nextIf('[')) {

                $exp = '';

                while (!$this->stream->test(']')) {
                    $exp .= $this->parseExpression();
                }

                $this->stream->expect(']');
                $this->stream->next();

                $out = sprintf("\$this->getAttribute(%s, %s, array(), 'array')", $out, $exp);

            } else {
                break;
            }
        }

        return $out;
    }