MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / parseNumber

Method parseNumber

tools/mcdevicetree.js:1374–1393  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1372 }
1373
1374 parseNumber() {
1375 const startPos = this.pos;
1376
1377 if (this.content.charCodeAt(this.pos) === ZERO &&
1378 this.pos + 1 < this.length &&
1379 this.content.charCodeAt(this.pos + 1) === 120) { // 'x'
1380 // Hex number
1381 this.pos += 2;
1382 while (this.pos < this.length && this.isHexDigit(this.content.charCodeAt(this.pos))) {
1383 this.pos++;
1384 }
1385 } else {
1386 // Decimal number
1387 while (this.pos < this.length && this.isDigit(this.content.charCodeAt(this.pos))) {
1388 this.pos++;
1389 }
1390 }
1391
1392 return this.content.slice(startPos, this.pos);
1393 }
1394
1395 parseIdentifier() {
1396 const startPos = this.pos;

Callers 2

parseValueMethod · 0.95
parseArrayMethod · 0.95

Calls 3

isHexDigitMethod · 0.95
isDigitMethod · 0.95
sliceMethod · 0.65

Tested by

no test coverage detected