src/Twig/PerLineTokenParser.php
public function parse(Token $token): PerLineNode
    {
        $stream = $this->parser->getStream();

        // perline is a very simple tag, not having anything more than its name
        // between the braces, so we expect the closing brace immediately.
        $stream->expect(Token::BLOCK_END_TYPE);

        // sub-parse everything until we reach the endperline tag.
        $body = $this->parser->subparse(function (Token $token) {
            return $token->test('endperline');
        }, true);

        // make sure our closing tag is also closed neatly and advance the
        // stream to allow continuation of parsing.
        $stream->expect(Token::BLOCK_END_TYPE);

        // turn out body in a nicely formatted PerLineNode
        return $this->parseBody($body);
    }
public function parse(Token $token): PerLineNode
    {
        $stream = $this->parser->getStream();

        // perline is a very simple tag, not having anything more than its name
        // between the braces, so we expect the closing brace immediately.
        $stream->expect(Token::BLOCK_END_TYPE);

        // sub-parse everything until we reach the endperline tag.
        $body = $this->parser->subparse(function (Token $token) {
            return $token->test('endperline');
        }, true);

        // make sure our closing tag is also closed neatly and advance the
        // stream to allow continuation of parsing.
        $stream->expect(Token::BLOCK_END_TYPE);

        // turn out body in a nicely formatted PerLineNode
        return $this->parseBody($body);
    }
public function parse ( Token $ token ) : PerLineNode { $ stream = $ this -> parser -> getStream ( ) ; // perline is a very simple tag, not having anything more than its name // between the braces, so we expect the closing brace immediately. $ stream -> expect ( Token :: BLOCK_END_TYPE ) ; // sub-parse everything until we reach the endperline tag. $ body = $ this -> parser -> subparse ( function ( Token $ token ) { return $ token -> test ( 'endperline' ) ; } , true ) ; // make sure our closing tag is also closed neatly and advance the // stream to allow continuation of parsing. $ stream -> expect ( Token :: BLOCK_END_TYPE ) ; // turn out body in a nicely formatted PerLineNode return $ this -> parseBody ( $ body ) ; }
Parses perline token and returns PerLineNode.

Parse everything within the perline block and then restructure the
contents into some thing nice to build a PerLineNode out of.

@param Token $token

@throws SyntaxError

@return PerLineNode
Parses perline token and returns PerLineNode .