MCPcopy Create free account
hub / github.com/docopt/docopt.go / parseSection

Function parseSection

docopt.go:154–164  ·  view source on GitHub ↗
(name, source string)

Source from the content-addressed store, hash-verified

152}
153
154func parseSection(name, source string) []string {
155 p := regexp.MustCompile(`(?im)^([^\n]*` + name + `[^\n]*\n?(?:[ \t].*?(?:\n|$))*)`)
156 s := p.FindAllString(source, -1)
157 if s == nil {
158 s = []string{}
159 }
160 for i, v := range s {
161 s[i] = strings.TrimSpace(v)
162 }
163 return s
164}
165
166func parseDefaults(doc string) patternList {
167 defaults := patternList{}

Callers 4

parseFunction · 0.85
parseDefaultsFunction · 0.85
TestFormalUsageFunction · 0.85
TestParseSectionFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestFormalUsageFunction · 0.68
TestParseSectionFunction · 0.68