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

Method parse

www/js/_hyperscript-max.js:8648–8666  ·  view source on GitHub ↗
(parser)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

matchTokenMethod · 0.45
requireElementMethod · 0.45
raiseExpectedMethod · 0.45

Tested by

no test coverage detected