private function parseDefinition()
    {
        if ($this->peek(Token::NAME)) {
            switch ($this->lexer->token->value) {
                case 'query':
                case 'mutation':
                case 'subscription':
                case 'fragment':
                    return $this->parseExecutableDefinition();

                // Note: The schema definition language is an experimental addition.
                case 'schema':
                case 'scalar':
                case 'type':
                case 'interface':
                case 'union':
                case 'enum':
                case 'input':
                case 'extend':
                case 'directive':
                    // Note: The schema definition language is an experimental addition.
                    return $this->parseTypeSystemDefinition();
            }
        } elseif ($this->peek(Token::BRACE_L)) {
            return $this->parseExecutableDefinition();
        } elseif ($this->peekDescription()) {
            // Note: The schema definition language is an experimental addition.
            return $this->parseTypeSystemDefinition();
        }

        throw $this->unexpected();
    }
private function parseDefinition()
    {
        if ($this->peek(Token::NAME)) {
            switch ($this->lexer->token->value) {
                case 'query':
                case 'mutation':
                case 'subscription':
                case 'fragment':
                    return $this->parseExecutableDefinition();

                
                case 'schema':
                case 'scalar':
                case 'type':
                case 'interface':
                case 'union':
                case 'enum':
                case 'input':
                case 'extend':
                case 'directive':
                    
                    return $this->parseTypeSystemDefinition();
            }
        } elseif ($this->peek(Token::BRACE_L)) {
            return $this->parseExecutableDefinition();
        } elseif ($this->peekDescription()) {
            
            return $this->parseTypeSystemDefinition();
        }

        throw $this->unexpected();
    }
private function parseDefinition ( ) { if ( $ this -> peek ( Token :: NAME ) ) { switch ( $ this -> lexer -> token -> value ) { case 'query' : case 'mutation' : case 'subscription' : case 'fragment' : return $ this -> parseExecutableDefinition ( ) ; // Note: The schema definition language is an experimental addition. case 'schema' : case 'scalar' : case 'type' : case 'interface' : case 'union' : case 'enum' : case 'input' : case 'extend' : case 'directive' : // Note: The schema definition language is an experimental addition. return $ this -> parseTypeSystemDefinition ( ) ; } } elseif ( $ this -> peek ( Token :: BRACE_L ) ) { return $ this -> parseExecutableDefinition ( ) ; } elseif ( $ this -> peekDescription ( ) ) { // Note: The schema definition language is an experimental addition. return $ this -> parseTypeSystemDefinition ( ) ; } throw $ this -> unexpected ( ) ; }
@return ExecutableDefinitionNode|TypeSystemDefinitionNode

@throws SyntaxError
@return ExecutableDefinitionNode|TypeSystemDefinitionNode