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

Method parse

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

Source from the content-addressed store, hash-verified

4921 this.args = { exprs };
4922 }
4923 static parse(parser) {
4924 if (!parser.matchOpToken("{")) return;
4925 var stringParts = [""];
4926 var exprs = [];
4927 while (parser.hasMore()) {
4928 if (parser.matchOpToken("\\")) {
4929 parser.consumeToken();
4930 } else if (parser.matchOpToken("}")) {
4931 break;
4932 } else if (parser.matchToken("$")) {
4933 var opencurly = parser.matchOpToken("{");
4934 var expr = parser.parseElement("expression");
4935 if (opencurly) parser.requireOpToken("}");
4936 exprs.push(expr);
4937 stringParts.push("");
4938 } else {
4939 var tok = parser.consumeToken();
4940 stringParts[stringParts.length - 1] += parser.source.substring(tok.start, tok.end);
4941 }
4942 stringParts[stringParts.length - 1] += parser.lastWhitespace();
4943 }
4944 return new _StyleLiteral(stringParts, exprs);
4945 }
4946 resolve(ctx, { exprs }) {
4947 var rv = "";
4948 const stringParts = this.stringParts;

Callers

nothing calls this directly

Calls 7

matchOpTokenMethod · 0.45
hasMoreMethod · 0.45
consumeTokenMethod · 0.45
matchTokenMethod · 0.45
parseElementMethod · 0.45
requireOpTokenMethod · 0.45
lastWhitespaceMethod · 0.45

Tested by

no test coverage detected