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

Method #consumeNumber

www/js/_hyperscript-max.js:484–510  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

482 return token;
483 }
484 #consumeNumber() {
485 var token = this.#makeToken("NUMBER");
486 var value = this.#consumeChar();
487 while (this.#isNumeric(this.#currentChar())) {
488 value += this.#consumeChar();
489 }
490 if (this.#currentChar() === "." && this.#isNumeric(this.#nextChar())) {
491 value += this.#consumeChar();
492 }
493 while (this.#isNumeric(this.#currentChar())) {
494 value += this.#consumeChar();
495 }
496 if (this.#currentChar() === "e" || this.#currentChar() === "E") {
497 if (this.#isNumeric(this.#nextChar())) {
498 value += this.#consumeChar();
499 } else if (this.#nextChar() === "-") {
500 value += this.#consumeChar();
501 value += this.#consumeChar();
502 }
503 }
504 while (this.#isNumeric(this.#currentChar())) {
505 value += this.#consumeChar();
506 }
507 token.value = value;
508 token.end = this.#position;
509 return token;
510 }
511 #consumeOp() {
512 var token = this.#makeOpToken();
513 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