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

Method parse

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

Source from the content-addressed store, hash-verified

6388 this.scrollOptions = scrollOptions;
6389 }
6390 static parse(parser) {
6391 if (!parser.matchToken("go")) return;
6392 if (parser.matchToken("back")) {
6393 return new _GoCommand(null, null, true);
6394 }
6395 parser.matchToken("to");
6396 if (parser.matchToken("url")) {
6397 var target = parser.requireElement("stringLike");
6398 var newWindow = false;
6399 if (parser.matchToken("in")) {
6400 parser.requireToken("new");
6401 parser.requireToken("window");
6402 newWindow = true;
6403 }
6404 return new _GoCommand(target, null, false, newWindow);
6405 }
6406 var cur = parser.currentToken();
6407 if (cur.value === "the" || cur.value === "top" || cur.value === "middle" || cur.value === "bottom" || cur.value === "left" || cur.value === "center" || cur.value === "right") {
6408 var scroll = _parseScrollModifiers(parser);
6409 return new _GoCommand(scroll.target, scroll.offset, false, false, scroll.plusOrMinus, scroll.scrollOptions);
6410 }
6411 var target = parser.parseURLOrExpression();
6412 var newWindow = false;
6413 if (parser.matchToken("in")) {
6414 parser.requireToken("new");
6415 parser.requireToken("window");
6416 newWindow = true;
6417 }
6418 return new _GoCommand(target, null, false, newWindow);
6419 }
6420 resolve(ctx, { target: to, offset }) {
6421 if (this.back) {
6422 window.history.back();

Callers

nothing calls this directly

Calls 6

_parseScrollModifiersFunction · 0.70
matchTokenMethod · 0.45
requireElementMethod · 0.45
requireTokenMethod · 0.45
currentTokenMethod · 0.45
parseURLOrExpressionMethod · 0.45

Tested by

no test coverage detected