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

Method parseStringTemplate

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

Source from the content-addressed store, hash-verified

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