MCPcopy
hub / github.com/cortesi/modd / parseVariable

Method parseVariable

conf/parse.go:185–206  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

183}
184
185func (p *parser) parseVariable() (string, string, error) {
186 if p.peek().typ != itemVarName {
187 return "", "", nil
188 }
189 name := p.next().val
190
191 eq := p.next()
192 if eq.typ != itemEquals {
193 p.errorf("Expected =")
194 }
195 nxt := p.next()
196 val := ""
197 if nxt.typ == itemQuotedString {
198 val = unquote(nxt.val)
199 } else if nxt.typ == itemBareString {
200 val = nxt.val
201 } else {
202 p.errorf("Expected variable value")
203 }
204 val = strings.TrimSpace(val)
205 return name, val, nil
206}
207
208func prepValue(itm item) string {
209 val := itm.val

Callers 1

parseMethod · 0.95

Calls 4

peekMethod · 0.95
nextMethod · 0.95
errorfMethod · 0.95
unquoteFunction · 0.85

Tested by

no test coverage detected