| 386 | } |
| 387 | |
| 388 | wstring TeXParser::forwardFromCurrentPos() { |
| 389 | if (_group == 0) { |
| 390 | const wstring& sub = _parseString.substr(_pos); |
| 391 | finish(); |
| 392 | return sub; |
| 393 | } |
| 394 | int closing = _group; |
| 395 | auto i = _parseString.length() - 1; |
| 396 | for (; i >= _pos; i--) { |
| 397 | auto ch = _parseString[i]; |
| 398 | if (ch == R_GROUP) { |
| 399 | closing--; |
| 400 | if (closing == 0) break; |
| 401 | } |
| 402 | } |
| 403 | if (closing != 0) { |
| 404 | throw ex_parse( |
| 405 | "Found a closing '" + |
| 406 | tostring((char)R_GROUP) + |
| 407 | "' without an opening '" + tostring((char)L_GROUP) + "'!"); |
| 408 | } |
| 409 | const wstring& sub = _parseString.substr(_pos, i - _pos); |
| 410 | _pos = i; |
| 411 | return sub; |
| 412 | } |
| 413 | |
| 414 | void TeXParser::getOptsArgs(int nbArgs, int opts, _out_ vector<wstring>& args) { |
| 415 | /* |