* Expect and consume a keyword at current scanner position.
(keyword: string)
| 235 | * Expect and consume a keyword at current scanner position. |
| 236 | */ |
| 237 | private expectKeyword(keyword: string): void { |
| 238 | // Skip any whitespace first |
| 239 | this.skipWhitespace(); |
| 240 | |
| 241 | for (let i = 0; i < keyword.length; i++) { |
| 242 | const byte = this.scanner.peek(); |
| 243 | |
| 244 | if (byte !== keyword.charCodeAt(i)) { |
| 245 | throw new ObjectParseError(`Expected keyword "${keyword}"`); |
| 246 | } |
| 247 | |
| 248 | this.scanner.advance(); |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | /** |
| 253 | * Skip whitespace characters. |
no test coverage detected