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

Method parseStringTemplate

www/js/_hyperscript.esm.js:1259–1281  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1257 // Parser-owned methods
1258 // ===========================
1259 parseStringTemplate() {
1260 var returnArr = [""];
1261 do {
1262 returnArr.push(this.lastWhitespace());
1263 if (this.currentToken().value === "$") {
1264 this.consumeToken();
1265 var startingBrace = this.matchOpToken("{");
1266 returnArr.push(this.requireElement("expression"));
1267 if (startingBrace) {
1268 this.requireOpToken("}");
1269 }
1270 returnArr.push("");
1271 } else if (this.currentToken().value === "\\") {
1272 this.consumeToken();
1273 this.consumeToken();
1274 } else {
1275 var token = this.consumeToken();
1276 returnArr[returnArr.length - 1] += token ? token.value : "";
1277 }
1278 } while (this.hasMore());
1279 returnArr.push(this.lastWhitespace());
1280 return returnArr;
1281 }
1282 commandBoundary(token) {
1283 if (token.value == "end" || token.value == "then" || token.value == "else" || token.value == "otherwise" || token.value == ")" || this.commandStart(token) || this.featureStart(token) || token.type == "EOF") {
1284 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