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

Method parse

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

Source from the content-addressed store, hash-verified

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