MCPcopy Create free account
hub / github.com/bigskysoftware/_hyperscript / parse

Method parse

www/js/_hyperscript.esm.js:8729–8744  ·  view source on GitHub ↗
(parser)

Source from the content-addressed store, hash-verified

8727 this.args = { message, choiceA, choiceB };
8728 }
8729 static parse(parser) {
8730 if (!parser.matchToken("answer")) return;
8731 var message = parser.requireElement("expression");
8732 var choiceA = null, choiceB = null;
8733 if (parser.matchToken("with")) {
8734 parser.pushFollow("or");
8735 try {
8736 choiceA = parser.requireElement("expression");
8737 } finally {
8738 parser.popFollow();
8739 }
8740 parser.requireToken("or");
8741 choiceB = parser.requireElement("expression");
8742 }
8743 return new _AnswerCommand(message, choiceA, choiceB);
8744 }
8745 resolve(ctx, { message, choiceA, choiceB }) {
8746 if (choiceA) {
8747 ctx.result = confirm(String(message)) ? choiceA : choiceB;

Callers

nothing calls this directly

Calls 5

matchTokenMethod · 0.45
requireElementMethod · 0.45
pushFollowMethod · 0.45
popFollowMethod · 0.45
requireTokenMethod · 0.45

Tested by

no test coverage detected