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)
| 215 | // parses the ${param#word} string function |
| 216 | // parses the ${param##word} string function |
| 217 | func (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 |
no test coverage detected