code: func parseFragment(parser *Parser) (interface{}, error) {
  	var (
  		err error
  	)
  	start := parser.Token.Start
  	if _, err = expect(parser, lexer.SPREAD); err != nil {
  		return nil, err
  	}
  	if peek(parser, lexer.NAME) && parser.Token.Value != "on" {
  		name, err := parseFragmentName(parser)
  		if err != nil {
  			return nil, err
  		}
  		directives, err := parseDirectives(parser)
  		if err != nil {
  			return nil, err
  		}
  		return ast.NewFragmentSpread(&ast.FragmentSpread{
  			Name:       name,
  			Directives: directives,
  			Loc:        loc(parser, start),
  		}), nil
  	}
  	var typeCondition *ast.Named
  	if parser.Token.Value == "on" {
  		if err := advance(parser); err != nil {
  			return nil, err
  		}
  		name, err := parseNamed(parser)
  		if err != nil {
  			return nil, err
  		}
  		typeCondition = name
  
  	}
  	directives, err := parseDirectives(parser)
  	if err != nil {
  		return nil, err
  	}
  	selectionSet, err := parseSelectionSet(parser)
  	if err != nil {
  		return nil, err
  	}
  	return ast.NewInlineFragment(&ast.InlineFragment{
  		TypeCondition: typeCondition,
  		Directives:    directives,
  		SelectionSet:  selectionSet,
  		Loc:           loc(parser, start),
  	}), nil
  }
docs: /* Implements the parsing rules in the Fragments section. */
  /**
   * Corresponds to both FragmentSpread and InlineFragment in the spec.
   *
   * FragmentSpread : ... FragmentName Directives?
   *
   * InlineFragment : ... TypeCondition? Directives? SelectionSet
   */