* Handle a subscript or superscript with nice errors.
(
name: string, // For error reporting.
)
| 283 | * Handle a subscript or superscript with nice errors. |
| 284 | */ |
| 285 | handleSupSubscript( |
| 286 | name: string, // For error reporting. |
| 287 | ): AnyParseNode { |
| 288 | const symbolToken = this.fetch(); |
| 289 | const symbol = symbolToken.text; |
| 290 | this.consume(); |
| 291 | this.consumeSpaces(); // ignore spaces before sup/subscript argument |
| 292 | |
| 293 | // Skip over allowed internal nodes such as \relax |
| 294 | let group: AnyParseNode | null | undefined; |
| 295 | do { |
| 296 | group = this.parseGroup(name); |
| 297 | } while (group?.type === "internal"); |
| 298 | |
| 299 | if (!group) { |
| 300 | throw new ParseError( |
| 301 | "Expected group after '" + symbol + "'", |
| 302 | symbolToken |
| 303 | ); |
| 304 | } |
| 305 | |
| 306 | return group; |
| 307 | } |
| 308 | |
| 309 | /** |
| 310 | * Converts the textual input of an unsupported command into a text node |
no test coverage detected