MCPcopy Create free account
hub / github.com/aurelia/binding / scanNumber

Method scanNumber

src/parser.js:391–431  ·  view source on GitHub ↗
(isFloat)

Source from the content-addressed store, hash-verified

389 }
390
391 scanNumber(isFloat) {
392 if (isFloat) {
393 this.val = 0;
394 } else {
395 this.val = this.ch - /*0*/0x30;
396 while (this.next() <= /*9*/0x39 && this.ch >= /*0*/0x30) {
397 this.val = this.val * 10 + this.ch - /*0*/0x30;
398 }
399 }
400
401 if (isFloat || this.ch === /*.*/0x2E) {
402 // isFloat (coming from the period scanner) means the period was already skipped
403 if (!isFloat) {
404 this.next();
405 }
406 const start = this.idx;
407 let value = this.ch - /*0*/0x30;
408 while (this.next() <= /*9*/0x39 && this.ch >= /*0*/0x30) {
409 value = value * 10 + this.ch - /*0*/0x30;
410 }
411 this.val = this.val + value / 10 ** (this.idx - start);
412 }
413
414 if (this.ch === /*e*/0x65 || this.ch === /*E*/0x45) {
415 const start = this.idx;
416
417 this.next();
418 if (this.ch === /*-*/0x2D || this.ch === /*+*/0x2B) {
419 this.next();
420 }
421
422 if (!(this.ch >= /*0*/0x30 && this.ch <= /*9*/0x39)) {
423 this.idx = start;
424 this.err('Invalid exponent');
425 }
426 while (this.next() <= /*9*/0x39 && this.ch >= /*0*/0x30) { } // eslint-disable-line no-empty
427 this.val = parseFloat(this.src.slice(this.start, this.idx));
428 }
429
430 return T$NumericLiteral;
431 }
432
433 scanString() {
434 let quote = this.ch;

Callers 3

parser.jsFile · 0.80
aurelia-binding.jsFile · 0.80
aurelia-binding.jsFile · 0.80

Calls 2

nextMethod · 0.95
errMethod · 0.95

Tested by

no test coverage detected