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

Method parse

tools/common/_hyperscript.iife.js:6424–6454  ·  view source on GitHub ↗
(parser)

Source from the content-addressed store, hash-verified

6422 this.args = variant === "event" ? { on } : { time };
6423 }
6424 static parse(parser) {
6425 if (!parser.matchToken("wait")) return;
6426 if (parser.matchToken("for")) {
6427 parser.matchToken("a");
6428 var events = [];
6429 do {
6430 var lookahead = parser.token(0);
6431 if (lookahead.type === "NUMBER" || lookahead.type === "L_PAREN") {
6432 events.push(parser.requireElement("expression"));
6433 } else {
6434 events.push({
6435 name: parser.requireElement("dotOrColonPath", "Expected event name").evalStatically(),
6436 args: ParseElement.parseEventArgs(parser)
6437 });
6438 }
6439 } while (parser.matchToken("or"));
6440 if (parser.matchToken("from")) {
6441 var on = parser.requireElement("expression");
6442 }
6443 return new _WaitCommand("event", events, on, null);
6444 } else {
6445 var time;
6446 if (parser.matchToken("a")) {
6447 parser.requireToken("tick");
6448 time = 0;
6449 } else {
6450 time = parser.requireElement("expression");
6451 }
6452 return new _WaitCommand("time", null, null, time);
6453 }
6454 }
6455 resolve(context, { on, time }) {
6456 if (this.variant === "event") {
6457 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