* var allowedCapitalWords = map[string]struct{}{ "ID": {}, "JSON": {}, } */
(s string)
| 37 | */ |
| 38 | |
| 39 | func (l *methodLexer) reset(s string) { |
| 40 | l.cur = -1 |
| 41 | var words []string |
| 42 | if s != "" { |
| 43 | end := len(s) |
| 44 | start := -1 |
| 45 | |
| 46 | // outter: |
| 47 | for i, n := 0, end; i < n; i++ { |
| 48 | c := rune(s[i]) |
| 49 | if unicode.IsUpper(c) { |
| 50 | // it doesn't count the last uppercase |
| 51 | if start != -1 { |
| 52 | /* |
| 53 | for allowedCapitalWord := range allowedCapitalWords { |
| 54 | capitalWordEnd := i + len(allowedCapitalWord) // takes last char too, e.g. ReadJSON, we need the JSON. |
| 55 | if len(s) >= capitalWordEnd { |
| 56 | word := s[i:capitalWordEnd] |
| 57 | if word == allowedCapitalWord { |
| 58 | words = append(words, word) |
| 59 | i = capitalWordEnd |
| 60 | start = i |
| 61 | continue outter |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | */ |
| 66 | |
| 67 | end = i |
| 68 | words = append(words, s[start:end]) |
| 69 | } |
| 70 | |
| 71 | start = i |
| 72 | continue |
| 73 | } |
| 74 | end = i + 1 |
| 75 | } |
| 76 | |
| 77 | if end > 0 && len(s) >= end { |
| 78 | words = append(words, s[start:]) |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | l.words = words |
| 83 | } |
| 84 | |
| 85 | func (l *methodLexer) next() (w string) { |
| 86 | cur := l.cur + 1 |