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

Method parseHyperscriptProgram

www/js/_hyperscript.js:1478–1513  ·  view source on GitHub ↗
(parser)

Source from the content-addressed store, hash-verified

1476 parser.raiseError("Unexpected value: " + parser.currentToken().value);
1477 }
1478 parseHyperscriptProgram(parser) {
1479 var features = [];
1480 if (parser.hasMore()) {
1481 while (parser.currentToken().type !== "EOF") {
1482 var keyword = parser.currentToken().value;
1483 if (parser.featureStart(parser.currentToken()) || parser.currentToken().value === "(") {
1484 try {
1485 var feature = parser.requireElement("feature");
1486 features.push(feature);
1487 parser.matchToken("end");
1488 } catch (e) {
1489 if (e instanceof ParseRecoverySentinel) {
1490 features.push(new FailedFeature(e.parseError, keyword));
1491 this.#syncToFeature(parser);
1492 } else {
1493 throw e;
1494 }
1495 }
1496 } else if (parser.currentToken().value === "end") {
1497 break;
1498 } else {
1499 try {
1500 parser.raiseError();
1501 } catch (e) {
1502 if (e instanceof ParseRecoverySentinel) {
1503 features.push(new FailedFeature(e.parseError, keyword));
1504 this.#syncToFeature(parser);
1505 } else {
1506 throw e;
1507 }
1508 }
1509 }
1510 }
1511 }
1512 return new HyperscriptProgram(features);
1513 }
1514 use(plugin) {
1515 plugin(this);
1516 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