MCPcopy Create free account
hub / github.com/drone/envsubst / parseRemoveFunc

Method parseRemoveFunc

parse/parse.go:217–242  ·  view source on GitHub ↗

parses the ${param%word} string function parses the ${param%%word} string function parses the ${param#word} string function parses the ${param##word} string function

(name string, accept acceptFunc)

Source from the content-addressed store, hash-verified

215// parses the ${param#word} string function
216// parses the ${param##word} string function
217func (t *Tree) parseRemoveFunc(name string, accept acceptFunc) (Node, error) {
218 node := new(FuncNode)
219 node.Param = name
220
221 t.scanner.accept = accept
222 t.scanner.mode = scanIdent
223 switch t.scanner.scan() {
224 case tokenIdent:
225 node.Name = t.scanner.string()
226 default:
227 return nil, ErrBadSubstitution
228 }
229
230 // scan arg[1]
231 {
232 param, err := t.parseParam(acceptNotClosing, scanIdent)
233 if err != nil {
234 return nil, err
235 }
236
237 // param.Value = t.scanner.string()
238 node.Args = append(node.Args, param)
239 }
240
241 return node, t.consumeRbrack()
242}
243
244// parses the ${param/pattern/string} string function
245// parses the ${param//pattern/string} string function

Callers 1

parseFuncMethod · 0.95

Calls 4

parseParamMethod · 0.95
consumeRbrackMethod · 0.95
scanMethod · 0.80
stringMethod · 0.80

Tested by

no test coverage detected