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

Method parse

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

Source from the content-addressed store, hash-verified

6779 this.args = variant === "event" ? { on } : { time };
6780 }
6781 static parse(parser) {
6782 if (!parser.matchToken("wait")) return;
6783 if (parser.matchToken("for")) {
6784 parser.matchToken("a");
6785 var events = [];
6786 do {
6787 var lookahead = parser.token(0);
6788 if (lookahead.type === "NUMBER" || lookahead.type === "L_PAREN") {
6789 events.push(parser.requireElement("expression"));
6790 } else {
6791 events.push({
6792 name: parser.requireElement("dotOrColonPath", "Expected event name").evalStatically(),
6793 args: ParseElement.parseEventArgs(parser)
6794 });
6795 }
6796 } while (parser.matchToken("or"));
6797 if (parser.matchToken("from")) {
6798 var on = parser.requireElement("expression");
6799 }
6800 return new _WaitCommand("event", events, on, null);
6801 } else {
6802 var time;
6803 if (parser.matchToken("a")) {
6804 parser.requireToken("tick");
6805 time = 0;
6806 } else {
6807 time = parser.requireElement("expression");
6808 }
6809 return new _WaitCommand("time", null, null, time);
6810 }
6811 }
6812 resolve(context, { on, time }) {
6813 if (this.variant === "event") {
6814 var target = on ? on : context.me;

Callers

nothing calls this directly

Calls 6

matchTokenMethod · 0.45
tokenMethod · 0.45
requireElementMethod · 0.45
evalStaticallyMethod · 0.45
parseEventArgsMethod · 0.45
requireTokenMethod · 0.45

Tested by

no test coverage detected