()
| 390 | } |
| 391 | |
| 392 | readValue(): JSONValue { |
| 393 | const c = this.next(); |
| 394 | const fn = c && this.table[c]; |
| 395 | |
| 396 | if (fn) return fn.apply(this); |
| 397 | |
| 398 | // fell through table, parse as an id |
| 399 | |
| 400 | const s = this.string; |
| 401 | const i = this.index - 1; |
| 402 | |
| 403 | // Regexp.lastIndex may not work right in IE before 5.5? |
| 404 | // g flag on the regexp is also necessary |
| 405 | next_id.lastIndex = i; |
| 406 | const m = unwrap(next_id.exec(s)); |
| 407 | |
| 408 | // console.log('matched id', i, r.lastIndex); |
| 409 | |
| 410 | if (m.length > 0) { |
| 411 | const id = m[0]; |
| 412 | this.index = i + id.length; |
| 413 | return id; // a string |
| 414 | } |
| 415 | |
| 416 | if (c) this.error("invalid character: '" + c + "'"); |
| 417 | this.error('empty expression'); |
| 418 | } |
| 419 | |
| 420 | next(): string | undefined { |
| 421 | let c: string; |
no test coverage detected