protected function buildObjectTree($splitTemplate, $context)
    {
        $regularExpression_openingViewHelperTag = self::$SCAN_PATTERN_TEMPLATE_VIEWHELPERTAG;
        $regularExpression_closingViewHelperTag = self::$SCAN_PATTERN_TEMPLATE_CLOSINGVIEWHELPERTAG;

        /** @var $state ParsingState */
        $state = $this->objectManager->get(\TYPO3\Fluid\Core\Parser\ParsingState::class);
        /** @var $rootNode RootNode */
        $rootNode = $this->objectManager->get(\TYPO3\Fluid\Core\Parser\SyntaxTree\RootNode::class);
        $state->setRootNode($rootNode);
        $state->pushNodeToStack($rootNode);

        foreach ($splitTemplate as $templateElement) {
            $matchedVariables = array();
            if (preg_match(self::$SCAN_PATTERN_CDATA, $templateElement, $matchedVariables) > 0) {
                $this->textHandler($state, $matchedVariables[1]);
                continue;
            } elseif (preg_match($regularExpression_openingViewHelperTag, $templateElement, $matchedVariables) > 0) {
                $viewHelperWasOpened = $this->openingViewHelperTagHandler($state, $matchedVariables['NamespaceIdentifier'], $matchedVariables['MethodIdentifier'], $matchedVariables['Attributes'], ($matchedVariables['Selfclosing'] === '' ? false : true));
                if ($viewHelperWasOpened === true) {
                    continue;
                }
            } elseif (preg_match($regularExpression_closingViewHelperTag, $templateElement, $matchedVariables) > 0) {
                $viewHelperWasClosed = $this->closingViewHelperTagHandler($state, $matchedVariables['NamespaceIdentifier'], $matchedVariables['MethodIdentifier']);
                if ($viewHelperWasClosed === true) {
                    continue;
                }
            }

            $this->textAndShorthandSyntaxHandler($state, $templateElement, $context);
        }

        if ($state->countNodeStack() !== 1) {
            throw new Exception('Not all tags were closed!', 1238169398);
        }
        return $state;
    }