protected function getNextExpectedBoolValueFromStream(
        \Twig_TokenStream $stream,
        $optionName
    ) {
        $stream->next();
        $stream->expect(\Twig_Token::PUNCTUATION_TYPE);
        $expr = $this->parser->getExpressionParser()->parseExpression();

        if (!($expr instanceof \Twig_Node_Expression_Constant) || !is_bool($expr->getAttribute('value'))) {
            throw new SyntaxException(
                sprintf(
                    'The %s option must be boolean true or false (i.e. %s:false).',
                    $optionName,
                    $optionName
                ),
                $stream->getCurrent()->getLine(),
                $this->getStreamFilename($stream)
            );
        }

        return $expr->getAttribute('value');
    }