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_extern.h"
47 #include "math_factory.h"
48 #include "math_kerninset.h"
49 #include "math_macro.h"
50 #include "math_macrotable.h"
51 #include "math_macrotemplate.h"
52 #include "math_hullinset.h"
53 #include "math_parboxinset.h"
54 #include "math_parinset.h"
55 #include "math_rootinset.h"
56 #include "math_sizeinset.h"
57 #include "math_sqrtinset.h"
58 #include "math_scriptinset.h"
59 #include "math_sqrtinset.h"
60 #include "math_support.h"
61 #include "math_xyarrowinset.h"
63 //#include "insets/insetref.h"
64 #include "ref_inset.h"
68 #include "support/LAssert.h"
69 #include "support/lstrings.h"
90 bool stared(string const & s)
92 string::size_type const n = s.size();
93 return n && s[n - 1] == '*';
97 // These are TeX's catcodes
99 catEscape, // 0 backslash
109 catSpace, // 10 space
110 catLetter, // 11 a-zA-Z
111 catOther, // 12 none of the above
114 catInvalid // 15 <delete>
117 CatCode theCatcode[256];
120 inline CatCode catcode(unsigned char c)
122 return theCatcode[c];
127 FLAG_BRACE_LAST = 1 << 1, // last closing brace ends the parsing
128 FLAG_RIGHT = 1 << 2, // next \\right ends the parsing process
129 FLAG_END = 1 << 3, // next \\end ends the parsing process
130 FLAG_BRACK_LAST = 1 << 4, // next closing bracket ends the parsing
131 FLAG_TEXTMODE = 1 << 5, // we are in a box
132 FLAG_ITEM = 1 << 6, // read a (possibly braced token)
133 FLAG_LEAVE = 1 << 7, // leave the loop at the end
134 FLAG_SIMPLE = 1 << 8, // next $ leaves the loop
135 FLAG_EQUATION = 1 << 9, // next \] leaves the loop
136 FLAG_SIMPLE2 = 1 << 10, // next \) leaves the loop
137 FLAG_OPTION = 1 << 11 // read [...] style option
143 fill(theCatcode, theCatcode + 256, catOther);
144 fill(theCatcode + 'a', theCatcode + 'z' + 1, catLetter);
145 fill(theCatcode + 'A', theCatcode + 'Z' + 1, catLetter);
147 theCatcode['\\'] = catEscape;
148 theCatcode['{'] = catBegin;
149 theCatcode['}'] = catEnd;
150 theCatcode['$'] = catMath;
151 theCatcode['&'] = catAlign;
152 theCatcode['\n'] = catNewline;
153 theCatcode['#'] = catParameter;
154 theCatcode['^'] = catSuper;
155 theCatcode['_'] = catSub;
156 theCatcode['
\7f'] = catIgnore;
157 theCatcode[' '] = catSpace;
158 theCatcode['\t'] = catSpace;
159 theCatcode['\r'] = catSpace;
160 theCatcode['~'] = catActive;
161 theCatcode['%'] = catComment;
167 // Helper class for parsing
173 Token() : cs_(), char_(0), cat_(catIgnore) {}
175 Token(char c, CatCode cat) : cs_(), char_(c), cat_(cat) {}
177 Token(string const & cs) : cs_(cs), char_(0), cat_(catIgnore) {}
180 string const & cs() const { return cs_; }
182 CatCode cat() const { return cat_; }
184 char character() const { return char_; }
186 string asString() const;
199 bool Token::isCR() const
201 return cs_ == "\\" || cs_ == "cr" || cs_ == "crcr";
204 string Token::asString() const
206 return cs_.size() ? cs_ : string(1, char_);
209 ostream & operator<<(ostream & os, Token const & t)
212 os << "\\" << t.cs();
214 os << "[" << t.character() << "," << t.cat() << "]";
223 Parser(LyXLex & lex);
225 Parser(istream & is);
228 bool parse_macro(string & name);
230 bool parse_normal(MathAtom & at);
232 void parse_into(MathArray & array, unsigned flags, bool mathmode);
234 int lineno() const { return lineno_; }
240 void parse_into1(MathGridInset & grid, unsigned flags, bool mathmode, bool numbered);
242 void parse_into2(MathAtom & at, unsigned flags, bool mathmode, bool numbered);
243 /// get arg delimited by 'left' and 'right'
244 string getArg(char left, char right);
248 void error(string const & msg);
249 /// dump contents to screen
254 void tokenize(istream & is);
256 void tokenize(string const & s);
258 void skipSpaceTokens(istream & is, char c);
260 void push_back(Token const & t);
264 Token const & prevToken() const;
266 Token const & nextToken() const;
268 Token const & getToken();
269 /// skips spaces if any
272 void lex(string const & s);
279 vector<Token> tokens_;
285 Parser::Parser(LyXLex & lexer)
286 : lineno_(lexer.getLineNo()), pos_(0)
288 tokenize(lexer.getStream());
293 Parser::Parser(istream & is)
294 : lineno_(0), pos_(0)
300 void Parser::push_back(Token const & t)
302 tokens_.push_back(t);
306 void Parser::pop_back()
312 Token const & Parser::prevToken() const
314 static const Token dummy;
315 return pos_ > 0 ? tokens_[pos_ - 1] : dummy;
319 Token const & Parser::nextToken() const
321 static const Token dummy;
322 return good() ? tokens_[pos_] : dummy;
326 Token const & Parser::getToken()
328 static const Token dummy;
329 //lyxerr << "looking at token " << tokens_[pos_] << " pos: " << pos_ << '\n';
330 return good() ? tokens_[pos_++] : dummy;
334 void Parser::skipSpaces()
336 while (nextToken().cat() == catSpace)
341 void Parser::putback()
347 bool Parser::good() const
349 return pos_ < tokens_.size();
353 char Parser::getChar()
356 error("The input stream is not well...");
357 return tokens_[pos_++].character();
361 string Parser::getArg(char left, char right)
371 while ((c = getChar()) != right && good())
378 void Parser::tokenize(istream & is)
380 // eat everything up to the next \end_inset or end of stream
381 // and store it in s for further tokenization
386 if (s.size() >= 10 && s.substr(s.size() - 10) == "\\end_inset") {
387 s = s.substr(0, s.size() - 10);
397 void Parser::skipSpaceTokens(istream & is, char c)
399 // skip trailing spaces
400 while (catcode(c) == catSpace || catcode(c) == catNewline)
403 //lyxerr << "putting back: " << c << "\n";
408 void Parser::tokenize(string const & buffer)
410 static bool init_done = false;
417 istringstream is(buffer.c_str(), ios::in | ios::binary);
421 //lyxerr << "reading c: " << c << "\n";
423 switch (catcode(c)) {
427 if (catcode(c) == catNewline)
428 ; //push_back(Token("par"));
430 push_back(Token(' ', catSpace));
437 while (is.get(c) && catcode(c) != catNewline)
446 error("unexpected end of input");
449 if (catcode(c) == catLetter) {
451 while (is.get(c) && catcode(c) == catLetter)
453 skipSpaceTokens(is, c);
462 push_back(Token(c, catcode(c)));
464 skipSpaceTokens(is, c);
469 lyxerr << "ignoring a char: " << int(c) << "\n";
474 push_back(Token(c, catcode(c)));
484 void Parser::dump() const
486 lyxerr << "\nTokens: ";
487 for (unsigned i = 0; i < tokens_.size(); ++i) {
490 lyxerr << tokens_[i];
492 lyxerr << " pos: " << pos_ << "\n";
496 void Parser::error(string const & msg)
498 lyxerr << "Line ~" << lineno_ << ": Math parse error: " << msg << endl;
504 bool Parser::parse_macro(string & name)
510 if (nextToken().cs() == "def") {
513 name = getToken().cs();
516 while (good() && nextToken().cat() != catBegin)
517 pars += getToken().cs();
520 error("bad stream in parse_macro\n");
524 //lyxerr << "read \\def parameter list '" << pars << "'\n";
526 error("can't handle non-empty parameter lists\n");
530 } else if (nextToken().cs() == "newcommand") {
534 if (getToken().cat() != catBegin) {
535 error("'{' in \\newcommand expected (1) \n");
539 name = getToken().cs();
541 if (getToken().cat() != catEnd) {
542 error("'}' expected\n");
546 string arg = getArg('[', ']');
548 nargs = atoi(arg.c_str());
551 lyxerr << "\\newcommand or \\def expected\n";
556 if (getToken().cat() != catBegin) {
557 error("'{' in macro definition expected (2)\n");
562 parse_into(ar1, FLAG_BRACE_LAST, true);
564 // we cannot handle recursive stuff at all
566 test.push_back(createMathInset(name));
567 if (ar1.contains(test)) {
568 error("we cannot handle recursive macros at all.\n");
572 // is a version for display attached?
574 parse_into(ar2, FLAG_ITEM, true);
576 MathMacroTable::create(name, nargs, ar1, ar2);
581 bool Parser::parse_normal(MathAtom & at)
585 parse_into(ar, false, false);
586 if (ar.size() != 1 || ar.front()->getType() == "none") {
587 lyxerr << "unusual contents found: " << ar << endl;
588 at.reset(new MathParInset);
592 lyxerr << "unusual contents found: " << ar << endl;
600 void Parser::parse_into(MathArray & array, unsigned flags, bool mathmode)
602 MathGridInset grid(1, 1);
603 parse_into1(grid, flags, mathmode, false);
604 array = grid.cell(0);
608 void Parser::parse_into2(MathAtom & at, unsigned flags,
609 bool mathmode, bool numbered)
611 parse_into1(*(at->asGridInset()), flags, mathmode, numbered);
615 void Parser::parse_into1(MathGridInset & grid, unsigned flags,
616 bool mathmode, bool numbered)
619 MathGridInset::row_type cellrow = 0;
620 MathGridInset::col_type cellcol = 0;
621 MathArray * cell = &grid.cell(grid.index(cellrow, cellcol));
623 if (grid.asHullInset())
624 grid.asHullInset()->numbered(cellrow, numbered);
627 //lyxerr << "grid: " << grid << endl;
630 Token const & t = getToken();
633 lyxerr << "t: " << t << " flags: " << flags << "\n";
638 if (flags & FLAG_ITEM) {
639 if (t.cat() == catSpace)
643 if (t.cat() == catBegin) {
644 // skip the brace and collect everything to the next matching
646 flags |= FLAG_BRACE_LAST;
650 // handle only this single token, leave the loop if done
655 if (flags & FLAG_OPTION) {
656 if (t.cat() == catOther && t.character() == '[') {
657 // skip the bracket and collect everything to the clsing bracket
658 flags |= FLAG_BRACK_LAST;
662 // no option found, put back token and we are done
670 if (t.cat() == catMath) {
672 // we are inside some text mode thingy, so opening new math is allowed
673 Token const & n = getToken();
674 if (n.cat() == catMath) {
675 // TeX's $$...$$ syntax for displayed math
676 cell->push_back(MathAtom(new MathHullInset("equation")));
677 parse_into2(cell->back(), FLAG_SIMPLE, true, false);
678 getToken(); // skip the second '$' token
680 // simple $...$ stuff
682 cell->push_back(MathAtom(new MathHullInset("simple")));
683 parse_into2(cell->back(), FLAG_SIMPLE, true, false);
687 else if (flags & FLAG_SIMPLE) {
688 // this is the end of the formula
693 error("something strange in the parser\n");
698 else if (t.cat() == catLetter)
699 cell->push_back(MathAtom(new MathCharInset(t.character())));
701 else if (t.cat() == catSpace && !mathmode)
702 cell->push_back(MathAtom(new MathCharInset(t.character())));
704 else if (t.cat() == catParameter) {
705 Token const & n = getToken();
706 cell->push_back(MathAtom(new MathMacroArgument(n.character()-'0')));
709 else if (t.cat() == catBegin) {
711 parse_into(ar, FLAG_BRACE_LAST, mathmode);
712 // reduce multiple nesting levels to a single one
713 // this helps to keep the annoyance of "a choose b" to a minimum
714 if (ar.size() && ar.front()->asBraceInset())
715 ar = ar.front()->asBraceInset()->cell(0);
716 cell->push_back(MathAtom(new MathBraceInset));
717 cell->back()->cell(0).swap(ar);
720 else if (t.cat() == catEnd) {
721 if (flags & FLAG_BRACE_LAST)
723 error("found '}' unexpectedly");
725 //add(cell, '}', LM_TC_TEX);
728 else if (t.cat() == catAlign) {
730 //lyxerr << " column now " << cellcol << " max: " << grid.ncols() << "\n";
731 if (cellcol == grid.ncols()) {
732 lyxerr << "adding column " << cellcol << "\n";
733 grid.addCol(cellcol - 1);
735 cell = &grid.cell(grid.index(cellrow, cellcol));
738 else if (t.cat() == catSuper || t.cat() == catSub) {
739 bool up = (t.cat() == catSuper);
740 MathScriptInset * p = 0;
742 p = cell->back()->asScriptInset();
743 if (!p || p->has(up)) {
744 cell->push_back(MathAtom(new MathScriptInset(up)));
745 p = cell->back()->asScriptInset();
748 parse_into(p->cell(up), FLAG_ITEM, mathmode);
753 else if (t.character() == ']' && (flags & FLAG_BRACK_LAST))
756 else if (t.cat() == catOther)
757 cell->push_back(MathAtom(new MathCharInset(t.character())));
762 else if (t.cs() == "(") {
763 cell->push_back(MathAtom(new MathHullInset("simple")));
764 parse_into2(cell->back(), FLAG_SIMPLE2, true, false);
767 else if (t.cs() == "[") {
768 cell->push_back(MathAtom(new MathHullInset("equation")));
769 parse_into2(cell->back(), FLAG_EQUATION, true, false);
772 else if (t.cs() == "protect")
773 // ignore \\protect, will hopefully be re-added during output
776 else if (t.cs() == "end") {
777 if (flags & FLAG_END) {
778 // eat environment name
779 //string const name =
781 // FIXME: check that we ended the correct environment
784 error("found 'end' unexpectedly");
787 else if (t.cs() == ")") {
788 if (flags & FLAG_SIMPLE2)
790 error("found '\\)' unexpectedly");
793 else if (t.cs() == "]") {
794 if (flags & FLAG_EQUATION)
796 error("found '\\]' unexpectedly");
799 else if (t.cs() == "\\") {
800 grid.vcrskip(LyXLength(getArg('[', ']')), cellrow);
803 if (cellrow == grid.nrows())
804 grid.addRow(cellrow - 1);
805 if (grid.asHullInset())
806 grid.asHullInset()->numbered(cellrow, numbered);
807 cell = &grid.cell(grid.index(cellrow, cellcol));
811 else if (t.cs() == "multicolumn") {
812 // extract column count and insert dummy cells
814 parse_into(count, FLAG_ITEM, mathmode);
816 if (!extractNumber(count, cols)) {
817 lyxerr << " can't extract number of cells from " << count << "\n";
819 // resize the table if necessary
820 for (int i = 0; i < cols; ++i) {
822 if (cellcol == grid.ncols()) {
823 lyxerr << "adding column " << cellcol << "\n";
824 grid.addCol(cellcol - 1);
826 cell = &grid.cell(grid.index(cellrow, cellcol));
827 // mark this as dummy
828 grid.cellinfo(grid.index(cellrow, cellcol)).dummy_ = true;
830 // the last cell is the real thng, not a dummy
831 grid.cellinfo(grid.index(cellrow, cellcol)).dummy_ = false;
833 // read special alignment
835 parse_into(align, FLAG_ITEM, mathmode);
836 //grid.cellinfo(grid.index(cellrow, cellcol)).align_ = extractString(align);
838 // parse the remaining contents into the "real" cell
839 parse_into(*cell, FLAG_ITEM, mathmode);
843 else if (t.cs() == "limits")
846 else if (t.cs() == "nolimits")
849 else if (t.cs() == "nonumber") {
850 if (grid.asHullInset())
851 grid.asHullInset()->numbered(cellrow, false);
854 else if (t.cs() == "number") {
855 if (grid.asHullInset())
856 grid.asHullInset()->numbered(cellrow, true);
859 else if (t.cs() == "hline") {
860 if (grid.asHullInset())
861 grid.asHullInset()->rowinfo(cellrow + 1);
864 else if (t.cs() == "sqrt") {
866 parse_into(ar, FLAG_OPTION, mathmode);
868 cell->push_back(MathAtom(new MathRootInset));
869 cell->back()->cell(0) = ar;
870 parse_into(cell->back()->cell(1), FLAG_ITEM, mathmode);
872 cell->push_back(MathAtom(new MathSqrtInset));
873 parse_into(cell->back()->cell(0), FLAG_ITEM, mathmode);
877 else if (t.cs() == "ref") {
878 cell->push_back(MathAtom(new RefInset));
879 parse_into(cell->back()->cell(1), FLAG_OPTION, mathmode);
880 parse_into(cell->back()->cell(0), FLAG_ITEM, mathmode);
883 else if (t.cs() == "left") {
884 string l = getToken().asString();
886 parse_into(ar, FLAG_RIGHT, mathmode);
887 string r = getToken().asString();
888 cell->push_back(MathAtom(new MathDelimInset(l, r, ar)));
891 else if (t.cs() == "right") {
892 if (flags & FLAG_RIGHT)
894 //lyxerr << "got so far: '" << cell << "'\n";
895 error("Unmatched right delimiter");
899 else if (t.cs() == "begin") {
900 string const name = getArg('{', '}');
901 if (name == "array" || name == "subarray") {
902 string const valign = getArg('[', ']') + 'c';
903 string const halign = getArg('{', '}');
904 cell->push_back(MathAtom(new MathArrayInset(name, valign[0], halign)));
905 parse_into2(cell->back(), FLAG_END, mathmode, false);
908 else if (name == "split" || name == "cases" ||
909 name == "gathered" || name == "aligned") {
910 cell->push_back(createMathInset(name));
911 parse_into2(cell->back(), FLAG_END, mathmode, false);
914 else if (name == "math") {
915 cell->push_back(MathAtom(new MathHullInset("simple")));
916 parse_into2(cell->back(), FLAG_SIMPLE, true, true);
919 else if (name == "equation" || name == "equation*"
920 || name == "displaymath") {
921 cell->push_back(MathAtom(new MathHullInset("equation")));
922 parse_into2(cell->back(), FLAG_END, true, (name == "equation"));
925 else if (name == "eqnarray" || name == "eqnarray*") {
926 cell->push_back(MathAtom(new MathHullInset("eqnarray")));
927 parse_into2(cell->back(), FLAG_END, true, !stared(name));
930 else if (name == "align" || name == "align*") {
931 cell->push_back(MathAtom(new MathHullInset("align")));
932 parse_into2(cell->back(), FLAG_END, true, !stared(name));
935 else if (name == "alignat" || name == "alignat*") {
936 // ignore this for a while
938 cell->push_back(MathAtom(new MathHullInset("alignat")));
939 parse_into2(cell->back(), FLAG_END, true, !stared(name));
942 else if (name == "xalignat" || name == "xalignat*") {
943 // ignore this for a while
945 cell->push_back(MathAtom(new MathHullInset("xalignat")));
946 parse_into2(cell->back(), FLAG_END, true, !stared(name));
949 else if (name == "xxalignat") {
950 // ignore this for a while
952 cell->push_back(MathAtom(new MathHullInset("xxalignat")));
953 parse_into2(cell->back(), FLAG_END, true, !stared(name));
956 else if (name == "multline" || name == "multline*") {
957 cell->push_back(MathAtom(new MathHullInset("multline")));
958 parse_into2(cell->back(), FLAG_END, true, !stared(name));
961 else if (name == "gather" || name == "gather*") {
962 cell->push_back(MathAtom(new MathHullInset("gather")));
963 parse_into2(cell->back(), FLAG_END, true, !stared(name));
967 latexkeys const * l = in_word_set(name);
969 if (l->inset == "matrix") {
970 cell->push_back(createMathInset(name));
971 parse_into2(cell->back(), FLAG_END, mathmode, false);
974 lyxerr << "unknow math inset begin '" << name << "'\n";
979 else if (t.cs() == "kern") {
985 Token const & t = getToken();
991 if (isValidLength(s))
994 cell->push_back(MathAtom(new MathKernInset(s)));
997 else if (t.cs() == "label") {
998 if (grid.asHullInset())
999 grid.asHullInset()->label(cellrow, getArg('{', '}'));
1002 else if (t.cs() == "choose" || t.cs() == "over" || t.cs() == "atop") {
1003 MathAtom p = createMathInset(t.cs());
1004 cell->swap(p->cell(0));
1005 parse_into(p->cell(1), flags, mathmode);
1010 else if (t.cs() == "substack") {
1011 cell->push_back(createMathInset(t.cs()));
1012 parse_into2(cell->back(), FLAG_ITEM, mathmode, false);
1015 else if (t.cs() == "xymatrix") {
1016 cell->push_back(createMathInset(t.cs()));
1017 parse_into2(cell->back(), FLAG_ITEM, mathmode, false);
1022 else if (1 && t.cs() == "ar") {
1023 MathXYArrowInset * p = new MathXYArrowInset;
1024 // try to read target
1025 parse_into(p->cell(0), FLAG_OTPTION, mathmode);
1026 // try to read label
1027 if (nextToken().cat() == catSuper || nextToken().cat() == catSub) {
1028 p->up_ = nextToken().cat() == catSuper;
1030 parse_into(p->cell(1), FLAG_ITEM, mathmode);
1031 //lyxerr << "read label: " << p->cell(1) << "\n";
1034 cell->push_back(MathAtom(p));
1035 //lyxerr << "read cell: " << cell << "\n";
1039 else if (t.cs().size()) {
1040 latexkeys const * l = in_word_set(t.cs());
1042 if (l->inset == "font") {
1043 lyxerr << "starting font " << t.cs() << "\n";
1044 MathAtom p = createMathInset(t.cs());
1045 bool textmode = (t.cs()[0] == 't');
1046 parse_into(p->cell(0), FLAG_ITEM, !textmode);
1048 //lyxerr << "ending font\n";
1051 else if (l->inset == "oldfont") {
1052 cell->push_back(createMathInset(t.cs()));
1053 parse_into(cell->back()->cell(0), flags, l->extra == "mathmode");
1057 else if (l->inset == "mbox") {
1058 // switch to text mode
1059 cell->push_back(createMathInset(t.cs()));
1060 parse_into(cell->back()->cell(0), FLAG_ITEM, mathmode);
1063 else if (l->inset == "style") {
1064 cell->push_back(createMathInset(t.cs()));
1065 parse_into(cell->back()->cell(0), flags, mathmode);
1069 else if (l->inset == "parbox") {
1070 // read optional positioning and width
1071 MathArray pos, width;
1072 parse_into(pos, FLAG_OPTION, false);
1073 parse_into(width, FLAG_ITEM, false);
1074 cell->push_back(createMathInset(t.cs()));
1075 parse_into(cell->back()->cell(0), FLAG_ITEM, false);
1076 cell->back()->asParboxInset()->setPosition(asString(pos));
1077 cell->back()->asParboxInset()->setWidth(asString(width));
1081 MathAtom p = createMathInset(t.cs());
1082 for (MathInset::idx_type i = 0; i < p->nargs(); ++i)
1083 parse_into(p->cell(i), FLAG_ITEM, l->extra == "mathmode");
1089 MathAtom p = createMathInset(t.cs());
1090 for (MathInset::idx_type i = 0; i < p->nargs(); ++i)
1091 parse_into(p->cell(i), FLAG_ITEM, mathmode);
1097 if (flags & FLAG_LEAVE) {
1098 flags &= ~FLAG_LEAVE;
1106 } // anonymous namespace
1109 void mathed_parse_cell(MathArray & ar, string const & str)
1111 istringstream is(str.c_str());
1112 mathed_parse_cell(ar, is);
1116 void mathed_parse_cell(MathArray & ar, istream & is)
1118 Parser(is).parse_into(ar, 0, true);
1123 bool mathed_parse_macro(string & name, string const & str)
1125 istringstream is(str.c_str());
1126 return Parser(is).parse_macro(name);
1130 bool mathed_parse_macro(string & name, istream & is)
1132 return Parser(is).parse_macro(name);
1136 bool mathed_parse_macro(string & name, LyXLex & lex)
1138 return Parser(lex).parse_macro(name);
1143 bool mathed_parse_normal(MathAtom & t, string const & str)
1145 istringstream is(str.c_str());
1146 return Parser(is).parse_normal(t);
1150 bool mathed_parse_normal(MathAtom & t, istream & is)
1152 return Parser(is).parse_normal(t);
1156 bool mathed_parse_normal(MathAtom & t, LyXLex & lex)
1158 return Parser(lex).parse_normal(t);