* Parses the input provided during instance creation. * * @returns The parsed GridSpec or `null` when a parser error occured.
()
| 350 | * @returns The parsed {@link GridSpec} or `null` when a parser error occured. |
| 351 | */ |
| 352 | parse(): GridSpec | null { |
| 353 | try { |
| 354 | this.token = this.scanner.scan(); |
| 355 | |
| 356 | return this.#parseGridSpec(); |
| 357 | } catch (e) { |
| 358 | if (e instanceof LexicalError || e instanceof ParseError) { |
| 359 | console.warn( |
| 360 | `Failed to parse GridSpec. Input: "${this.scanner.input}".`, |
| 361 | `Error: ${e.message}`, |
| 362 | ); |
| 363 | return null; |
| 364 | } |
| 365 | |
| 366 | throw e; |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | #parseGridSpec(): GridSpec { |
| 371 | switch (this.token.kind) { |
no test coverage detected