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

Method parse

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

Source from the content-addressed store, hash-verified

7422 }
7423 }
7424 static parse(parser) {
7425 let lookAhead = parser.token(1);
7426 if (!(lookAhead && lookAhead.op && (lookAhead.value === "." || lookAhead.value === "("))) {
7427 return null;
7428 }
7429 var expr = parser.requireElement("primaryExpression");
7430 var rootRoot = expr.root;
7431 var root = expr;
7432 while (rootRoot.root != null) {
7433 root = root.root;
7434 rootRoot = rootRoot.root;
7435 }
7436 if (expr.type !== "functionCall") {
7437 parser.raiseError("Pseudo-commands must be function calls");
7438 }
7439 if (root.type === "functionCall" && root.root.root == null) {
7440 if (parser.matchAnyToken("the", "to", "on", "with", "into", "from", "at")) {
7441 var realRoot = parser.requireElement("expression");
7442 } else if (parser.matchToken("me")) {
7443 var realRoot = parser.requireElement("implicitMeTarget");
7444 }
7445 }
7446 if (realRoot) {
7447 return new _PseudoCommand("target", expr, realRoot, root);
7448 } else {
7449 return new _PseudoCommand("simple", expr, null, null);
7450 }
7451 }
7452 resolve(context, { target, argVals, result }) {
7453 if (this.variant === "target") {
7454 context.meta.runtime.nullCheck(target, this._realRoot);

Callers

nothing calls this directly

Calls 5

tokenMethod · 0.45
requireElementMethod · 0.45
raiseErrorMethod · 0.45
matchAnyTokenMethod · 0.45
matchTokenMethod · 0.45

Tested by

no test coverage detected