MCPcopy Index your code
hub / github.com/bigskysoftware/_hyperscript / parseHyperscriptProgram

Method parseHyperscriptProgram

tools/common/_hyperscript.iife.js:1468–1503  ·  view source on GitHub ↗
(parser)

Source from the content-addressed store, hash-verified

1466 parser.raiseError("Unexpected value: " + parser.currentToken().value);
1467 }
1468 parseHyperscriptProgram(parser) {
1469 var features = [];
1470 if (parser.hasMore()) {
1471 while (parser.currentToken().type !== "EOF") {
1472 var keyword = parser.currentToken().value;
1473 if (parser.featureStart(parser.currentToken()) || parser.currentToken().value === "(") {
1474 try {
1475 var feature = parser.requireElement("feature");
1476 features.push(feature);
1477 parser.matchToken("end");
1478 } catch (e) {
1479 if (e instanceof ParseRecoverySentinel) {
1480 features.push(new FailedFeature(e.parseError, keyword));
1481 this.#syncToFeature(parser);
1482 } else {
1483 throw e;
1484 }
1485 }
1486 } else if (parser.currentToken().value === "end") {
1487 break;
1488 } else {
1489 try {
1490 parser.raiseError();
1491 } catch (e) {
1492 if (e instanceof ParseRecoverySentinel) {
1493 features.push(new FailedFeature(e.parseError, keyword));
1494 this.#syncToFeature(parser);
1495 } else {
1496 throw e;
1497 }
1498 }
1499 }
1500 }
1501 }
1502 return new HyperscriptProgram(features);
1503 }
1504 use(plugin) {
1505 plugin(this);
1506 return this;

Callers

nothing calls this directly

Calls 7

hasMoreMethod · 0.45
currentTokenMethod · 0.45
featureStartMethod · 0.45
requireElementMethod · 0.45
matchTokenMethod · 0.45
#syncToFeatureMethod · 0.45
raiseErrorMethod · 0.45

Tested by

no test coverage detected