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

Method parse

www/js/_hyperscript-max.js:8730–8745  ·  view source on GitHub ↗
(parser)

Source from the content-addressed store, hash-verified

8728 this.args = { message, choiceA, choiceB };
8729 }
8730 static parse(parser) {
8731 if (!parser.matchToken("answer")) return;
8732 var message = parser.requireElement("expression");
8733 var choiceA = null, choiceB = null;
8734 if (parser.matchToken("with")) {
8735 parser.pushFollow("or");
8736 try {
8737 choiceA = parser.requireElement("expression");
8738 } finally {
8739 parser.popFollow();
8740 }
8741 parser.requireToken("or");
8742 choiceB = parser.requireElement("expression");
8743 }
8744 return new _AnswerCommand(message, choiceA, choiceB);
8745 }
8746 resolve(ctx, { message, choiceA, choiceB }) {
8747 if (choiceA) {
8748 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