3 * Purpose: Parser for mathed
4 * Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
5 * Created: January 1996
6 * Description: Parse LaTeX2e math mode code.
8 * Dependencies: Xlib, XForms
10 * Copyright: 1996, Alejandro Aguilar Sierra
14 * You are free to use and modify this code under the terms of
15 * the GNU General Public Licence version 2 or later.
20 If someone desperately needs partial "structures" (such as a few cells of
21 an array inset or similar) (s)he could uses the following hack as starting
22 point to write some macros:
27 \def\makeamptab{\catcode`\&=4\relax}
28 \def\makeampletter{\catcode`\&=11\relax}
29 \def\b{\makeampletter\expandafter\makeamptab\bi}
49 #pragma implementation
52 #include "math_parser.h"
53 #include "math_inset.h"
54 #include "math_arrayinset.h"
55 #include "math_braceinset.h"
56 #include "math_casesinset.h"
57 #include "math_charinset.h"
58 #include "math_deliminset.h"
59 #include "math_factory.h"
60 #include "math_funcinset.h"
61 #include "math_kerninset.h"
62 #include "math_macro.h"
63 #include "math_macrotable.h"
64 #include "math_macrotemplate.h"
65 #include "math_hullinset.h"
66 #include "math_rootinset.h"
67 #include "math_sizeinset.h"
68 #include "math_sqrtinset.h"
69 #include "math_scriptinset.h"
70 #include "math_specialcharinset.h"
71 #include "math_splitinset.h"
72 #include "math_sqrtinset.h"
73 #include "math_support.h"
78 #include "support/lstrings.h"
94 bool stared(string const & s)
96 string::size_type const n = s.size();
97 return n && s[n - 1] == '*';
101 void add(MathArray & ar, char c, MathTextCodes code)
103 ar.push_back(MathAtom(new MathCharInset(c, code)));
107 // These are TeX's catcodes
109 catEscape, // 0 backslash
119 catSpace, // 10 space
120 catLetter, // 11 a-zA-Z
121 catOther, // 12 none of the above
124 catInvalid // 15 <delete>
127 CatCode theCatcode[256];
130 inline CatCode catcode(unsigned char c)
132 return theCatcode[c];
137 FLAG_BRACE_LAST = 1 << 1, // last closing brace ends the parsing process
138 FLAG_RIGHT = 1 << 2, // next \\right ends the parsing process
139 FLAG_END = 1 << 3, // next \\end ends the parsing process
140 FLAG_BRACK_END = 1 << 4, // next closing bracket ends the parsing process
141 FLAG_BOX = 1 << 5, // we are in a box
142 FLAG_ITEM = 1 << 6, // read a (possibly braced token)
143 FLAG_BLOCK = 1 << 7, // next block ends the parsing process
144 FLAG_BLOCK2 = 1 << 8, // next block2 ends the parsing process
145 FLAG_LEAVE = 1 << 9 // leave the loop at the end
151 fill(theCatcode, theCatcode + 256, catOther);
152 fill(theCatcode + 'a', theCatcode + 'z' + 1, catLetter);
153 fill(theCatcode + 'A', theCatcode + 'Z' + 1, catLetter);
155 theCatcode['\\'] = catEscape;
156 theCatcode['{'] = catBegin;
157 theCatcode['}'] = catEnd;
158 theCatcode['$'] = catMath;
159 theCatcode['&'] = catAlign;
160 theCatcode['\n'] = catNewline;
161 theCatcode['#'] = catParameter;
162 theCatcode['^'] = catSuper;
163 theCatcode['_'] = catSub;
164 theCatcode['
\7f'] = catIgnore;
165 theCatcode[' '] = catSpace;
166 theCatcode['\t'] = catSpace;
167 theCatcode['\r'] = catSpace;
168 theCatcode['~'] = catActive;
169 theCatcode['%'] = catComment;
175 // Helper class for parsing
181 Token() : cs_(), char_(0), cat_(catIgnore) {}
183 Token(char c, CatCode cat) : cs_(), char_(c), cat_(cat) {}
185 Token(string const & cs) : cs_(cs), char_(0), cat_(catIgnore) {}
188 string const & cs() const { return cs_; }
190 CatCode cat() const { return cat_; }
192 char character() const { return char_; }
194 string asString() const;
207 bool Token::isCR() const
209 return cs_ == "\\" || cs_ == "cr" || cs_ == "crcr";
212 string Token::asString() const
214 return cs_.size() ? cs_ : string(1, char_);
217 // Angus' compiler says these are not needed
218 //bool operator==(Token const & s, Token const & t)
220 // return s.character() == t.character()
221 // && s.cat() == t.cat() && s.cs() == t.cs();
224 //bool operator!=(Token const & s, Token const & t)
229 ostream & operator<<(ostream & os, Token const & t)
232 os << "\\" << t.cs();
234 os << "[" << t.character() << "," << t.cat() << "]";
243 Parser(LyXLex & lex);
245 Parser(istream & is);
248 bool parse_macro(string & name);
250 bool parse_normal(MathAtom &);
252 void parse_into(MathArray & array, unsigned flags, MathTextCodes = LM_TC_MIN);
254 int lineno() const { return lineno_; }
260 void parse_into1(MathArray & array, unsigned flags, MathTextCodes);
262 string getArg(char lf, char rf);
266 void error(string const & msg);
268 bool parse_lines(MathAtom & t, bool numbered, bool outmost);
269 /// parses {... & ... \\ ... & ... }
270 bool parse_lines2(MathAtom & t);
274 void tokenize(istream & is);
276 void tokenize(string const & s);
278 void push_back(Token const & t);
282 Token const & prevToken() const;
284 Token const & nextToken() const;
286 Token const & getToken();
287 /// skips spaces if any
289 /// skips opening brace
291 /// skips closing brace
293 /// counts a sequence of hlines
296 void lex(string const & s);
303 std::vector<Token> tokens_;
315 Parser::Parser(LyXLex & lexer)
316 : lineno_(lexer.getLineNo()), pos_(0), curr_num_(false)
318 tokenize(lexer.getStream());
323 Parser::Parser(istream & is)
324 : lineno_(0), pos_(0), curr_num_(false)
330 void Parser::push_back(Token const & t)
332 tokens_.push_back(t);
336 void Parser::pop_back()
342 Token const & Parser::prevToken() const
344 static const Token dummy;
345 return pos_ > 0 ? tokens_[pos_ - 1] : dummy;
349 Token const & Parser::nextToken() const
351 static const Token dummy;
352 return good() ? tokens_[pos_] : dummy;
356 Token const & Parser::getToken()
358 static const Token dummy;
359 //lyxerr << "looking at token " << tokens_[pos_] << '\n';
360 return good() ? tokens_[pos_++] : dummy;
364 void Parser::skipSpaces()
366 while (nextToken().cat() == catSpace)
371 void Parser::skipBegin()
373 if (nextToken().cat() == catBegin)
376 lyxerr << "'{' expected\n";
380 void Parser::skipEnd()
382 if (nextToken().cat() == catEnd)
385 lyxerr << "'}' expected\n";
389 int Parser::readHLines()
393 while (nextToken().cs() == "hline") {
402 void Parser::putback()
408 bool Parser::good() const
410 return pos_ < tokens_.size();
414 char Parser::getChar()
417 lyxerr << "The input stream is not well..." << endl;
418 return tokens_[pos_++].character();
422 string Parser::getArg(char lf, char rg)
430 while ((c = getChar()) != rg && good())
437 void Parser::tokenize(istream & is)
439 // eat everything up to the next \end_inset or end of stream
440 // and store it in s for further tokenization
445 if (s.size() >= 10 && s.substr(s.size() - 10) == "\\end_inset") {
446 s = s.substr(0, s.size() - 10);
456 void Parser::tokenize(string const & buffer)
458 static bool init_done = false;
465 istringstream is(buffer.c_str(), ios::in | ios::binary);
470 switch (catcode(c)) {
474 if (catcode(c) == catNewline)
475 ; //push_back(Token("par"));
477 push_back(Token(' ', catSpace));
484 while (is.get(c) && catcode(c) != catNewline)
493 if (catcode(c) == catLetter) {
494 while (is.get(c) && catcode(c) == catLetter)
496 if (catcode(c) == catSpace)
497 while (is.get(c) && catcode(c) == catSpace)
506 push_back(Token(c, catcode(c)));
511 lyxerr << "\nTokens: ";
512 for (unsigned i = 0; i < tokens_.size(); ++i)
513 lyxerr << tokens_[i];
519 void Parser::error(string const & msg)
521 lyxerr << "Line ~" << lineno_ << ": Math parse error: " << msg << endl;
527 bool Parser::parse_lines(MathAtom & t, bool numbered, bool outmost)
529 MathGridInset * p = t->asGridInset();
531 lyxerr << "error in Parser::parse_lines() 1\n";
535 // save global variables
536 bool const saved_num = curr_num_;
537 string const saved_label = curr_label_;
539 // read initial hlines
540 p->rowinfo(0).lines_ = readHLines();
542 for (int row = 0; true; ++row) {
543 // reset global variables
544 curr_num_ = numbered;
548 for (MathInset::col_type col = 0; col < p->ncols(); ++col) {
549 //lyxerr << "reading cell " << row << " " << col << "\n";
551 MathArray & ar = p->cell(col + row * p->ncols());
552 parse_into(ar, FLAG_BLOCK);
553 // remove 'unnecessary' braces:
554 if (ar.size() == 1 && ar.back()->asBraceInset())
555 ar = ar.back()->asBraceInset()->cell(0);
557 // break if cell is not followed by an ampersand
558 if (nextToken().cat() != catAlign) {
559 //lyxerr << "less cells read than normal in row/col: "
560 // << row << " " << col << "\n";
564 // skip the ampersand
569 MathHullInset * m = t->asHullInset();
571 lyxerr << "error in Parser::parse_lines() 2\n";
574 m->numbered(row, curr_num_);
575 m->label(row, curr_label_);
576 if (curr_skip_.size()) {
577 m->vcrskip(LyXLength(curr_skip_), row);
583 if (nextToken().isCR()) {
587 // try to read a length
590 // read hlines for next row
591 p->rowinfo(row + 1).lines_ = readHLines();
594 // we are finished if the next token is an 'end'
595 if (nextToken().cs() == "end") {
596 // skip the end-token
600 // leave the 'read a line'-loop
604 // otherwise, we have to start a new row
608 // restore "global" variables
609 curr_num_ = saved_num;
610 curr_label_ = saved_label;
616 bool Parser::parse_lines2(MathAtom & t)
618 MathGridInset * p = t->asGridInset();
620 lyxerr << "error in Parser::parse_lines() 1\n";
626 for (int row = 0; true; ++row) {
628 for (MathInset::col_type col = 0; true; ++col) {
629 //lyxerr << "reading cell " << row << " " << col << " " << p->ncols() << "\n";
631 if (col >= p->ncols()) {
632 //lyxerr << "adding col " << col << "\n";
633 p->addCol(p->ncols());
636 parse_into(p->cell(col + row * p->ncols()), FLAG_BLOCK2);
637 //lyxerr << "read cell: " << p->cell(col + row * p->ncols()) << "\n";
639 // break if cell is not followed by an ampersand
640 if (nextToken().cat() != catAlign) {
641 //lyxerr << "less cells read than normal in row/col: " << row << " " << col << "\n";
645 // skip the ampersand
650 if (nextToken().isCR()) {
655 // we are finished if the next token is an '}'
656 if (nextToken().cat() == catEnd) {
657 // skip the end-token
659 // leave the 'read a line'-loop
663 // otherwise, we have to start a new row
672 bool Parser::parse_macro(string & name)
677 if (getToken().cs() != "newcommand") {
678 lyxerr << "\\newcommand expected\n";
682 if (getToken().cat() != catBegin) {
683 lyxerr << "'{' in \\newcommand expected (1)\n";
687 name = getToken().cs();
689 if (getToken().cat() != catEnd) {
690 lyxerr << "'}' expected\n";
694 string arg = getArg('[', ']');
695 int narg = arg.empty() ? 0 : atoi(arg.c_str());
697 if (getToken().cat() != catBegin) {
698 lyxerr << "'{' in \\newcommand expected (2)\n";
703 parse_into(ar, FLAG_BRACE_LAST);
705 // we cannot handle recursive stuff at all
707 test.push_back(createMathInset(name));
708 if (ar.contains(test)) {
709 lyxerr << "we cannot handle recursive macros at all.\n";
713 MathMacroTable::create(name, narg, ar);
718 bool Parser::parse_normal(MathAtom & matrix)
721 Token const & t = getToken();
724 matrix = MathAtom(new MathHullInset(LM_OT_SIMPLE));
725 parse_into(matrix->cell(0), 0);
729 if (t.cat() == catMath) {
730 Token const & n = getToken();
731 if (n.cat() == catMath) {
732 // TeX's $$...$$ syntax for displayed math
733 matrix = MathAtom(new MathHullInset(LM_OT_EQUATION));
734 MathHullInset * p = matrix->asHullInset();
735 parse_into(p->cell(0), 0);
736 p->numbered(0, curr_num_);
737 p->label(0, curr_label_);
739 // simple $...$ stuff
741 matrix = MathAtom(new MathHullInset(LM_OT_SIMPLE));
742 parse_into(matrix->cell(0), 0);
747 if (!t.cs().size()) {
748 lyxerr << "start of math expected, got '" << t << "'\n";
752 string const & cs = t.cs();
757 matrix = MathAtom(new MathHullInset(LM_OT_EQUATION));
758 MathHullInset * p = matrix->asHullInset();
759 parse_into(p->cell(0), 0);
760 p->numbered(0, curr_num_);
761 p->label(0, curr_label_);
766 lyxerr << "'begin' of un-simple math expected, got '" << cs << "'\n";
770 string const name = getArg('{', '}');
772 if (name == "math") {
773 matrix = MathAtom(new MathHullInset(LM_OT_SIMPLE));
774 parse_into(matrix->cell(0), 0);
778 if (name == "equation" || name == "equation*" || name == "displaymath") {
779 curr_num_ = (name == "equation");
781 matrix = MathAtom(new MathHullInset(LM_OT_EQUATION));
782 MathHullInset * p = matrix->asHullInset();
783 parse_into(p->cell(0), FLAG_END);
784 p->numbered(0, curr_num_);
785 p->label(0, curr_label_);
789 if (name == "eqnarray" || name == "eqnarray*") {
790 matrix = MathAtom(new MathHullInset(LM_OT_EQNARRAY));
791 return parse_lines(matrix, !stared(name), true);
794 if (name == "align" || name == "align*") {
795 matrix = MathAtom(new MathHullInset(LM_OT_ALIGN));
796 return parse_lines(matrix, !stared(name), true);
799 if (name == "alignat" || name == "alignat*") {
800 int nc = 2 * atoi(getArg('{', '}').c_str());
801 matrix = MathAtom(new MathHullInset(LM_OT_ALIGNAT, nc));
802 return parse_lines(matrix, !stared(name), true);
805 if (name == "xalignat" || name == "xalignat*") {
806 int nc = 2 * atoi(getArg('{', '}').c_str());
807 matrix = MathAtom(new MathHullInset(LM_OT_XALIGNAT, nc));
808 return parse_lines(matrix, !stared(name), true);
811 if (name == "xxalignat") {
812 int nc = 2 * atoi(getArg('{', '}').c_str());
813 matrix = MathAtom(new MathHullInset(LM_OT_XXALIGNAT, nc));
814 return parse_lines(matrix, !stared(name), true);
817 if (name == "multline" || name == "multline*") {
818 matrix = MathAtom(new MathHullInset(LM_OT_MULTLINE));
819 return parse_lines(matrix, !stared(name), true);
822 if (name == "gather" || name == "gather*") {
823 matrix = MathAtom(new MathHullInset(LM_OT_GATHER));
824 return parse_lines(matrix, !stared(name), true);
827 lyxerr[Debug::MATHED] << "1: unknown math environment: " << name << "\n";
828 lyxerr << "1: unknown math environment: " << name << "\n";
833 void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
835 parse_into1(array, flags, code);
836 // remove 'unnecessary' braces:
837 if (array.size() == 1 && array.back()->asBraceInset())
838 array = array.back()->asBraceInset()->cell(0);
842 void Parser::parse_into1(MathArray & array, unsigned flags, MathTextCodes code)
848 Token const & t = getToken();
850 //lyxerr << "t: " << t << " flags: " << flags << "\n";
851 //array.dump(lyxerr);
854 if (flags & FLAG_ITEM) {
856 if (t.cat() == catBegin) {
857 // skip the brace and collect everything to the next matching
859 flags |= FLAG_BRACE_LAST;
862 // handle only this single token, leave the loop if done
867 if (flags & FLAG_BLOCK) {
868 if (t.cat() == catAlign || t.isCR() || t.cs() == "end") {
874 if (flags & FLAG_BLOCK2) {
875 if (t.cat() == catAlign || t.isCR() || t.cs() == "end"
876 || t.cat() == catEnd) {
885 if (t.cat() == catMath) {
886 if (flags & FLAG_BOX) {
887 // we are inside an mbox, so opening new math is allowed
888 array.push_back(MathAtom(new MathHullInset(LM_OT_SIMPLE)));
889 parse_into(array.back()->cell(0), 0);
891 // otherwise this is the end of the formula
896 else if (t.cat() == catLetter)
897 add(array, t.character(), code);
899 else if (t.cat() == catSpace && code == LM_TC_TEXTRM)
900 add(array, t.character(), code);
902 else if (t.cat() == catParameter) {
903 Token const & n = getToken();
904 array.push_back(MathAtom(new MathMacroArgument(n.character()-'0', code)));
907 else if (t.cat() == catBegin) {
909 parse_into(ar, FLAG_BRACE_LAST);
910 #ifndef WITH_WARNINGS
911 #warning this might be wrong in general!
913 // ignore braces around simple items
914 if ((ar.size() == 1 && !ar.front()->needsBraces()
915 || (ar.size() == 2 && !ar.front()->needsBraces()
916 && ar.back()->asScriptInset()))
917 || (ar.size() == 0 && array.size() == 0))
921 array.push_back(MathAtom(new MathBraceInset));
922 array.back()->cell(0).swap(ar);
926 else if (t.cat() == catEnd) {
927 if (flags & FLAG_BRACE_LAST)
929 lyxerr << "found '}' unexpectedly, array: '" << array << "'\n";
930 //lyxerr << "found '}' unexpectedly\n";
931 add(array, '}', LM_TC_TEX);
934 else if (t.cat() == catAlign) {
935 lyxerr << "found tab unexpectedly, array: '" << array << "'\n";
936 //lyxerr << "found tab unexpectedly\n";
937 add(array, '&', LM_TC_TEX);
940 else if (t.cat() == catSuper || t.cat() == catSub) {
941 bool up = (t.cat() == catSuper);
942 MathScriptInset * p = 0;
944 p = array.back()->asScriptInset();
945 if (!p || p->has(up)) {
946 array.push_back(MathAtom(new MathScriptInset(up)));
947 p = array.back()->asScriptInset();
950 parse_into(p->cell(up), FLAG_ITEM);
955 else if (t.character() == ']' && (flags & FLAG_BRACK_END))
958 else if (t.cat() == catOther)
959 add(array, t.character(), code);
964 else if (t.cs() == "protect")
965 // ignore \\protect, will be re-added during output
968 else if (t.cs() == "end")
971 else if (t.cs() == ")")
974 else if (t.cs() == "]")
977 else if (t.cs() == "\\") {
978 curr_skip_ = getArg('[', ']');
979 //lyxerr << "found newline unexpectedly, array: '" << array << "'\n";
980 lyxerr << "found newline unexpectedly\n";
981 array.push_back(createMathInset("\\"));
984 else if (t.cs() == "limits")
987 else if (t.cs() == "nolimits")
990 else if (t.cs() == "nonumber")
993 else if (t.cs() == "number")
996 else if (t.cs() == "sqrt") {
999 array.push_back(MathAtom(new MathRootInset));
1000 parse_into(array.back()->cell(0), FLAG_BRACK_END);
1001 parse_into(array.back()->cell(1), FLAG_ITEM);
1004 array.push_back(MathAtom(new MathSqrtInset));
1005 parse_into(array.back()->cell(0), FLAG_ITEM);
1009 else if (t.cs() == "left") {
1010 string l = getToken().asString();
1012 parse_into(ar, FLAG_RIGHT);
1013 string r = getToken().asString();
1014 MathAtom dl(new MathDelimInset(l, r));
1016 array.push_back(dl);
1019 else if (t.cs() == "right") {
1020 if (!(flags & FLAG_RIGHT)) {
1021 //lyxerr << "got so far: '" << array << "'\n";
1022 error("Unmatched right delimiter");
1027 else if (t.cs() == "begin") {
1028 string const name = getArg('{', '}');
1029 if (name == "array") {
1030 string const valign = getArg('[', ']') + 'c';
1031 string const halign = getArg('{', '}');
1032 array.push_back(MathAtom(new MathArrayInset(valign[0], halign)));
1033 parse_lines(array.back(), false, false);
1034 } else if (name == "split") {
1035 array.push_back(MathAtom(new MathSplitInset(1)));
1036 parse_lines(array.back(), false, false);
1037 } else if (name == "cases") {
1038 array.push_back(MathAtom(new MathCasesInset));
1039 parse_lines(array.back(), false, false);
1041 lyxerr << "unknow math inset begin '" << name << "'\n";
1044 else if (t.cs() == "kern") {
1045 #ifdef WITH_WARNINGS
1050 Token const & t = getToken();
1056 if (isValidLength(s))
1059 array.push_back(MathAtom(new MathKernInset(s)));
1062 else if (t.cs() == "label") {
1063 curr_label_ = getArg('{', '}');
1066 else if (t.cs() == "choose" || t.cs() == "over" || t.cs() == "atop") {
1067 MathAtom p = createMathInset(t.cs());
1068 array.swap(p->cell(0));
1069 parse_into(p->cell(1), flags, code);
1074 else if (t.cs() == "xymatrix") {
1075 array.push_back(createMathInset(t.cs()));
1076 parse_lines2(array.back());
1081 else if (0 && t.cs() == "ar") {
1082 array.push_back(createMathInset(t.cs()));
1083 parse_lines2(array.back());
1086 else if (t.cs() == "mbox") {
1087 array.push_back(createMathInset(t.cs()));
1088 // slurp in the argument of mbox
1090 MathBoxInset * p = array.back()->asBoxInset();
1096 else if (t.cs().size()) {
1097 latexkeys const * l = in_word_set(t.cs());
1099 if (l->token == LM_TK_FONT) {
1100 //lyxerr << "starting font\n";
1101 //CatCode catSpaceSave = theCatcode[' '];
1102 //if (l->id == LM_TC_TEXTRM) {
1103 // // temporarily change catcode
1104 // theCatcode[' '] = catLetter;
1108 parse_into(ar, FLAG_ITEM, static_cast<MathTextCodes>(l->id));
1109 array.push_back(ar);
1111 // undo catcode changes
1112 ////theCatcode[' '] = catSpaceSave;
1113 //lyxerr << "ending font\n";
1116 else if (l->token == LM_TK_OLDFONT) {
1117 code = static_cast<MathTextCodes>(l->id);
1120 else if (l->token == LM_TK_BOX) {
1121 MathAtom p = createMathInset(t.cs());
1122 parse_into(p->cell(0), FLAG_ITEM | FLAG_BOX, LM_TC_BOX);
1126 else if (l->token == LM_TK_STY) {
1127 MathAtom p = createMathInset(t.cs());
1128 parse_into(p->cell(0), flags, code);
1134 MathAtom p = createMathInset(t.cs());
1135 for (MathInset::idx_type i = 0; i < p->nargs(); ++i)
1136 parse_into(p->cell(i), FLAG_ITEM);
1142 MathAtom p = createMathInset(t.cs());
1143 for (MathInset::idx_type i = 0; i < p->nargs(); ++i)
1144 parse_into(p->cell(i), FLAG_ITEM);
1150 if (flags & FLAG_LEAVE) {
1151 flags &= ~FLAG_LEAVE;
1157 lyxerr << " Math Panic, expect problems!\n";
1158 // Search for the end command.
1162 } while (good() && t.cs() != "end");
1168 } // anonymous namespace
1171 void mathed_parse_cell(MathArray & ar, string const & str)
1173 istringstream is(str.c_str());
1174 mathed_parse_cell(ar, is);
1178 void mathed_parse_cell(MathArray & ar, istream & is)
1180 Parser(is).parse_into(ar, 0);
1185 bool mathed_parse_macro(string & name, string const & str)
1187 istringstream is(str.c_str());
1189 return parser.parse_macro(name);
1192 bool mathed_parse_macro(string & name, istream & is)
1195 return parser.parse_macro(name);
1198 bool mathed_parse_macro(string & name, LyXLex & lex)
1201 return parser.parse_macro(name);
1206 bool mathed_parse_normal(MathAtom & t, string const & str)
1208 istringstream is(str.c_str());
1210 return parser.parse_normal(t);
1213 bool mathed_parse_normal(MathAtom & t, istream & is)
1216 return parser.parse_normal(t);
1219 bool mathed_parse_normal(MathAtom & t, LyXLex & lex)
1222 return parser.parse_normal(t);