private function tryCompile($string, \Closure $afterEvents = null, $flags = null) // todo: after events + flags (?)
    {
        foreach ($this->compilers as $compiler => $priority) {
            if (! class_exists($compiler)) {
                throw new NotFoundException("PytoTPL compiler ({$compiler}) couldn't be found!");
            } elseif (! is_subclass_of($compiler, "PytoTPL\Compilers\AbstractCompiler")) {
                throw new InvalidCompilerException("Compiler ({$compiler}) must extend (PytoTPL\Compilers\AbstractCompiler)!");
            }

            $string = $this->run($compiler, $string);
        }

        return $string;
    }