protected function getTokenizeCallback(StdClass $reference)
    {
        return $this->bindCallback(function ($node) use ($reference) {
            switch ($node['type']) {
                case HandlebarsTokenizer::TYPE_TEXT:
                    $reference->buffer .= $this->generateText($node, $reference->open);
                    break;
                case HandlebarsTokenizer::TYPE_VARIABLE_ESCAPE:
                    $reference->buffer .= $this->generateEscape($node, $reference->open);
                    break;
                case HandlebarsTokenizer::TYPE_VARIABLE_UNESCAPE:
                    $reference->buffer .= $this->generateVariable($node, $reference->open);
                    break;
                case HandlebarsTokenizer::TYPE_SECTION_OPEN:
                    $reference->buffer .= $this->generateOpen($node, $reference->open);
                    break;
                case HandlebarsTokenizer::TYPE_SECTION_CLOSE:
                    $reference->buffer .= $this->generateClose($node, $reference->open);
                    break;
            }
        });
    }