(it *lex.ItemIterator)
| 2745 | } |
| 2746 | |
| 2747 | func parseLanguageList(it *lex.ItemIterator) ([]string, error) { |
| 2748 | item := it.Item() |
| 2749 | var langs []string |
| 2750 | for ; item.Typ == itemName || item.Typ == itemPeriod || item.Typ == itemStar; item = it.Item() { |
| 2751 | langs = append(langs, item.Val) |
| 2752 | it.Next() |
| 2753 | if it.Item().Typ == itemColon { |
| 2754 | it.Next() |
| 2755 | } else { |
| 2756 | break |
| 2757 | } |
| 2758 | } |
| 2759 | if it.Item().Typ == itemPeriod { |
| 2760 | peekIt, err := it.Peek(1) |
| 2761 | if err != nil { |
| 2762 | return nil, err |
| 2763 | } |
| 2764 | if peekIt[0].Typ == itemPeriod { |
| 2765 | return nil, it.Errorf("Expected only one dot(.) while parsing language list.") |
| 2766 | } |
| 2767 | } |
| 2768 | it.Prev() |
| 2769 | |
| 2770 | for _, lang := range langs { |
| 2771 | if lang == string(star) && len(langs) > 1 { |
| 2772 | return nil, errors.Errorf( |
| 2773 | "If * is used, no other languages are allowed in the language list. Found %v", |
| 2774 | langs) |
| 2775 | } |
| 2776 | } |
| 2777 | |
| 2778 | return langs, nil |
| 2779 | } |
| 2780 | |
| 2781 | func validKeyAtRoot(k string) bool { |
| 2782 | switch k { |
no test coverage detected