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

Method parse

www/js/_hyperscript-max.js:8185–8208  ·  view source on GitHub ↗
(parser)

Source from the content-addressed store, hash-verified

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