(parser: Parser)
| 3173 | |
| 3174 | this.index = start; |
| 3175 | return null; |
| 3176 | } |
| 3177 | |
| 3178 | /** |
| 3179 | * Parse an ASCII double-quoted string literal, e.g. `"hello"`, into a |
| 3180 | * MathJSON string. The content is read verbatim up to the closing quote, |
| 3181 | * with LaTeX commands normalized to Unicode (e.g. `"\alpha"` → `α`), matching |
| 3182 | * `\text{…}`. There is no escaping — a `"` cannot appear inside the string |
| 3183 | * (use `\text{…}` for content containing a quote). An unterminated string is |
| 3184 | * an error. |
| 3185 | * |
| 3186 | * Note: a `"` inside `\unicode{…}` / `\char` is a hex prefix consumed by the |
| 3187 | * number parser on a separate path, so it is unaffected by this. |
| 3188 | */ |
| 3189 | parseDoubleQuoteString(): MathJsonExpression | null { |
| 3190 | if (this.peek !== '"') return null; |
| 3191 | const start = this.index; |
| 3192 | this.nextToken(); // Consume the opening `"` |
| 3193 | this.addBoundary(['"']); |
| 3194 | const s = this.parseStringGroupContent(); |
| 3195 | if (!this.matchBoundary()) { |
| 3196 | this.removeBoundary(); |
| 3197 | return this.error('expected-closing-delimiter', start); |
| 3198 | } |
no test coverage detected