(source string)
| 499 | } |
| 500 | |
| 501 | func tokenListFromPattern(source string) *tokenList { |
| 502 | p := regexp.MustCompile(`([\[\]\(\)\|]|\.\.\.)`) |
| 503 | source = p.ReplaceAllString(source, ` $1 `) |
| 504 | p = regexp.MustCompile(`\s+|(\S*<.*?>)`) |
| 505 | split := p.Split(source, -1) |
| 506 | match := p.FindAllStringSubmatch(source, -1) |
| 507 | var result []string |
| 508 | l := len(split) |
| 509 | for i := 0; i < l; i++ { |
| 510 | if len(split[i]) > 0 { |
| 511 | result = append(result, split[i]) |
| 512 | } |
| 513 | if i < l-1 && len(match[i][1]) > 0 { |
| 514 | result = append(result, match[i][1]) |
| 515 | } |
| 516 | } |
| 517 | return newTokenList(result, errorLanguage) |
| 518 | } |
| 519 | |
| 520 | func formalUsage(section string) (string, error) { |
| 521 | _, _, section = stringPartition(section, ":") // drop "usage:" |
no test coverage detected