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

Method parse

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

Source from the content-addressed store, hash-verified

6912 this.exposedFunctionNames = exposedFunctionNames;
6913 }
6914 static parse(parser) {
6915 var jsSourceStart = parser.currentToken().start;
6916 var jsLastToken = parser.currentToken();
6917 var funcNames = [];
6918 var funcName = "";
6919 var expectFunctionDeclaration = false;
6920 while (parser.hasMore()) {
6921 jsLastToken = parser.consumeToken();
6922 var peek = parser.token(0, true);
6923 if (peek.type === "IDENTIFIER" && peek.value === "end") {
6924 break;
6925 }
6926 if (expectFunctionDeclaration) {
6927 if (jsLastToken.type === "IDENTIFIER" || jsLastToken.type === "NUMBER") {
6928 funcName += jsLastToken.value;
6929 } else {
6930 if (funcName !== "") funcNames.push(funcName);
6931 funcName = "";
6932 expectFunctionDeclaration = false;
6933 }
6934 } else if (jsLastToken.type === "IDENTIFIER" && jsLastToken.value === "function") {
6935 expectFunctionDeclaration = true;
6936 }
6937 }
6938 var jsSourceEnd = jsLastToken.end + 1;
6939 return new _JsBody(
6940 parser.source.substring(jsSourceStart, jsSourceEnd),
6941 funcNames
6942 );
6943 }
6944 };
6945 var JsCommand = class _JsCommand extends Command {
6946 static keyword = "js";

Callers

nothing calls this directly

Calls 4

currentTokenMethod · 0.45
hasMoreMethod · 0.45
consumeTokenMethod · 0.45
tokenMethod · 0.45

Tested by

no test coverage detected