MCPcopy Create free account
hub / github.com/bigskysoftware/_hyperscript / parse

Method parse

www/js/_hyperscript.esm.js:8184–8207  ·  view source on GitHub ↗
(parser)

Source from the content-addressed store, hash-verified

8182 this.args = { target: targetExpr };
8183 }
8184 static parse(parser) {
8185 if (!parser.matchToken("show")) return;
8186 var targetExpr = VisibilityCommand.parseShowHideTarget(parser);
8187 var name = null;
8188 if (parser.matchToken("with")) {
8189 name = parser.requireTokenType("IDENTIFIER", "STYLE_REF").value;
8190 if (name.startsWith("*")) {
8191 name = name.slice(1);
8192 }
8193 }
8194 var arg = null;
8195 if (parser.matchOpToken(":")) {
8196 var tokenArr = parser.consumeUntilWhitespace();
8197 parser.matchTokenType("WHITESPACE");
8198 arg = tokenArr.map(function(t) {
8199 return t.value;
8200 }).join("");
8201 }
8202 if (parser.matchToken("when")) {
8203 var when = parser.requireElement("expression");
8204 }
8205 var hideShowStrategy = VisibilityCommand.resolveHideShowStrategy(parser, name);
8206 return new _ShowCommand(targetExpr, when, arg, hideShowStrategy);
8207 }
8208 resolve(ctx, { target }) {
8209 var runtime2 = ctx.meta.runtime;
8210 var cmd = this;

Callers

nothing calls this directly

Calls 8

matchTokenMethod · 0.45
parseShowHideTargetMethod · 0.45
requireTokenTypeMethod · 0.45
matchOpTokenMethod · 0.45
matchTokenTypeMethod · 0.45
requireElementMethod · 0.45

Tested by

no test coverage detected