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

Method parseStringTemplate

tools/common/_hyperscript.iife.js:1251–1273  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1249 // Parser-owned methods
1250 // ===========================
1251 parseStringTemplate() {
1252 var returnArr = [""];
1253 do {
1254 returnArr.push(this.lastWhitespace());
1255 if (this.currentToken().value === "$") {
1256 this.consumeToken();
1257 var startingBrace = this.matchOpToken("{");
1258 returnArr.push(this.requireElement("expression"));
1259 if (startingBrace) {
1260 this.requireOpToken("}");
1261 }
1262 returnArr.push("");
1263 } else if (this.currentToken().value === "\\") {
1264 this.consumeToken();
1265 this.consumeToken();
1266 } else {
1267 var token = this.consumeToken();
1268 returnArr[returnArr.length - 1] += token ? token.value : "";
1269 }
1270 } while (this.hasMore());
1271 returnArr.push(this.lastWhitespace());
1272 return returnArr;
1273 }
1274 commandBoundary(token) {
1275 if (token.value == "end" || token.value == "then" || token.value == "else" || token.value == "otherwise" || token.value == ")" || this.commandStart(token) || this.featureStart(token) || token.type == "EOF") {
1276 return true;

Callers 2

parseMethod · 0.45
parseMethod · 0.45

Calls 7

lastWhitespaceMethod · 0.95
currentTokenMethod · 0.95
consumeTokenMethod · 0.95
matchOpTokenMethod · 0.95
requireElementMethod · 0.95
requireOpTokenMethod · 0.95
hasMoreMethod · 0.95

Tested by

no test coverage detected