<commit_before><?php
namespace Plitz\Bindings\Blitz;

use Plitz\Lexer\Lexer;
use Plitz\Parser\Expressions;
use Plitz\Parser\Parser;

trait ResolveIncludeTrait
{
    protected $disableFunctionBoilerplate = false;

    public function startOfStream()
    {
        if (!$this->disableFunctionBoilerplate) {
            parent::startOfStream();
        }
    }

    public function endOfStream()
    {
        if (!$this->disableFunctionBoilerplate) {
            parent::endOfStream();
        }
    }

    protected function resolveIncludeCall(Expressions\MethodCall $expression)
    {
        assert($expression->getArguments()[0] instanceof Expressions\Scalar);
        $filename = $this->basePath . DIRECTORY_SEPARATOR . $expression->getArguments()[0]->getValue();
        $filehandle = fopen($filename, "r");
        assert(is_resource($filehandle));

        // make sure we don't write a new function header + footer
        $oldDisableFunctionBoilerPlate = $this->disableFunctionBoilerplate;
        $this->disableFunctionBoilerplate = true;

        $lexer = new Lexer($filehandle, $filename);
        $parser = new Parser($lexer->lex(), $this);
        $parser->parse();
<commit_msg>Print start and end of template includes<commit_after><?php
namespace Plitz\Bindings\Blitz;

use Plitz\Lexer\Lexer;
use Plitz\Parser\Expressions;
use Plitz\Parser\Parser;

trait ResolveIncludeTrait
{
    protected $disableFunctionBoilerplate = false;

    public function startOfStream()
    {
        if (!$this->disableFunctionBoilerplate) {
            parent::startOfStream();
        }
    }

    public function endOfStream()
    {
        if (!$this->disableFunctionBoilerplate) {
            parent::endOfStream();
        }
    }

    protected function resolveIncludeCall(Expressions\MethodCall $expression)
    {
        assert($expression->getArguments()[0] instanceof Expressions\Scalar);
        $filename = $this->basePath . DIRECTORY_SEPARATOR . $expression->getArguments()[0]->getValue();
        $filehandle = fopen($filename, "r");
        assert(is_resource($filehandle));

        // make sure we don't write a new function header + footer
        $oldDisableFunctionBoilerPlate = $this->disableFunctionBoilerplate;
        $this->disableFunctionBoilerplate = true;

        $lexer = new Lexer($filehandle, $filename);
        $parser = new Parser($lexer->lex(), $this);

        $this->comment('@@START OF TEMPLATE ' . $filename . ' @@');
        $parser->parse();
        $this->comment('@@END OF TEMPLATE ' . $filename . ' @@');

{'fraction_non_alphanumeric': 0.1281446540880503, 'fraction_numerical': 0.0015723270440251573, 'mean_word_length': 3.078525641025641, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6602415', 'n_tokens_mistral': 738, 'n_tokens_neox': 710, 'n_words': 142}