Lines Matching defs:expectedTokens

61      * Try to read any of the $expectedTokens from the token list and return
71 * The $expectedTokens parameter may be an array of tokens or a scalar
79 * @param array|integer|string $expectedTokens
83 protected function read($expectedTokens): Scanner\Token {
85 if (!is_array($expectedTokens)) {
86 return $this->read(array($expectedTokens));
89 foreach($expectedTokens as $token) {
96 throw $this->handleMismatch($expectedTokens);
100 * Try to match any of the $expectedTokens against the given token stream
110 * The $expectedTokens parameter may be an array of tokens or a scalar
122 * @param array|integer|string $expectedTokens
129 $expectedTokens, int $position = 0, bool $allowEndOfTokens = FALSE
132 if (!is_array($expectedTokens)) {
133 return $this->lookahead(array($expectedTokens), $position, $allowEndOfTokens);
142 foreach($expectedTokens as $token) {
149 throw $this->handleMismatch($expectedTokens, $position);
164 * Try to read any of the $expectedTokens from the token stream and remove them
171 * The $expectedTokens parameter may be an array of tokens or a scalar
179 * @param array|integer|string $expectedTokens
183 protected function ignore($expectedTokens): bool {
185 if (!is_array($expectedTokens)) {
186 return $this->ignore(array($expectedTokens));
194 foreach ($expectedTokens as $token) {
257 * @param array() $expectedTokens
261 private function handleMismatch($expectedTokens, $position = 0) {
264 return new Exception\UnexpectedEndOfFileException($expectedTokens);
268 return new Exception\TokenMismatchException($this->_tokens[$position], $expectedTokens);