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

Method parse

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

Source from the content-addressed store, hash-verified

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