procInst parses the `param="..."` or `param='...'` value out of the provided string, returning "" if not found.
(param, s string)
| 2039 | // procInst parses the `param="..."` or `param='...'` |
| 2040 | // value out of the provided string, returning "" if not found. |
| 2041 | func procInst(param, s string) string { |
| 2042 | // TODO: this parsing is somewhat lame and not exact. |
| 2043 | // It works for all actual cases, though. |
| 2044 | param = param + "=" |
| 2045 | _, v, _ := strings.Cut(s, param) |
| 2046 | if v == "" { |
| 2047 | return "" |
| 2048 | } |
| 2049 | if v[0] != '\'' && v[0] != '"' { |
| 2050 | return "" |
| 2051 | } |
| 2052 | unquote, _, ok := strings.Cut(v[1:], v[:1]) |
| 2053 | if !ok { |
| 2054 | return "" |
| 2055 | } |
| 2056 | return unquote |
| 2057 | } |