src/Language/Parser.php
private function parseDocument()
    {
        $start = $this->lexer->token;
        $this->expect(Token::SOF);

        $definitions = [];
        do {
            $definitions[] = $this->parseDefinition();
        } while (! $this->skip(Token::EOF));

        return new DocumentNode([
            'definitions' => new NodeList($definitions),
            'loc'         => $this->loc($start),
        ]);
    }
private function parseDocument()
    {
        $start = $this->lexer->token;
        $this->expect(Token::SOF);

        $definitions = [];
        do {
            $definitions[] = $this->parseDefinition();
        } while (! $this->skip(Token::EOF));

        return new DocumentNode([
            'definitions' => new NodeList($definitions),
            'loc'         => $this->loc($start),
        ]);
    }
Implements the parsing rules in the Document section.

@return DocumentNode

@throws SyntaxError