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

Method parse

src/parsetree/commands/basic.js:260–282  ·  view source on GitHub ↗
(parser)

Source from the content-addressed store, hash-verified

258 }
259
260 static parse(parser) {
261 if (!parser.matchToken("make")) return;
262 parser.matchToken("a") || parser.matchToken("an");
263
264 var expr = parser.requireElement("expression");
265
266 var args = [];
267 if (expr.type !== "queryRef" && parser.matchToken("from")) {
268 do {
269 args.push(parser.requireElement("expression"));
270 } while (parser.matchOpToken(","));
271 }
272
273 if (parser.matchToken("called")) {
274 var target = parser.requireElement("symbol");
275 }
276
277 if (expr.type === "queryRef") {
278 return new MakeCommand("queryRef", expr, null, target);
279 } else {
280 return new MakeCommand("constructor", expr, args, target);
281 }
282 }
283
284 resolve(ctx, { expr, constructorArgs } = {}) {
285 if (this.variant === "queryRef") {

Callers

nothing calls this directly

Calls 3

matchTokenMethod · 0.45
requireElementMethod · 0.45
matchOpTokenMethod · 0.45

Tested by

no test coverage detected