protected function lexBlockString(int $line, int $column, Token $prev): Token
    {
        $start          = $this->position;
        $this->position = $start + 3; // skip the triple-quote
        $chunkStart     = $this->position;
        $rawValue       = '';

        while ($this->position < $this->bodyLength) {
            $code = $this->readCharCode($this->position);

            // Closing Triple-Quote (""")
            if ($this->isTripleQuote($code)) {
                $rawValue .= sliceString($this->body, $chunkStart, $this->position);
                return new Token(
                    TokenKindEnum::BLOCK_STRING,
                    $start,
                    $this->position + 3,
                    $line,
                    $column,
                    $prev,
                    blockStringValue($rawValue)
                );
            }

            if (isSourceCharacter($code) && !isLineTerminator($code)) {
                throw $this->createSyntaxErrorException(
                    \sprintf('Invalid character within String: %s.', printCharCode($code))
                );
            }

            if ($this->isEscapedTripleQuote($code)) {
                $rawValue       .= sliceString($this->body, $chunkStart, $this->position) . '"""';
                $this->position += 4;
                $chunkStart     = $this->position;
            } else {
                ++$this->position;
            }
        }

        throw $this->createSyntaxErrorException('Unterminated string.');
    }
protected function lexBlockString(int $line, int $column, Token $prev): Token
    {
        $start          = $this->position;
        $this->position = $start + 3; // skip the triple-quote
        $chunkStart     = $this->position;
        $rawValue       = '';

        while ($this->position < $this->bodyLength) {
            $code = $this->readCharCode($this->position);

            // Closing Triple-Quote (""")
            if ($this->isTripleQuote($code)) {
                $rawValue .= sliceString($this->body, $chunkStart, $this->position);
                return new Token(
                    TokenKindEnum::BLOCK_STRING,
                    $start,
                    $this->position + 3,
                    $line,
                    $column,
                    $prev,
                    blockStringValue($rawValue)
                );
            }

            if (isSourceCharacter($code) && !isLineTerminator($code)) {
                throw $this->createSyntaxErrorException(
                    \sprintf('Invalid character within String: %s.', printCharCode($code))
                );
            }

            if ($this->isEscapedTripleQuote($code)) {
                $rawValue       .= sliceString($this->body, $chunkStart, $this->position) . '"""';
                $this->position += 4;
                $chunkStart     = $this->position;
            } else {
                ++$this->position;
            }
        }

        throw $this->createSyntaxErrorException('Unterminated string.');
    }
protected function lexBlockString ( int $ line , int $ column , Token $ prev ) : Token { $ start = $ this -> position ; $ this -> position = $ start + 3 ; // skip the triple-quote $ chunkStart = $ this -> position ; $ rawValue = '' ; while ( $ this -> position < $ this -> bodyLength ) { $ code = $ this -> readCharCode ( $ this -> position ) ; // Closing Triple-Quote (""") if ( $ this -> isTripleQuote ( $ code ) ) { $ rawValue .= sliceString ( $ this -> body , $ chunkStart , $ this -> position ) ; return new Token ( TokenKindEnum :: BLOCK_STRING , $ start , $ this -> position + 3 , $ line , $ column , $ prev , blockStringValue ( $ rawValue ) ) ; } if ( isSourceCharacter ( $ code ) && ! isLineTerminator ( $ code ) ) { throw $ this -> createSyntaxErrorException ( \ sprintf ( 'Invalid character within String: %s.' , printCharCode ( $ code ) ) ) ; } if ( $ this -> isEscapedTripleQuote ( $ code ) ) { $ rawValue .= sliceString ( $ this -> body , $ chunkStart , $ this -> position ) . '"""' ; $ this -> position += 4 ; $ chunkStart = $ this -> position ; } else { ++ $ this -> position ; } } throw $ this -> createSyntaxErrorException ( 'Unterminated string.' ) ; }
Reads a block string token from the source file.

@param int   $line
@param int   $column
@param Token $prev
@return Token
@throws SyntaxErrorException
Reads a block string token from the source file .