MCPcopy Index your code
hub / github.com/cortesi/modd / collectPatterns

Method collectPatterns

conf/parse.go:96–129  ·  view source on GitHub ↗

Collects an arbitrary number of patterns, and returns a (watch, exclude, NoCommonFilter) tuple.

()

Source from the content-addressed store, hash-verified

94// Collects an arbitrary number of patterns, and returns a (watch, exclude,
95// NoCommonFilter) tuple.
96func (p *parser) collectPatterns() ([]string, []string, bool) {
97 noCommonFilter := false
98 watch := []string{}
99 exclude := []string{}
100
101 vals := p.collect(itemBareString, itemQuotedString)
102 for _, v := range vals {
103 switch v.typ {
104 case itemBareString:
105 if v.val[0] == '!' {
106 exclude = append(exclude, v.val[1:])
107 } else {
108 if v.val == "+noignore" {
109 noCommonFilter = true
110 } else {
111 watch = append(watch, v.val)
112 }
113 }
114 case itemQuotedString:
115 if v.val[0] == '!' {
116 exclude = append(exclude, unquote(v.val[1:]))
117 } else {
118 watch = append(watch, unquote(v.val))
119 }
120 }
121 }
122 if len(watch) == 0 {
123 watch = nil
124 }
125 if len(exclude) == 0 {
126 exclude = nil
127 }
128 return watch, exclude, noCommonFilter
129}
130
131// errorf formats the error and terminates processing.
132func (p *parser) errorf(format string, args ...interface{}) {

Callers 1

parseBlockMethod · 0.95

Calls 2

collectMethod · 0.95
unquoteFunction · 0.85

Tested by

no test coverage detected