MCPcopy Create free account
hub / github.com/NanoMichael/MicroTeX / firstpass

Method firstpass

src/core/parser.cpp:756–801  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

754}
755
756void TeXParser::firstpass() throw(ex_parse) {
757 if (_len == 0) return;
758
759 wchar_t ch;
760 int spos;
761 vector<wstring> args;
762 while (_pos < _len) {
763 if (replaceScript()) continue;
764
765 ch = _parseString[_pos];
766 switch (ch) {
767 case ESCAPE: {
768 spos = _pos;
769 wstring cmd = getCommand();
770 try {
771 preprocess(cmd, args, spos);
772 } catch (ex_parse& e) {
773 if (!_isPartial) throw;
774 }
775 args.clear();
776 } break;
777 case PERCENT: {
778 spos = _pos++;
779 wchar_t chr;
780 while (_pos < _len) {
781 chr = _parseString[_pos++];
782 if (chr == '\r' || chr == '\n') break;
783 }
784 if (_pos < _len) _pos--;
785 _parseString.replace(spos, _pos - spos, L"");
786 _len = _parseString.length();
787 _pos = spos;
788 } break;
789 case DEGRE: {
790 _parseString.replace(_pos, 1, L"^{\\circ}");
791 _len = _parseString.length();
792 _pos++;
793 } break;
794 default:
795 _pos++;
796 break;
797 }
798 }
799 _pos = 0;
800 _len = _parseString.length();
801}
802
803void TeXParser::parse() throw(ex_parse) {
804 if (_len == 0) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected