Scans PyString from input & returns it if found.

@return null|array
498586
protected function scanPyStringOp()
    {
        if (!$this->allowMultilineArguments) {
            return null;
        }

        if (false === ($pos = mb_strpos($this->line, '"""', 0, 'utf8'))) {
            return null;
        }

        $this->inPyString = !$this->inPyString;
        $token = $this->takeToken('PyStringOp');
        $this->pyStringSwallow = $pos;

        $this->consumeLine();

        return $token;
    }
98298
private function parseByteArray()
    {
        list(, $length) = unpack('N', $this->buffer);

        try {
            return substr($this->buffer, 4, $length);
        } finally {
            $this->buffer = substr($this->buffer, $length + 4);
        }
    }
1036127
protected function getChar()
    {
        // Check to see if we had anything in the look ahead buffer and use that.
        if (isset($this->c)) {
            $char = $this->c;
            unset($this->c);

        // Otherwise we start pulling from the input.
        } else {
            $char = substr($this->input, $this->index, 1);

            // If the next character doesn't exist return false.
            if (isset($char) && $char === false) {
                return false;
            }

            // Otherwise increment the pointer and use this char.
            $this->index++;
        }

        // Normalize all whitespace except for the newline character into a
        // standard space.
        if($char !== "\n" && ord($char) < 32)

            return ' ';

        return $char;
    }
814482
protected function text() {
        $tok = $this->scanner->current();

        // This should never happen...
        if ($tok === false) {
            return false;
        }
        // Null
        if ($tok === "\00") {
            $this->parseError("Received null character.");
        }
        // fprintf(STDOUT, "Writing '%s'", $tok);
        $this->buffer($tok);
        $this->scanner->next();
        return true;
    }
950105
protected function scanComment()
    {
        if ($this->inPyString) {
            return null;
        }

        $line = $this->getTrimmedLine();
        if (0 !== mb_strpos($line, '#', 0, 'utf8')) {
            return null;
        }

        $token = $this->takeToken('Comment', $line);
        $this->consumeLine();

        return $token;
    }
668001
public function getEncoding()
    {
        $content = $this->getHeaderLine('content-type');
        if (!$content) {
            return null;
        }
        preg_match('/charset\s?=\s?[\'"]?([a-z0-9-_]+)[\'"]?/i', $content, $matches);
        if (empty($matches[1])) {
            return null;
        }

        return $matches[1];
    }
163810
public function check()
    {
        if ($this->valueChanged && $this->readonly) {
            return array('read_only', $this->printName());
        }

        if (null === $this->value || '' === $this->value) {
            if ($this->required) {
                return array('value_required', $this->printName());
            }
        } else {
            // Expressions régulière
            if ($this->regex) {
                if (!preg_match('/'.$this->regex.'/mUsi', $this->value)) {
                    return array('bad_format', $this->printName());
                }
            }

            // Longueur minimum et maximum
            if ($this->minlength && strlen($this->value) < $this->minlength) {
                return array('at_least', $this->printName(), $this->minlength);
            }

            if ($this->maxlength && strlen($this->value) > $this->maxlength) {
                return array('not_more', $this->printName(), $this->maxlength);
            }
        }

        // Custom constraints
        foreach ($this->constraints as $constraint) {
            $error = $constraint($this->value);
            if ($error) {
                return $error;
            }
        }
    }
880116
public function getColumnOffset() {
        // strrpos is weird, and the offset needs to be negative for what we
        // want (i.e., the last \n before $this->char). This needs to not have
        // one (to make it point to the next character, the one we want the
        // position of) added to it because strrpos's behaviour includes the
        // final offset byte.
        $lastLine = strrpos($this->data, "\n", $this->char - 1 - strlen($this->data));

        // However, for here we want the length up until the next byte to be
        // processed, so add one to the current byte ($this->char).
        if ($lastLine !== false) {
            $findLengthOf = substr($this->data, $lastLine + 1, $this->char - 1 - $lastLine);
        } else {
            $findLengthOf = substr($this->data, 0, $this->char);
        }

        // Get the length for the string we need.
        if (extension_loaded('iconv')) {
            return iconv_strlen($findLengthOf, 'utf-8');
        } elseif (extension_loaded('mbstring')) {
            return mb_strlen($findLengthOf, 'utf-8');
        } elseif (extension_loaded('xml')) {
            return strlen(utf8_decode($findLengthOf));
        } else {
            $count = count_chars($findLengthOf);
            // 0x80 = 0x7F - 0 + 1 (one added to get inclusive range)
            // 0x33 = 0xF4 - 0x2C + 1 (one added to get inclusive range)
            return array_sum(array_slice($count, 0, 0x80)) +
                   array_sum(array_slice($count, 0xC2, 0x33));
        }
    }
242294
private function nextChar()
    {
        if( ! $this->isEOF())
        {
            $this->linePos ++;

            return $this->input[$this->pos++];
        }
        return null;
    }
843895
public function readLine()
    {
        $line = null;
        while (($ch = $this->readChar()) !== -1) {
            if ($ch === "\n") {
                break;
            }
            $line .= $ch;
        }

        // Warning : Not considering an empty line as an EOF
        if ($line === null && $ch !== -1) {
            return "";
        }

        return $line;
    }
291669
public function getPPN ()
    {
        $ppnField = $this->getFirstMatchingField('003@/00');
        if ($ppnField) {
            $ppnSubfield = $ppnField->getNthSubfield('0', 0);
            if ($ppnSubfield) {
                return $ppnSubfield->getValue();
            }
        }
        return null;
    }
341243
public function asString()
    {
        $tmp = new \SplTempFileObject;

        foreach ($this->data as $row) {
            $tmp->fputcsv($row, $this->delimiter);

            if ($this->lineEnding !== "\n") {
                $tmp->fseek(-1, \SEEK_CUR);
                $tmp->fwrite($this->lineEnding);
            }
        }

        # Find out how much data we have written
        $length = $tmp->ftell();
        if ($length < 1) {
            return "";
        }

        # Reset the internal pointer and return all the data we have written
        $tmp->fseek(0);
        return $tmp->fread($length);
    }
597493
private function parseLongString()
    {
        list(, $length) = \unpack('N', $this->buffer);

        try {
            return mb_orig_substr($this->buffer, 4, $length);
        } finally {
            $this->buffer = mb_orig_substr($this->buffer, $length + 4);
        }
    }
1038162
public function decoded(): ?string
    {
        if (null === $this->user) {
            return null;
        }

        $userInfo = $this->getUser();
        if (null === $this->pass) {
            return $userInfo;
        }

        return $userInfo.':'.$this->getPass();
    }
613652
public function peek() {
		if ($this->_buffer) {
			return reset($this->_buffer);
		}
		if (!$next = $this->_fetch()) {
			return null;
		}
		$this->_buffer[] = $next;
		$first = reset($this->_buffer);
		return end($first);
	}
675018
private function read()
    {
        $s = null;

        for (; !feof($this->sock);) {
            if (($line = fgets($this->sock, 1e3)) == null) {
                continue;
            }

            $s = explode(' ', $line)[0];

            if (preg_match('#^[0-9]+$#', $s)) {
                break;
            }
        }

        return (int) $s;
    }
496820
public function peek()
    {
        if (isset($this->tokens[$this->current + ++$this->peek])) {
            return $this->tokens[$this->current + $this->peek];
        } else {
            return null;
        }
    }