2 \author André Pönitz (2001)
7 If someone desperately needs partial "structures" (such as a few
8 cells of an array inset or similar) (s)he could uses the
9 following hack as starting point to write some macros:
14 \def\makeamptab{\catcode`\&=4\relax}
15 \def\makeampletter{\catcode`\&=11\relax}
16 \def\b{\makeampletter\expandafter\makeamptab\bi}
36 #pragma implementation
39 #include "math_parser.h"
40 #include "math_inset.h"
41 #include "math_arrayinset.h"
42 #include "math_braceinset.h"
43 #include "math_boxinset.h"
44 #include "math_charinset.h"
45 #include "math_deliminset.h"
46 #include "math_envinset.h"
47 #include "math_extern.h"
48 #include "math_factory.h"
49 #include "math_kerninset.h"
50 #include "math_macro.h"
51 #include "math_macrotable.h"
52 #include "math_macrotemplate.h"
53 #include "math_hullinset.h"
54 #include "math_parboxinset.h"
55 #include "math_parinset.h"
56 #include "math_rootinset.h"
57 #include "math_sizeinset.h"
58 #include "math_sqrtinset.h"
59 #include "math_scriptinset.h"
60 #include "math_sqrtinset.h"
61 #include "math_support.h"
62 #include "math_xyarrowinset.h"
64 //#include "insets/insetref.h"
65 #include "ref_inset.h"
69 #include "support/LAssert.h"
70 #include "support/lstrings.h"
91 bool stared(string const & s)
93 string::size_type const n = s.size();
94 return n && s[n - 1] == '*';
98 // These are TeX's catcodes
100 catEscape, // 0 backslash
110 catSpace, // 10 space
111 catLetter, // 11 a-zA-Z
112 catOther, // 12 none of the above
115 catInvalid // 15 <delete>
118 CatCode theCatcode[256];
121 inline CatCode catcode(unsigned char c)
123 return theCatcode[c];
128 FLAG_BRACE_LAST = 1 << 1, // last closing brace ends the parsing
129 FLAG_RIGHT = 1 << 2, // next \\right ends the parsing process
130 FLAG_END = 1 << 3, // next \\end ends the parsing process
131 FLAG_BRACK_LAST = 1 << 4, // next closing bracket ends the parsing
132 FLAG_TEXTMODE = 1 << 5, // we are in a box
133 FLAG_ITEM = 1 << 6, // read a (possibly braced token)
134 FLAG_LEAVE = 1 << 7, // leave the loop at the end
135 FLAG_SIMPLE = 1 << 8, // next $ leaves the loop
136 FLAG_EQUATION = 1 << 9, // next \] leaves the loop
137 FLAG_SIMPLE2 = 1 << 10, // next \) leaves the loop
138 FLAG_OPTION = 1 << 11 // read [...] style option
144 fill(theCatcode, theCatcode + 256, catOther);
145 fill(theCatcode + 'a', theCatcode + 'z' + 1, catLetter);
146 fill(theCatcode + 'A', theCatcode + 'Z' + 1, catLetter);
148 theCatcode['\\'] = catEscape;
149 theCatcode['{'] = catBegin;
150 theCatcode['}'] = catEnd;
151 theCatcode['$'] = catMath;
152 theCatcode['&'] = catAlign;
153 theCatcode['\n'] = catNewline;
154 theCatcode['#'] = catParameter;
155 theCatcode['^'] = catSuper;
156 theCatcode['_'] = catSub;
157 theCatcode['
\7f'] = catIgnore;
158 theCatcode[' '] = catSpace;
159 theCatcode['\t'] = catSpace;
160 theCatcode['\r'] = catSpace;
161 theCatcode['~'] = catActive;
162 theCatcode['%'] = catComment;
168 // Helper class for parsing
174 Token() : cs_(), char_(0), cat_(catIgnore) {}
176 Token(char c, CatCode cat) : cs_(), char_(c), cat_(cat) {}
178 Token(string const & cs) : cs_(cs), char_(0), cat_(catIgnore) {}
181 string const & cs() const { return cs_; }
183 CatCode cat() const { return cat_; }
185 char character() const { return char_; }
187 string asString() const;
200 bool Token::isCR() const
202 return cs_ == "\\" || cs_ == "cr" || cs_ == "crcr";
205 string Token::asString() const
207 return cs_.size() ? cs_ : string(1, char_);
210 ostream & operator<<(ostream & os, Token const & t)
213 os << "\\" << t.cs();
215 os << "[" << t.character() << "," << t.cat() << "]";
224 Parser(LyXLex & lex);
226 Parser(istream & is);
229 bool parse_macro(string & name);
231 bool parse_normal(MathAtom & at);
233 void parse_into(MathArray & array, unsigned flags, bool mathmode);
235 int lineno() const { return lineno_; }
241 void parse_into1(MathGridInset & grid, unsigned flags, bool mathmode, bool numbered);
243 void parse_into2(MathAtom & at, unsigned flags, bool mathmode, bool numbered);
244 /// get arg delimited by 'left' and 'right'
245 string getArg(char left, char right);
249 void error(string const & msg);
250 /// dump contents to screen
255 void tokenize(istream & is);
257 void tokenize(string const & s);
259 void skipSpaceTokens(istream & is, char c);
261 void push_back(Token const & t);
265 Token const & prevToken() const;
267 Token const & nextToken() const;
269 Token const & getToken();
270 /// skips spaces if any
273 void lex(string const & s);
280 vector<Token> tokens_;
286 Parser::Parser(LyXLex & lexer)
287 : lineno_(lexer.getLineNo()), pos_(0)
289 tokenize(lexer.getStream());
294 Parser::Parser(istream & is)
295 : lineno_(0), pos_(0)
301 void Parser::push_back(Token const & t)
303 tokens_.push_back(t);
307 void Parser::pop_back()
313 Token const & Parser::prevToken() const
315 static const Token dummy;
316 return pos_ > 0 ? tokens_[pos_ - 1] : dummy;
320 Token const & Parser::nextToken() const
322 static const Token dummy;
323 return good() ? tokens_[pos_] : dummy;
327 Token const & Parser::getToken()
329 static const Token dummy;
330 //lyxerr << "looking at token " << tokens_[pos_] << " pos: " << pos_ << '\n';
331 return good() ? tokens_[pos_++] : dummy;
335 void Parser::skipSpaces()
337 while (nextToken().cat() == catSpace)
342 void Parser::putback()
348 bool Parser::good() const
350 return pos_ < tokens_.size();
354 char Parser::getChar()
357 error("The input stream is not well...");
358 return tokens_[pos_++].character();
362 string Parser::getArg(char left, char right)
372 while ((c = getChar()) != right && good())
379 void Parser::tokenize(istream & is)
381 // eat everything up to the next \end_inset or end of stream
382 // and store it in s for further tokenization
387 if (s.size() >= 10 && s.substr(s.size() - 10) == "\\end_inset") {
388 s = s.substr(0, s.size() - 10);
398 void Parser::skipSpaceTokens(istream & is, char c)
400 // skip trailing spaces
401 while (catcode(c) == catSpace || catcode(c) == catNewline)
404 //lyxerr << "putting back: " << c << "\n";
409 void Parser::tokenize(string const & buffer)
411 static bool init_done = false;
418 istringstream is(buffer.c_str(), ios::in | ios::binary);
422 //lyxerr << "reading c: " << c << "\n";
424 switch (catcode(c)) {
428 if (catcode(c) == catNewline)
429 ; //push_back(Token("par"));
431 push_back(Token(' ', catSpace));
438 while (is.get(c) && catcode(c) != catNewline)
447 error("unexpected end of input");
450 if (catcode(c) == catLetter) {
452 while (is.get(c) && catcode(c) == catLetter)
454 skipSpaceTokens(is, c);
463 push_back(Token(c, catcode(c)));
465 skipSpaceTokens(is, c);
470 lyxerr << "ignoring a char: " << int(c) << "\n";
475 push_back(Token(c, catcode(c)));
485 void Parser::dump() const
487 lyxerr << "\nTokens: ";
488 for (unsigned i = 0; i < tokens_.size(); ++i) {
491 lyxerr << tokens_[i];
493 lyxerr << " pos: " << pos_ << "\n";
497 void Parser::error(string const & msg)
499 lyxerr << "Line ~" << lineno_ << ": Math parse error: " << msg << endl;
505 bool Parser::parse_macro(string & name)
511 if (nextToken().cs() == "def") {
514 name = getToken().cs();
517 while (good() && nextToken().cat() != catBegin)
518 pars += getToken().cs();
521 error("bad stream in parse_macro\n");
525 //lyxerr << "read \\def parameter list '" << pars << "'\n";
527 error("can't handle non-empty parameter lists\n");
531 } else if (nextToken().cs() == "newcommand") {
533 // skip the 'newcommand'
536 if (getToken().cat() != catBegin) {
537 error("'{' in \\newcommand expected (1) \n");
541 name = getToken().cs();
543 if (getToken().cat() != catEnd) {
544 error("'}' in \\newcommand expected\n");
548 string arg = getArg('[', ']');
550 nargs = atoi(arg.c_str());
553 lyxerr << "\\newcommand or \\def expected\n";
558 if (getToken().cat() != catBegin) {
559 error("'{' in macro definition expected (2)\n");
564 parse_into(ar1, FLAG_BRACE_LAST, true);
566 // we cannot handle recursive stuff at all
568 test.push_back(createMathInset(name));
569 if (ar1.contains(test)) {
570 error("we cannot handle recursive macros at all.\n");
574 // is a version for display attached?
576 parse_into(ar2, FLAG_ITEM, true);
578 MathMacroTable::create(name, nargs, ar1, ar2);
583 bool Parser::parse_normal(MathAtom & at)
587 parse_into(ar, false, false);
588 if (ar.size() != 1 || ar.front()->getType() == "none") {
589 lyxerr << "unusual contents found: " << ar << endl;
590 at.reset(new MathParInset);
594 lyxerr << "unusual contents found: " << ar << endl;
602 void Parser::parse_into(MathArray & array, unsigned flags, bool mathmode)
604 MathGridInset grid(1, 1);
605 parse_into1(grid, flags, mathmode, false);
606 array = grid.cell(0);
610 void Parser::parse_into2(MathAtom & at, unsigned flags,
611 bool mathmode, bool numbered)
613 parse_into1(*(at->asGridInset()), flags, mathmode, numbered);
617 void Parser::parse_into1(MathGridInset & grid, unsigned flags,
618 bool mathmode, bool numbered)
621 MathGridInset::row_type cellrow = 0;
622 MathGridInset::col_type cellcol = 0;
623 MathArray * cell = &grid.cell(grid.index(cellrow, cellcol));
625 if (grid.asHullInset())
626 grid.asHullInset()->numbered(cellrow, numbered);
629 //lyxerr << "grid: " << grid << endl;
632 Token const & t = getToken();
635 lyxerr << "t: " << t << " flags: " << flags << "\n";
640 if (flags & FLAG_ITEM) {
641 if (t.cat() == catSpace)
645 if (t.cat() == catBegin) {
646 // skip the brace and collect everything to the next matching
648 flags |= FLAG_BRACE_LAST;
652 // handle only this single token, leave the loop if done
657 if (flags & FLAG_OPTION) {
658 if (t.cat() == catOther && t.character() == '[') {
659 // skip the bracket and collect everything to the clsing bracket
660 flags |= FLAG_BRACK_LAST;
664 // no option found, put back token and we are done
672 if (t.cat() == catMath) {
674 // we are inside some text mode thingy, so opening new math is allowed
675 Token const & n = getToken();
676 if (n.cat() == catMath) {
677 // TeX's $$...$$ syntax for displayed math
678 cell->push_back(MathAtom(new MathHullInset("equation")));
679 parse_into2(cell->back(), FLAG_SIMPLE, true, false);
680 getToken(); // skip the second '$' token
682 // simple $...$ stuff
684 cell->push_back(MathAtom(new MathHullInset("simple")));
685 parse_into2(cell->back(), FLAG_SIMPLE, true, false);
689 else if (flags & FLAG_SIMPLE) {
690 // this is the end of the formula
695 error("something strange in the parser\n");
700 else if (t.cat() == catLetter)
701 cell->push_back(MathAtom(new MathCharInset(t.character())));
703 else if (t.cat() == catSpace && !mathmode)
704 cell->push_back(MathAtom(new MathCharInset(t.character())));
706 else if (t.cat() == catParameter) {
707 Token const & n = getToken();
708 cell->push_back(MathAtom(new MathMacroArgument(n.character()-'0')));
711 else if (t.cat() == catBegin) {
713 parse_into(ar, FLAG_BRACE_LAST, mathmode);
714 // do not create a BraceInset if they were written by LyX
715 // this helps to keep the annoyance of "a choose b" to a minimum
716 if (ar.size() == 1 && ar[0]->extraBraces()) {
719 cell->push_back(MathAtom(new MathBraceInset));
720 cell->back()->cell(0).swap(ar);
724 else if (t.cat() == catEnd) {
725 if (flags & FLAG_BRACE_LAST)
727 error("found '}' unexpectedly");
729 //add(cell, '}', LM_TC_TEX);
732 else if (t.cat() == catAlign) {
734 //lyxerr << " column now " << cellcol << " max: " << grid.ncols() << "\n";
735 if (cellcol == grid.ncols()) {
736 lyxerr << "adding column " << cellcol << "\n";
737 grid.addCol(cellcol - 1);
739 cell = &grid.cell(grid.index(cellrow, cellcol));
742 else if (t.cat() == catSuper || t.cat() == catSub) {
743 bool up = (t.cat() == catSuper);
744 MathScriptInset * p = 0;
746 p = cell->back()->asScriptInset();
747 if (!p || p->has(up)) {
748 cell->push_back(MathAtom(new MathScriptInset(up)));
749 p = cell->back()->asScriptInset();
752 parse_into(p->cell(up), FLAG_ITEM, mathmode);
757 else if (t.character() == ']' && (flags & FLAG_BRACK_LAST))
760 else if (t.cat() == catOther)
761 cell->push_back(MathAtom(new MathCharInset(t.character())));
766 else if (t.cs() == "(") {
767 cell->push_back(MathAtom(new MathHullInset("simple")));
768 parse_into2(cell->back(), FLAG_SIMPLE2, true, false);
771 else if (t.cs() == "[") {
772 cell->push_back(MathAtom(new MathHullInset("equation")));
773 parse_into2(cell->back(), FLAG_EQUATION, true, false);
776 else if (t.cs() == "protect")
777 // ignore \\protect, will hopefully be re-added during output
780 else if (t.cs() == "end") {
781 if (flags & FLAG_END) {
782 // eat environment name
783 //string const name =
785 // FIXME: check that we ended the correct environment
788 error("found 'end' unexpectedly");
791 else if (t.cs() == ")") {
792 if (flags & FLAG_SIMPLE2)
794 error("found '\\)' unexpectedly");
797 else if (t.cs() == "]") {
798 if (flags & FLAG_EQUATION)
800 error("found '\\]' unexpectedly");
803 else if (t.cs() == "\\") {
804 grid.vcrskip(LyXLength(getArg('[', ']')), cellrow);
807 if (cellrow == grid.nrows())
808 grid.addRow(cellrow - 1);
809 if (grid.asHullInset())
810 grid.asHullInset()->numbered(cellrow, numbered);
811 cell = &grid.cell(grid.index(cellrow, cellcol));
815 else if (t.cs() == "multicolumn") {
816 // extract column count and insert dummy cells
818 parse_into(count, FLAG_ITEM, mathmode);
820 if (!extractNumber(count, cols)) {
821 lyxerr << " can't extract number of cells from " << count << "\n";
823 // resize the table if necessary
824 for (int i = 0; i < cols; ++i) {
826 if (cellcol == grid.ncols()) {
827 lyxerr << "adding column " << cellcol << "\n";
828 grid.addCol(cellcol - 1);
830 cell = &grid.cell(grid.index(cellrow, cellcol));
831 // mark this as dummy
832 grid.cellinfo(grid.index(cellrow, cellcol)).dummy_ = true;
834 // the last cell is the real thng, not a dummy
835 grid.cellinfo(grid.index(cellrow, cellcol)).dummy_ = false;
837 // read special alignment
839 parse_into(align, FLAG_ITEM, mathmode);
840 //grid.cellinfo(grid.index(cellrow, cellcol)).align_ = extractString(align);
842 // parse the remaining contents into the "real" cell
843 parse_into(*cell, FLAG_ITEM, mathmode);
847 else if (t.cs() == "limits")
850 else if (t.cs() == "nolimits")
853 else if (t.cs() == "nonumber") {
854 if (grid.asHullInset())
855 grid.asHullInset()->numbered(cellrow, false);
858 else if (t.cs() == "number") {
859 if (grid.asHullInset())
860 grid.asHullInset()->numbered(cellrow, true);
863 else if (t.cs() == "hline") {
864 if (grid.asHullInset())
865 grid.asHullInset()->rowinfo(cellrow + 1);
868 else if (t.cs() == "sqrt") {
870 parse_into(ar, FLAG_OPTION, mathmode);
872 cell->push_back(MathAtom(new MathRootInset));
873 cell->back()->cell(0) = ar;
874 parse_into(cell->back()->cell(1), FLAG_ITEM, mathmode);
876 cell->push_back(MathAtom(new MathSqrtInset));
877 parse_into(cell->back()->cell(0), FLAG_ITEM, mathmode);
881 else if (t.cs() == "ref") {
882 cell->push_back(MathAtom(new RefInset));
883 parse_into(cell->back()->cell(1), FLAG_OPTION, mathmode);
884 parse_into(cell->back()->cell(0), FLAG_ITEM, mathmode);
887 else if (t.cs() == "left") {
888 string l = getToken().asString();
890 parse_into(ar, FLAG_RIGHT, mathmode);
891 string r = getToken().asString();
892 cell->push_back(MathAtom(new MathDelimInset(l, r, ar)));
895 else if (t.cs() == "right") {
896 if (flags & FLAG_RIGHT)
898 //lyxerr << "got so far: '" << cell << "'\n";
899 error("Unmatched right delimiter");
903 else if (t.cs() == "begin") {
904 string const name = getArg('{', '}');
905 if (name == "array" || name == "subarray") {
906 string const valign = getArg('[', ']') + 'c';
907 string const halign = getArg('{', '}');
908 cell->push_back(MathAtom(new MathArrayInset(name, valign[0], halign)));
909 parse_into2(cell->back(), FLAG_END, mathmode, false);
912 else if (name == "split" || name == "cases" ||
913 name == "gathered" || name == "aligned") {
914 cell->push_back(createMathInset(name));
915 parse_into2(cell->back(), FLAG_END, mathmode, false);
918 else if (name == "math") {
919 cell->push_back(MathAtom(new MathHullInset("simple")));
920 parse_into2(cell->back(), FLAG_SIMPLE, true, true);
923 else if (name == "equation" || name == "equation*"
924 || name == "displaymath") {
925 cell->push_back(MathAtom(new MathHullInset("equation")));
926 parse_into2(cell->back(), FLAG_END, true, (name == "equation"));
929 else if (name == "eqnarray" || name == "eqnarray*") {
930 cell->push_back(MathAtom(new MathHullInset("eqnarray")));
931 parse_into2(cell->back(), FLAG_END, true, !stared(name));
934 else if (name == "align" || name == "align*") {
935 cell->push_back(MathAtom(new MathHullInset("align")));
936 parse_into2(cell->back(), FLAG_END, true, !stared(name));
939 else if (name == "alignat" || name == "alignat*") {
940 // ignore this for a while
942 cell->push_back(MathAtom(new MathHullInset("alignat")));
943 parse_into2(cell->back(), FLAG_END, true, !stared(name));
946 else if (name == "xalignat" || name == "xalignat*") {
947 // ignore this for a while
949 cell->push_back(MathAtom(new MathHullInset("xalignat")));
950 parse_into2(cell->back(), FLAG_END, true, !stared(name));
953 else if (name == "xxalignat") {
954 // ignore this for a while
956 cell->push_back(MathAtom(new MathHullInset("xxalignat")));
957 parse_into2(cell->back(), FLAG_END, true, !stared(name));
960 else if (name == "multline" || name == "multline*") {
961 cell->push_back(MathAtom(new MathHullInset("multline")));
962 parse_into2(cell->back(), FLAG_END, true, !stared(name));
965 else if (name == "gather" || name == "gather*") {
966 cell->push_back(MathAtom(new MathHullInset("gather")));
967 parse_into2(cell->back(), FLAG_END, true, !stared(name));
970 else if (latexkeys const * l = in_word_set(name)) {
971 if (l->inset == "matrix") {
972 cell->push_back(createMathInset(name));
973 parse_into2(cell->back(), FLAG_END, mathmode, false);
978 // lyxerr << "unknow math inset begin '" << name << "'\n";
979 // create generic environment inset
980 cell->push_back(MathAtom(new MathEnvInset(name)));
981 parse_into(cell->back()->cell(0), FLAG_END, mathmode);
985 else if (t.cs() == "kern") {
991 Token const & t = getToken();
997 if (isValidLength(s))
1000 cell->push_back(MathAtom(new MathKernInset(s)));
1003 else if (t.cs() == "label") {
1004 if (grid.asHullInset())
1005 grid.asHullInset()->label(cellrow, getArg('{', '}'));
1008 else if (t.cs() == "choose" || t.cs() == "over" || t.cs() == "atop") {
1009 MathAtom p = createMathInset(t.cs());
1010 cell->swap(p->cell(0));
1011 parse_into(p->cell(1), flags, mathmode);
1016 else if (t.cs() == "substack") {
1017 cell->push_back(createMathInset(t.cs()));
1018 parse_into2(cell->back(), FLAG_ITEM, mathmode, false);
1021 else if (t.cs() == "xymatrix") {
1022 cell->push_back(createMathInset(t.cs()));
1023 parse_into2(cell->back(), FLAG_ITEM, mathmode, false);
1028 else if (1 && t.cs() == "ar") {
1029 MathXYArrowInset * p = new MathXYArrowInset;
1030 // try to read target
1031 parse_into(p->cell(0), FLAG_OTPTION, mathmode);
1032 // try to read label
1033 if (nextToken().cat() == catSuper || nextToken().cat() == catSub) {
1034 p->up_ = nextToken().cat() == catSuper;
1036 parse_into(p->cell(1), FLAG_ITEM, mathmode);
1037 //lyxerr << "read label: " << p->cell(1) << "\n";
1040 cell->push_back(MathAtom(p));
1041 //lyxerr << "read cell: " << cell << "\n";
1045 else if (t.cs().size()) {
1046 latexkeys const * l = in_word_set(t.cs());
1048 if (l->inset == "font") {
1049 lyxerr << "starting font " << t.cs() << "\n";
1050 MathAtom p = createMathInset(t.cs());
1051 bool textmode = (t.cs()[0] == 't');
1052 parse_into(p->cell(0), FLAG_ITEM, !textmode);
1054 //lyxerr << "ending font\n";
1057 else if (l->inset == "oldfont") {
1058 cell->push_back(createMathInset(t.cs()));
1059 parse_into(cell->back()->cell(0), flags, l->extra == "mathmode");
1063 else if (l->inset == "mbox") {
1064 // switch to text mode
1065 cell->push_back(createMathInset(t.cs()));
1066 parse_into(cell->back()->cell(0), FLAG_ITEM, mathmode);
1069 else if (l->inset == "style") {
1070 cell->push_back(createMathInset(t.cs()));
1071 parse_into(cell->back()->cell(0), flags, mathmode);
1075 else if (l->inset == "parbox") {
1076 // read optional positioning and width
1077 MathArray pos, width;
1078 parse_into(pos, FLAG_OPTION, false);
1079 parse_into(width, FLAG_ITEM, false);
1080 cell->push_back(createMathInset(t.cs()));
1081 parse_into(cell->back()->cell(0), FLAG_ITEM, false);
1082 cell->back()->asParboxInset()->setPosition(asString(pos));
1083 cell->back()->asParboxInset()->setWidth(asString(width));
1087 MathAtom p = createMathInset(t.cs());
1088 for (MathInset::idx_type i = 0; i < p->nargs(); ++i)
1089 parse_into(p->cell(i), FLAG_ITEM, l->extra == "mathmode");
1095 MathAtom p = createMathInset(t.cs());
1096 for (MathInset::idx_type i = 0; i < p->nargs(); ++i)
1097 parse_into(p->cell(i), FLAG_ITEM, mathmode);
1103 if (flags & FLAG_LEAVE) {
1104 flags &= ~FLAG_LEAVE;
1112 } // anonymous namespace
1115 void mathed_parse_cell(MathArray & ar, string const & str)
1117 istringstream is(str.c_str());
1118 mathed_parse_cell(ar, is);
1122 void mathed_parse_cell(MathArray & ar, istream & is)
1124 Parser(is).parse_into(ar, 0, true);
1129 bool mathed_parse_macro(string & name, string const & str)
1131 istringstream is(str.c_str());
1132 return Parser(is).parse_macro(name);
1136 bool mathed_parse_macro(string & name, istream & is)
1138 return Parser(is).parse_macro(name);
1142 bool mathed_parse_macro(string & name, LyXLex & lex)
1144 return Parser(lex).parse_macro(name);
1149 bool mathed_parse_normal(MathAtom & t, string const & str)
1151 istringstream is(str.c_str());
1152 return Parser(is).parse_normal(t);
1156 bool mathed_parse_normal(MathAtom & t, istream & is)
1158 return Parser(is).parse_normal(t);
1162 bool mathed_parse_normal(MathAtom & t, LyXLex & lex)
1164 return Parser(lex).parse_normal(t);