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

Method parse

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

Source from the content-addressed store, hash-verified

7026 }
7027 }
7028 static parse(parser) {
7029 let lookAhead = parser.token(1);
7030 if (!(lookAhead && lookAhead.op && (lookAhead.value === "." || lookAhead.value === "("))) {
7031 return null;
7032 }
7033 var expr = parser.requireElement("primaryExpression");
7034 var rootRoot = expr.root;
7035 var root = expr;
7036 while (rootRoot.root != null) {
7037 root = root.root;
7038 rootRoot = rootRoot.root;
7039 }
7040 if (expr.type !== "functionCall") {
7041 parser.raiseError("Pseudo-commands must be function calls");
7042 }
7043 if (root.type === "functionCall" && root.root.root == null) {
7044 if (parser.matchAnyToken("the", "to", "on", "with", "into", "from", "at")) {
7045 var realRoot = parser.requireElement("expression");
7046 } else if (parser.matchToken("me")) {
7047 var realRoot = parser.requireElement("implicitMeTarget");
7048 }
7049 }
7050 if (realRoot) {
7051 return new _PseudoCommand("target", expr, realRoot, root);
7052 } else {
7053 return new _PseudoCommand("simple", expr, null, null);
7054 }
7055 }
7056 resolve(context, { target, argVals, result }) {
7057 if (this.variant === "target") {
7058 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