func ParseDirectives(f *bzl.File) []Directive {
	var directives []Directive
	parseComment := func(com bzl.Comment) {
		match := directiveRe.FindStringSubmatch(com.Token)
		if match == nil {
			return
		}
		key, value := match[1], match[2]
		directives = append(directives, Directive{key, value})
	}

	for _, s := range f.Stmt {
		coms := s.Comment()
		for _, com := range coms.Before {
			parseComment(com)
		}
		for _, com := range coms.After {
			parseComment(com)
		}
	}
	return directives
}
func ParseDirectives(f *bzl.File) []Directive {
	var directives []Directive
	parseComment := func(com bzl.Comment) {
		match := directiveRe.FindStringSubmatch(com.Token)
		if match == nil {
			return
		}
		key, value := match[1], match[2]
		directives = append(directives, Directive{key, value})
	}

	for _, s := range f.Stmt {
		coms := s.Comment()
		for _, com := range coms.Before {
			parseComment(com)
		}
		for _, com := range coms.After {
			parseComment(com)
		}
	}
	return directives
}
// TODO(jayconrod): annotation directives will apply to an individual rule.
// They must appear in the block of comments above that rule.
// ParseDirectives scans f for Gazelle directives. The full list of directives
// is returned. Errors are reported for unrecognized directives and directives
// out of place (after the first statement).