()
| 380 | } |
| 381 | |
| 382 | #parseColRowSpec(): GridSpec { |
| 383 | switch (this.token.kind) { |
| 384 | case Literal.Keyword: |
| 385 | const mode = this.token.raw; |
| 386 | if (mode !== "cols" && mode !== "rows") { |
| 387 | break; |
| 388 | } |
| 389 | |
| 390 | this.accept(); |
| 391 | this.accept({ kind: Literal.LParen }); |
| 392 | |
| 393 | const cells: GridCellSpec[] = []; |
| 394 | do { |
| 395 | cells.push(this.#parseCellSpec()); |
| 396 | } while (this.acceptIf(Literal.Separator)); |
| 397 | |
| 398 | this.accept({ kind: Literal.RParen }); |
| 399 | |
| 400 | return { mode, cells }; |
| 401 | } |
| 402 | |
| 403 | throw new ParseError(`Unexpected token "${this.token.raw}" ` + |
| 404 | `(type: ${this.token.kind}) at pos ${this.token.position}.`); |
| 405 | } |
| 406 | |
| 407 | #parseCellSpec(): GridCellSpec { |
| 408 | const weight = this.#parseNumber(); |
no test coverage detected