MCPcopy Create free account
hub / github.com/bigskysoftware/_hyperscript / parse

Method parse

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

Source from the content-addressed store, hash-verified

8197 this.args = { text, voice, rate, pitch, volume };
8198 }
8199 static parse(parser) {
8200 if (!parser.matchToken("speak")) return;
8201 var text = parser.requireElement("expression");
8202 var voice = null, rate = null, pitch = null, volume = null;
8203 while (parser.matchToken("with")) {
8204 if (parser.matchToken("voice")) {
8205 voice = parser.requireElement("expression");
8206 } else if (parser.matchToken("rate")) {
8207 rate = parser.requireElement("expression");
8208 } else if (parser.matchToken("pitch")) {
8209 pitch = parser.requireElement("expression");
8210 } else if (parser.matchToken("volume")) {
8211 volume = parser.requireElement("expression");
8212 } else {
8213 parser.raiseExpected("voice", "rate", "pitch", "volume");
8214 }
8215 }
8216 return new _SpeakCommand(text, voice, rate, pitch, volume);
8217 }
8218 resolve(ctx, { text, voice, rate, pitch, volume }) {
8219 var utterance = new SpeechSynthesisUtterance(String(text));
8220 if (voice) {

Callers

nothing calls this directly

Calls 3

matchTokenMethod · 0.45
requireElementMethod · 0.45
raiseExpectedMethod · 0.45

Tested by

no test coverage detected