diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2015-03-31 22:05:02 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2015-03-31 22:05:16 +0900 |
commit | 50292adacbad70f9561bc1e22ccbd3adea22481a (patch) | |
tree | 72a9ba657933585b7c56798b71b64a206144421b /src/pattern.go | |
parent | 84a7499ae357bc3b3a82890d2e44d9c300af0c13 (diff) |
Implement --toggle-sort option (#173)
Diffstat (limited to 'src/pattern.go')
-rw-r--r-- | src/pattern.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/pattern.go b/src/pattern.go index 7acdbcfa..fbb70c5f 100644 --- a/src/pattern.go +++ b/src/pattern.go @@ -54,17 +54,21 @@ var ( ) func init() { - // We can uniquely identify the pattern for a given string since - // mode and caseMode do not change while the program is running - _patternCache = make(map[string]*Pattern) _splitRegex = regexp.MustCompile("\\s+") - _cache = NewChunkCache() + clearPatternCache() + clearChunkCache() } func clearPatternCache() { + // We can uniquely identify the pattern for a given string since + // mode and caseMode do not change while the program is running _patternCache = make(map[string]*Pattern) } +func clearChunkCache() { + _cache = NewChunkCache() +} + // BuildPattern builds Pattern object from the given arguments func BuildPattern(mode Mode, caseMode Case, nth []Range, delimiter *regexp.Regexp, runes []rune) *Pattern { |