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

Method toString

www/js/_hyperscript-max.js:27–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25 }
26 // ----- Debug -----
27 toString() {
28 var cur = this.currentToken();
29 var lines = this.source.split("\n");
30 var lineIdx = cur?.line ? cur.line - 1 : lines.length - 1;
31 var col = cur?.line ? cur.column : 0;
32 var contextLine = lines[lineIdx] || "";
33 var tokenLen = Math.max(1, cur?.value?.length || 1);
34 var gutter = String(lineIdx + 1).length;
35 var out = "Tokens(";
36 out += this.#consumed.filter((t) => t.type !== "WHITESPACE").length + " consumed, ";
37 out += this.#tokens.filter((t) => t.type !== "WHITESPACE").length + " remaining";
38 out += ", line " + (lineIdx + 1) + ")\n";
39 out += " " + String(lineIdx + 1).padStart(gutter) + " | " + contextLine + "\n";
40 out += " ".repeat(gutter + 5) + " ".repeat(col) + "^".repeat(tokenLen);
41 if (cur) out += " " + cur.type + " '" + cur.value + "'";
42 return out;
43 }
44 // ----- Token access -----
45 currentToken() {
46 return this.token(0);

Callers 5

_toHTMLFunction · 0.45
getMethod · 0.45
genUUIDFunction · 0.45
workerFuncFunction · 0.45

Calls 1

currentTokenMethod · 0.45

Tested by

no test coverage detected