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

Method parseStringTemplate

www/js/_hyperscript.js:1261–1283  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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