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

Method parse

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

Source from the content-addressed store, hash-verified

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