()
| 297 | } |
| 298 | |
| 299 | func (t *parser) keyIndex() (int, error) { |
| 300 | // First, get the key. |
| 301 | stop := runeSet([]rune{']'}) |
| 302 | v, _, err := runesUntil(t.sc, stop) |
| 303 | if err != nil { |
| 304 | return 0, err |
| 305 | } |
| 306 | // v should be the index |
| 307 | return strconv.Atoi(string(v)) |
| 308 | |
| 309 | } |
| 310 | func (t *parser) listItem(list []interface{}, i int) ([]interface{}, error) { |
| 311 | if i < 0 { |
| 312 | return list, fmt.Errorf("negative %d index not allowed", i) |
no test coverage detected