code: func parseDocument(parser *Parser) (*ast.Document, error) {
  	var (
  		nodes []ast.Node
  		node  ast.Node
  		item  parseDefinitionFn
  		err   error
  	)
  	start := parser.Token.Start
  	for {
  		if skp, err := skip(parser, lexer.EOF); err != nil {
  			return nil, err
  		} else if skp {
  			break
  		}
  		switch kind := parser.Token.Kind; kind {
  		case lexer.BRACE_L, lexer.NAME, lexer.STRING, lexer.BLOCK_STRING:
  			item = tokenDefinitionFn[kind.String()]
  		default:
  			return nil, unexpected(parser, lexer.Token{})
  		}
  		if node, err = item(parser); err != nil {
  			return nil, err
  		}
  		nodes = append(nodes, node)
  	}
  	return ast.NewDocument(&ast.Document{
  		Loc:         loc(parser, start),
  		Definitions: nodes,
  	}), nil
  }
docs: /* Implements the parsing rules in the Document section. */