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

Method parseArray

tools/mcdevicetree.js:1341–1372  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1339 }
1340
1341 parseArray() {
1342 this.pos++; // consume '<'
1343 this.skipWhitespace();
1344 const values = [];
1345
1346 while (this.pos < this.length) {
1347 this.skipWhitespace();
1348
1349 if (this.content.charCodeAt(this.pos) === GT) {
1350 this.pos++;
1351 break;
1352 }
1353
1354 const code = this.content.charCodeAt(this.pos);
1355
1356 if (code === AMPERSAND) {
1357 this.pos++;
1358 this.skipWhitespace();
1359 values.push('&' + this.parseIdentifier());
1360 } else if (this.isDigit(code) || (code === ZERO && this.pos + 1 < this.length && this.content.charCodeAt(this.pos + 1) === 120)) { // 'x'
1361 values.push(this.parseNumber());
1362 } else if (this.isIdentifierStart(code)) {
1363 values.push(this.parseIdentifier());
1364 } else {
1365 this.pos++;
1366 }
1367
1368 this.skipWhitespace();
1369 }
1370
1371 return values;
1372 }
1373
1374 parseNumber() {
1375 const startPos = this.pos;

Callers 1

parseValueMethod · 0.95

Calls 6

skipWhitespaceMethod · 0.95
parseIdentifierMethod · 0.95
isDigitMethod · 0.95
parseNumberMethod · 0.95
isIdentifierStartMethod · 0.95
pushMethod · 0.45

Tested by

no test coverage detected