| 183 | } |
| 184 | |
| 185 | func (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 | |
| 208 | func prepValue(itm item) string { |
| 209 | val := itm.val |