private function eat(...$kinds) {
        $token = $this->token;
        if (\is_array($kinds[0])) {
            $kinds = $kinds[0];
        }
        foreach ($kinds as $kind) {
            if ($token->kind === $kind) {
                $this->token = $this->lexer->scanNextToken();
                return $token;
            }
        }
        // TODO include optional grouping for token kinds
        return new MissingToken($kinds[0], $token->fullStart);
    }
private function eat(...$kinds) {
        $token = $this->token;
        if (\is_array($kinds[0])) {
            $kinds = $kinds[0];
        }
        foreach ($kinds as $kind) {
            if ($token->kind === $kind) {
                $this->token = $this->lexer->scanNextToken();
                return $token;
            }
        }
        // TODO include optional grouping for token kinds
        return new MissingToken($kinds[0], $token->fullStart);
    }
private function eat ( ... $ kinds ) { $ token = $ this -> token ; if ( \ is_array ( $ kinds [ 0 ] ) ) { $ kinds = $ kinds [ 0 ] ; } foreach ( $ kinds as $ kind ) { if ( $ token -> kind === $ kind ) { $ this -> token = $ this -> lexer -> scanNextToken ( ) ; return $ token ; } } // TODO include optional grouping for token kinds return new MissingToken ( $ kinds [ 0 ] , $ token -> fullStart ) ; }
Retrieve the current token, and check that it's of the expected TokenKind.
If so, advance and return the token. Otherwise return a MissingToken for
the expected token.
@param int|int[] ...$kinds
@return Token
Retrieve the current token and check that it s of the expected TokenKind . If so advance and return the token . Otherwise return a MissingToken for the expected token .