()
| 580 | } |
| 581 | |
| 582 | #consumeNumber() { |
| 583 | var token = this.#makeToken("NUMBER"); |
| 584 | var value = this.#consumeChar(); |
| 585 | |
| 586 | // consume integer part: XXX |
| 587 | while (this.#isNumeric(this.#currentChar())) { |
| 588 | value += this.#consumeChar(); |
| 589 | } |
| 590 | |
| 591 | // consume decimal part: .YYY |
| 592 | if (this.#currentChar() === "." && this.#isNumeric(this.#nextChar())) { |
| 593 | value += this.#consumeChar(); |
| 594 | } |
| 595 | while (this.#isNumeric(this.#currentChar())) { |
| 596 | value += this.#consumeChar(); |
| 597 | } |
| 598 | |
| 599 | // consume exponent: (e|E)[-]ZZZ |
| 600 | if (this.#currentChar() === "e" || this.#currentChar() === "E") { |
| 601 | if (this.#isNumeric(this.#nextChar())) { |
| 602 | value += this.#consumeChar(); |
| 603 | } else if (this.#nextChar() === "-") { |
| 604 | value += this.#consumeChar(); |
| 605 | value += this.#consumeChar(); |
| 606 | } |
| 607 | } |
| 608 | while (this.#isNumeric(this.#currentChar())) { |
| 609 | value += this.#consumeChar(); |
| 610 | } |
| 611 | |
| 612 | token.value = value; |
| 613 | token.end = this.#position; |
| 614 | return token; |
| 615 | } |
| 616 | |
| 617 | #consumeOp() { |
| 618 | var token = this.#makeOpToken(); |
no test coverage detected