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

Method parse

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

Source from the content-addressed store, hash-verified

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