| 494 | } |
| 495 | |
| 496 | sptr<Atom> TeXParser::processEscape() throw(ex_parse) { |
| 497 | _spos = _pos; |
| 498 | wstring command = getCommand(); |
| 499 | |
| 500 | if (command.length() == 0) return sptr<Atom>(new EmptyAtom()); |
| 501 | |
| 502 | string cmd; |
| 503 | wide2utf8(command.c_str(), cmd); |
| 504 | auto it = MacroInfo::_commands.find(command); |
| 505 | if (it != MacroInfo::_commands.end()) return processCommands(command); |
| 506 | |
| 507 | try { |
| 508 | return TeXFormula::get(command)->_root; |
| 509 | } catch (ex_formula_not_found& e) { |
| 510 | try { |
| 511 | return SymbolAtom::get(cmd); |
| 512 | } catch (ex_symbol_not_found& ex) {} |
| 513 | } |
| 514 | |
| 515 | // not a valid command or symbol or predefined TeXFormula found |
| 516 | if (!_isPartial) |
| 517 | throw ex_parse("Unknown symbol or command or predefined TeXFormula: '" + cmd + "'"); |
| 518 | sptr<Atom> rm(new RomanAtom(TeXFormula(L"\\backslash " + command)._root)); |
| 519 | return sptr<Atom>(new ColorAtom(rm, TRANS, RED)); |
| 520 | } |
| 521 | |
| 522 | sptr<Atom> TeXParser::processCommands(const wstring& command) throw(ex_parse) { |
| 523 | MacroInfo* mac = MacroInfo::_commands[command]; |
nothing calls this directly
no test coverage detected