(parser)
| 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) { |
nothing calls this directly
no test coverage detected