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

Method parse

tools/common/_hyperscript.iife.js:6031–6060  ·  view source on GitHub ↗
(parser)

Source from the content-addressed store, hash-verified

6029 this.scrollOptions = scrollOptions;
6030 }
6031 static parse(parser) {
6032 if (!parser.matchToken("go")) return;
6033 if (parser.matchToken("back")) {
6034 return new _GoCommand(null, null, true);
6035 }
6036 parser.matchToken("to");
6037 if (parser.matchToken("url")) {
6038 var target = parser.requireElement("stringLike");
6039 var newWindow = false;
6040 if (parser.matchToken("in")) {
6041 parser.requireToken("new");
6042 parser.requireToken("window");
6043 newWindow = true;
6044 }
6045 return new _GoCommand(target, null, false, newWindow);
6046 }
6047 var cur = parser.currentToken();
6048 if (cur.value === "the" || cur.value === "top" || cur.value === "middle" || cur.value === "bottom" || cur.value === "left" || cur.value === "center" || cur.value === "right") {
6049 var scroll = _parseScrollModifiers(parser);
6050 return new _GoCommand(scroll.target, scroll.offset, false, false, scroll.plusOrMinus, scroll.scrollOptions);
6051 }
6052 var target = parser.parseURLOrExpression();
6053 var newWindow = false;
6054 if (parser.matchToken("in")) {
6055 parser.requireToken("new");
6056 parser.requireToken("window");
6057 newWindow = true;
6058 }
6059 return new _GoCommand(target, null, false, newWindow);
6060 }
6061 resolve(ctx, { target: to, offset }) {
6062 if (this.back) {
6063 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