* Parses a group when the mode is changing.
(name, type, optional, greediness)
| 15367 | |
| 15368 | |
| 15369 | parseGroupOfType(name, type, optional, greediness) { |
| 15370 | switch (type) { |
| 15371 | case "color": |
| 15372 | return this.parseColorGroup(optional); |
| 15373 | |
| 15374 | case "size": |
| 15375 | return this.parseSizeGroup(optional); |
| 15376 | |
| 15377 | case "url": |
| 15378 | return this.parseUrlGroup(optional); |
| 15379 | |
| 15380 | case "math": |
| 15381 | case "text": |
| 15382 | return this.parseGroup(name, optional, greediness, undefined, type); |
| 15383 | |
| 15384 | case "raw": |
| 15385 | { |
| 15386 | if (optional && this.nextToken.text === "{") { |
| 15387 | return null; |
| 15388 | } |
| 15389 | |
| 15390 | const token = this.parseStringGroup("raw", optional, true); |
| 15391 | |
| 15392 | if (token) { |
| 15393 | return { |
| 15394 | type: "raw", |
| 15395 | mode: "text", |
| 15396 | string: token.text |
| 15397 | }; |
| 15398 | } else { |
| 15399 | throw new ParseError("Expected raw group", this.nextToken); |
| 15400 | } |
| 15401 | } |
| 15402 | |
| 15403 | case "original": |
| 15404 | case null: |
| 15405 | case undefined: |
| 15406 | return this.parseGroup(name, optional, greediness); |
| 15407 | |
| 15408 | default: |
| 15409 | throw new ParseError("Unknown group type as " + name, this.nextToken); |
| 15410 | } |
| 15411 | } |
| 15412 | |
| 15413 | consumeSpaces() { |
| 15414 | while (this.nextToken.text === " ") { |
no test coverage detected