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:----TK19/GYX7aQJLnhA5aTQNgB458A03EjVwdCfkiJXigvd4ab/Q9XhlmzbpfIE9Xj08r4duI6b9QWAu45Y1KitezUxx6dYLyL4sZb5JJv4B1hkkJQPoKWETUHCF6BCf4FNKLz96XM7RW690LtbZWDEY+Lsoom8vwCeoosiMsHRoykrkJyGmpDrIuRF5s9ez8kgkkCFIbsh+oZqFIX5khoL61Bws0tRBvOO8Xl3lpW/TRReN0HuIkBDLy4CKT82CkGIA/Z5F9694tUtjo2Krv/7lnb0haygmA1vqmOwDr4sv5ldxcz7FuD1xxT4dbV37H5Dmh09LMDwL3E+Lb3p8Qk7cp86fMgf82xkLoCNwglPSREWCxhgzy2a7DT02KrzWxFDLId6kXZKCJJCG48ro6JUap2oWf+BK69SOuNk3QBupcD/2tp5G+skzowuEL/PQ1nVtt8+E/4uIU/2nUVS3jU8R0wxAu4TClUlSva0IGEAeuGLiL81w6JnWlBdJ/eEWlwn7aI0at63g4uDcwc0AlJNs7QZRPezt6/4C3WPExxgAVt+yfTXEw0CEXm3+SQutLcrfL7jseBA2FNPJY119uRCVrD+EU7shVw73qmJEQxFiLy3h91qG9NAXCdpTHXpKTN/y3wo5q2jrFaikn07It24ewwYL9j78Ij61oBr2/aFoAw=----ATTACHMENT:----MzgxMTk4MTA3MjI2ODc4NiA1Mjk1MzA0NTE0OTAwMzk2IDU0MDgxNzg0NTYzNDI1MjA=