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