MCPcopy Create free account
hub / github.com/bigskysoftware/_hyperscript / #consumeNumber

Method #consumeNumber

tools/common/_hyperscript.iife.js:478–504  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

476 return token;
477 }
478 #consumeNumber() {
479 var token = this.#makeToken("NUMBER");
480 var value = this.#consumeChar();
481 while (this.#isNumeric(this.#currentChar())) {
482 value += this.#consumeChar();
483 }
484 if (this.#currentChar() === "." && this.#isNumeric(this.#nextChar())) {
485 value += this.#consumeChar();
486 }
487 while (this.#isNumeric(this.#currentChar())) {
488 value += this.#consumeChar();
489 }
490 if (this.#currentChar() === "e" || this.#currentChar() === "E") {
491 if (this.#isNumeric(this.#nextChar())) {
492 value += this.#consumeChar();
493 } else if (this.#nextChar() === "-") {
494 value += this.#consumeChar();
495 value += this.#consumeChar();
496 }
497 }
498 while (this.#isNumeric(this.#currentChar())) {
499 value += this.#consumeChar();
500 }
501 token.value = value;
502 token.end = this.#position;
503 return token;
504 }
505 #consumeOp() {
506 var token = this.#makeOpToken();
507 var value = this.#consumeChar();

Callers 1

#tokenizeMethod · 0.95

Calls 5

#makeTokenMethod · 0.95
#consumeCharMethod · 0.95
#isNumericMethod · 0.95
#currentCharMethod · 0.95
#nextCharMethod · 0.95

Tested by

no test coverage detected