framework/db/SqlTokenizer.php
private function tokenizeOperator(&$length)
    {
        if (!$this->isOperator($length, $content)) {
            return false;
        }

        $this->addTokenFromBuffer();
        switch ($this->substring($length)) {
            case '(':
                $this->_currentToken[] = new SqlToken([
                    'type' => SqlToken::TYPE_OPERATOR,
                    'content' => is_string($content) ? $content : $this->substring($length),
                    'startOffset' => $this->offset,
                    'endOffset' => $this->offset + $length,
                ]);
                $this->_currentToken[] = new SqlToken(['type' => SqlToken::TYPE_PARENTHESIS]);
                $this->_tokenStack->push($this->_currentToken[-1]);
                $this->_currentToken = $this->_tokenStack->top();
                break;
            case ')':
                $this->_tokenStack->pop();
                $this->_currentToken = $this->_tokenStack->top();
                $this->_currentToken[] = new SqlToken([
                    'type' => SqlToken::TYPE_OPERATOR,
                    'content' => ')',
                    'startOffset' => $this->offset,
                    'endOffset' => $this->offset + $length,
                ]);
                break;
            case ';':
                if (!$this->_currentToken->getHasChildren()) {
                    break;
                }

                $this->_currentToken[] = new SqlToken([
                    'type' => SqlToken::TYPE_OPERATOR,
                    'content' => is_string($content) ? $content : $this->substring($length),
                    'startOffset' => $this->offset,
                    'endOffset' => $this->offset + $length,
                ]);
                $this->_tokenStack->pop();
                $this->_currentToken = $this->_tokenStack->top();
                $this->_currentToken[] = new SqlToken(['type' => SqlToken::TYPE_STATEMENT]);
                $this->_tokenStack->push($this->_currentToken[-1]);
                $this->_currentToken = $this->_tokenStack->top();
                break;
            default:
                $this->_currentToken[] = new SqlToken([
                    'type' => SqlToken::TYPE_OPERATOR,
                    'content' => is_string($content) ? $content : $this->substring($length),
                    'startOffset' => $this->offset,
                    'endOffset' => $this->offset + $length,
                ]);
                break;
        }

        return true;
    }
private function tokenizeOperator(&$length)
    {
        if (!$this->isOperator($length, $content)) {
            return false;
        }

        $this->addTokenFromBuffer();
        switch ($this->substring($length)) {
            case '(':
                $this->_currentToken[] = new SqlToken([
                    'type' => SqlToken::TYPE_OPERATOR,
                    'content' => is_string($content) ? $content : $this->substring($length),
                    'startOffset' => $this->offset,
                    'endOffset' => $this->offset + $length,
                ]);
                $this->_currentToken[] = new SqlToken(['type' => SqlToken::TYPE_PARENTHESIS]);
                $this->_tokenStack->push($this->_currentToken[-1]);
                $this->_currentToken = $this->_tokenStack->top();
                break;
            case ')':
                $this->_tokenStack->pop();
                $this->_currentToken = $this->_tokenStack->top();
                $this->_currentToken[] = new SqlToken([
                    'type' => SqlToken::TYPE_OPERATOR,
                    'content' => ')',
                    'startOffset' => $this->offset,
                    'endOffset' => $this->offset + $length,
                ]);
                break;
            case ';':
                if (!$this->_currentToken->getHasChildren()) {
                    break;
                }

                $this->_currentToken[] = new SqlToken([
                    'type' => SqlToken::TYPE_OPERATOR,
                    'content' => is_string($content) ? $content : $this->substring($length),
                    'startOffset' => $this->offset,
                    'endOffset' => $this->offset + $length,
                ]);
                $this->_tokenStack->pop();
                $this->_currentToken = $this->_tokenStack->top();
                $this->_currentToken[] = new SqlToken(['type' => SqlToken::TYPE_STATEMENT]);
                $this->_tokenStack->push($this->_currentToken[-1]);
                $this->_currentToken = $this->_tokenStack->top();
                break;
            default:
                $this->_currentToken[] = new SqlToken([
                    'type' => SqlToken::TYPE_OPERATOR,
                    'content' => is_string($content) ? $content : $this->substring($length),
                    'startOffset' => $this->offset,
                    'endOffset' => $this->offset + $length,
                ]);
                break;
        }

        return true;
    }
Determines whether there is an operator at the current offset and adds it to the token children.
@param int $length
@return bool