private function parseBody(Node $body): PerLineNode
    {
        $prefix  = '';                       // Text before the (possibly) multi line expression
        $postfix = '';                       // Text before the (possibly) multi line expression
        $lineno  = $body->getTemplateLine(); // The line number where we found the {% perline %} tag

        // If the body does not contain a list of tags, the body itself is the
        // only useful content of the perline tags, so we return only the body
        // tag. This is the case when the perline tags could be removed without
        // an effect in the generated code.
        if (count($body) === 0) {
            return new PerLineNode($body, '', '', $lineno, $this->getTag());
        }

        // Get all the nodes as array, because it will be modified.
        $nodes = $body->getIterator()->getArrayCopy();

        // Check for prefix, the first node should be a text node to have a
        // prefix.
        $first = reset($nodes);
        if ($first instanceof TextNode) {
            $prefix = $first->getAttribute('data');
            array_shift($nodes);
        }

        // Check for postfix, the last node should be a text node to have a
        // postfix.
        $last = end($nodes);
        if ($last instanceof TextNode) {
            $postfix = rtrim($last->getAttribute('data'));
            array_pop($nodes);
        }

        // After we ditched the prefix and postfix there could only be one node
        // left, ready to be returned and used directly. If there are multiple
        // we wrap those in a Twig Node.
        if (count($nodes) === 1) {
            $nodes = current($nodes);
        } else {
            $nodes = new Node($nodes);
        }

        // Return the new structured node.
        return new PerLineNode($nodes, $prefix, $postfix, $lineno, $this->getTag());
    }