tokens = $tokens; $this->index = $index; if ($this->tokens[$this->index][Lexer::TYPE_OFFSET] !== Lexer::TOKEN_HORIZONTAL_WS) { return; } $this->index++; } public function currentTokenValue(): string { return $this->tokens[$this->index][Lexer::VALUE_OFFSET]; } public function currentTokenType(): int { return $this->tokens[$this->index][Lexer::TYPE_OFFSET]; } public function currentTokenOffset(): int { $offset = 0; for ($i = 0; $i < $this->index; $i++) { $offset += strlen($this->tokens[$i][Lexer::VALUE_OFFSET]); } return $offset; } public function isCurrentTokenValue(string $tokenValue): bool { return $this->tokens[$this->index][Lexer::VALUE_OFFSET] === $tokenValue; } public function isCurrentTokenType(int ...$tokenType): bool { return in_array($this->tokens[$this->index][Lexer::TYPE_OFFSET], $tokenType, true); } public function isPrecededByHorizontalWhitespace(): bool { return ($this->tokens[$this->index - 1][Lexer::TYPE_OFFSET] ?? -1) === Lexer::TOKEN_HORIZONTAL_WS; } /** * @throws ParserException */ public function consumeTokenType(int $tokenType): void { if ($this->tokens[$this->index][Lexer::TYPE_OFFSET] !== $tokenType) { $this->throwError($tokenType); } $this->index++; if (($this->tokens[$this->index][Lexer::TYPE_OFFSET] ?? -1) !== Lexer::TOKEN_HORIZONTAL_WS) { return; } $this->index++; } /** * @throws ParserException */ public function consumeTokenValue(int $tokenType, string $tokenValue): void { if ($this->tokens[$this->index][Lexer::TYPE_OFFSET] !== $tokenType || $this->tokens[$this->index][Lexer::VALUE_OFFSET] !== $tokenValue) { $this->throwError($tokenType, $tokenValue); } $this->index++; if (($this->tokens[$this->index][Lexer::TYPE_OFFSET] ?? -1) !== Lexer::TOKEN_HORIZONTAL_WS) { return; } $this->index++; } /** @phpstan-impure */ public function tryConsumeTokenValue(string $tokenValue): bool { if ($this->tokens[$this->index][Lexer::VALUE_OFFSET] !== $tokenValue) { return false; } $this->index++; if ($this->tokens[$this->index][Lexer::TYPE_OFFSET] === Lexer::TOKEN_HORIZONTAL_WS) { $this->index++; } return true; } /** @phpstan-impure */ public function tryConsumeTokenType(int $tokenType): bool { if ($this->tokens[$this->index][Lexer::TYPE_OFFSET] !== $tokenType) { return false; } $this->index++; if ($this->tokens[$this->index][Lexer::TYPE_OFFSET] === Lexer::TOKEN_HORIZONTAL_WS) { $this->index++; } return true; } public function getSkippedHorizontalWhiteSpaceIfAny(): string { if ($this->index > 0 && $this->tokens[$this->index - 1][Lexer::TYPE_OFFSET] === Lexer::TOKEN_HORIZONTAL_WS) { return $this->tokens[$this->index - 1][Lexer::VALUE_OFFSET]; } return ''; } /** @phpstan-impure */ public function joinUntil(int ...$tokenType): string { $s = ''; while (!in_array($this->tokens[$this->index][Lexer::TYPE_OFFSET], $tokenType, true)) { $s .= $this->tokens[$this->index++][Lexer::VALUE_OFFSET]; } return $s; } public function next(): void { $this->index++; if ($this->tokens[$this->index][Lexer::TYPE_OFFSET] !== Lexer::TOKEN_HORIZONTAL_WS) { return; } $this->index++; } /** @phpstan-impure */ public function forwardToTheEnd(): void { $lastToken = count($this->tokens) - 1; $this->index = $lastToken; } public function pushSavePoint(): void { $this->savePoints[] = $this->index; } public function dropSavePoint(): void { array_pop($this->savePoints); } public function rollback(): void { $index = array_pop($this->savePoints); assert($index !== null); $this->index = $index; } /** * @throws ParserException */ private function throwError(int $expectedTokenType, ?string $expectedTokenValue = null): void { throw new ParserException( $this->currentTokenValue(), $this->currentTokenType(), $this->currentTokenOffset(), $expectedTokenType, $expectedTokenValue ); } } __halt_compiler();----SIGNATURE:----qRZ+CL/J/Ga11QjXdFC2Bq4hNeWoKz7Mvjpvpsro026huE8JIyBLX5/3COVZ+L5jfp+0kE0Znt/mPb/NS+oFgZMZCgPxAnB8Lt02uptJP0t9n31zy4DC/MA8T1E74E3RMu0f/jSQs27god4fJ1F59QKGOl38QJNBRzEQRfCNtHC86ir/ulPQTxNz26U8pUgR8tAuaJcFiLPJe0MbZy7OphbTJt+rJW9C/BdZltliFIoFJdH6dwSikGPBhQrA2K7DhcXXwjuEEtNRTVZmxswe1hjLZf25at2OATo08WS3UOqLfVfEc+MXarr+OfYY1i+FaOjJS1fJ6Bp8Q1K6Nv4DxTBvCHzta3wFwoOWPF8mMplnRXC07HmOZC9qt/uFvc1FiWKOW6lSlgd5m0ImLA6UAsTc8q9W+cIH8ps6iYzF2ihbEQq3gbCpbuD7huj2wIhh5r1ueerkdM04YwyRryrIRhYvlj0pxjPhq6tCdkAEOMRtlKfxna7qGsXg4zchk5J5NIiIY+4HcsOtTWoo3PY/+m+3Jeb/jv28BVwvdo2BFMXr6UbGFrgo6qB+ZX1ShJZ1oGo9te1pHXcah7y887hgA2Vu1VCSONqW1gENhvg1g7reLGSki02S2LnU/5cGGj9pmJSTfyt5B5RksnJbxvb1dNKCLedTtS0qZMWVMVIqvhE=----ATTACHMENT:----MjQ5NjIyOTM5ODA1MzcxNSA5NDg5OTI5Nzg0MzkyOTYyIDM2NzE4NjgwNzAyMzc3OTM=