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

Method parse

www/js/_hyperscript.esm.js:8647–8665  ·  view source on GitHub ↗
(parser)

Source from the content-addressed store, hash-verified

8645 this.args = { text, voice, rate, pitch, volume };
8646 }
8647 static parse(parser) {
8648 if (!parser.matchToken("speak")) return;
8649 var text = parser.requireElement("expression");
8650 var voice = null, rate = null, pitch = null, volume = null;
8651 while (parser.matchToken("with")) {
8652 if (parser.matchToken("voice")) {
8653 voice = parser.requireElement("expression");
8654 } else if (parser.matchToken("rate")) {
8655 rate = parser.requireElement("expression");
8656 } else if (parser.matchToken("pitch")) {
8657 pitch = parser.requireElement("expression");
8658 } else if (parser.matchToken("volume")) {
8659 volume = parser.requireElement("expression");
8660 } else {
8661 parser.raiseExpected("voice", "rate", "pitch", "volume");
8662 }
8663 }
8664 return new _SpeakCommand(text, voice, rate, pitch, volume);
8665 }
8666 resolve(ctx, { text, voice, rate, pitch, volume }) {
8667 var utterance = new SpeechSynthesisUtterance(String(text));
8668 if (voice) {

Callers

nothing calls this directly

Calls 3

matchTokenMethod · 0.45
requireElementMethod · 0.45
raiseExpectedMethod · 0.45

Tested by

no test coverage detected