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
253 void tokenize(istream & is);
255 void tokenize(string const & s);
257 void skipSpaceTokens(istream & is, char c);
259 void push_back(Token const & t);
263 Token const & prevToken() const;
265 Token const & nextToken() const;
267 Token const & getToken();
268 /// skips spaces if any
271 void lex(string const & s);
278 vector<Token> tokens_;
284 Parser::Parser(LyXLex & lexer)
285 : lineno_(lexer.getLineNo()), pos_(0)
287 tokenize(lexer.getStream());
292 Parser::Parser(istream & is)
293 : lineno_(0), pos_(0)
299 void Parser::push_back(Token const & t)
301 tokens_.push_back(t);
305 void Parser::pop_back()
311 Token const & Parser::prevToken() const
313 static const Token dummy;
314 return pos_ > 0 ? tokens_[pos_ - 1] : dummy;
318 Token const & Parser::nextToken() const
320 static const Token dummy;
321 return good() ? tokens_[pos_] : dummy;
325 Token const & Parser::getToken()
327 static const Token dummy;
328 //lyxerr << "looking at token " << tokens_[pos_] << " pos: " << pos_ << '\n';
329 return good() ? tokens_[pos_++] : dummy;
333 void Parser::skipSpaces()
335 while (nextToken().cat() == catSpace)
340 void Parser::putback()
346 bool Parser::good() const
348 return pos_ < tokens_.size();
352 char Parser::getChar()
355 error("The input stream is not well...");
356 return tokens_[pos_++].character();
360 string Parser::getArg(char left, char right)
370 while ((c = getChar()) != right && good())
377 void Parser::tokenize(istream & is)
379 // eat everything up to the next \end_inset or end of stream
380 // and store it in s for further tokenization
385 if (s.size() >= 10 && s.substr(s.size() - 10) == "\\end_inset") {
386 s = s.substr(0, s.size() - 10);
396 void Parser::skipSpaceTokens(istream & is, char c)
398 // skip trailing spaces
399 while (catcode(c) == catSpace || catcode(c) == catNewline)
402 //lyxerr << "putting back: " << c << "\n";
407 void Parser::tokenize(string const & buffer)
409 static bool init_done = false;
416 istringstream is(buffer.c_str(), ios::in | ios::binary);
420 //lyxerr << "reading c: " << c << "\n";
422 switch (catcode(c)) {
426 if (catcode(c) == catNewline)
427 ; //push_back(Token("par"));
429 push_back(Token(' ', catSpace));
436 while (is.get(c) && catcode(c) != catNewline)
445 error("unexpected end of input");
448 if (catcode(c) == catLetter) {
450 while (is.get(c) && catcode(c) == catLetter)
452 skipSpaceTokens(is, c);
461 push_back(Token(c, catcode(c)));
463 skipSpaceTokens(is, c);
468 lyxerr << "ignoring a char: " << int(c) << "\n";
473 push_back(Token(c, catcode(c)));
483 void Parser::dump() const
485 lyxerr << "\nTokens: ";
486 for (unsigned i = 0; i < tokens_.size(); ++i) {
489 lyxerr << tokens_[i];
491 lyxerr << " pos: " << pos_ << "\n";
495 void Parser::error(string const & msg)
497 lyxerr << "Line ~" << lineno_ << ": Math parse error: " << msg << endl;
503 bool Parser::parse_macro(string & name)
509 if (nextToken().cs() == "def") {
512 name = getToken().cs();
515 while (good() && nextToken().cat() != catBegin)
516 pars += getToken().cs();
519 error("bad stream in parse_macro\n");
523 //lyxerr << "read \\def parameter list '" << pars << "'\n";
525 error("can't handle non-empty parameter lists\n");
529 } else if (nextToken().cs() == "newcommand") {
531 // skip the 'newcommand'
534 if (getToken().cat() != catBegin) {
535 error("'{' in \\newcommand expected (1) \n");
539 name = getToken().cs();
541 if (getToken().cat() != catEnd) {
542 error("'}' in \\newcommand 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 closing 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 // do not create a BraceInset if they were written by LyX
713 // this helps to keep the annoyance of "a choose b" to a minimum
714 if (ar.size() == 1 && ar[0]->extraBraces())
717 cell->push_back(MathAtom(new MathBraceInset(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));
966 else if (latexkeys const * l = in_word_set(name)) {
967 if (l->inset == "matrix") {
968 cell->push_back(createMathInset(name));
969 parse_into2(cell->back(), FLAG_END, mathmode, false);
974 // lyxerr << "unknow math inset begin '" << name << "'\n";
975 // create generic environment inset
976 cell->push_back(MathAtom(new MathEnvInset(name)));
977 parse_into(cell->back()->cell(0), FLAG_END, mathmode);
981 else if (t.cs() == "kern") {
987 Token const & t = getToken();
993 if (isValidLength(s))
996 cell->push_back(MathAtom(new MathKernInset(s)));
999 else if (t.cs() == "label") {
1001 parse_into(ar, FLAG_ITEM, false);
1002 if (grid.asHullInset()) {
1003 grid.asHullInset()->label(cellrow, asString(ar));
1005 cell->push_back(createMathInset(t.cs()));
1006 cell->push_back(MathAtom(new MathBraceInset(ar)));
1010 else if (t.cs() == "choose" || t.cs() == "over" || t.cs() == "atop") {
1011 MathAtom p = createMathInset(t.cs());
1012 cell->swap(p->cell(0));
1013 parse_into(p->cell(1), flags, mathmode);
1018 else if (t.cs() == "substack") {
1019 cell->push_back(createMathInset(t.cs()));
1020 parse_into2(cell->back(), FLAG_ITEM, mathmode, false);
1023 else if (t.cs() == "xymatrix") {
1024 cell->push_back(createMathInset(t.cs()));
1025 parse_into2(cell->back(), FLAG_ITEM, mathmode, false);
1030 else if (1 && t.cs() == "ar") {
1031 MathXYArrowInset * p = new MathXYArrowInset;
1032 // try to read target
1033 parse_into(p->cell(0), FLAG_OTPTION, mathmode);
1034 // try to read label
1035 if (nextToken().cat() == catSuper || nextToken().cat() == catSub) {
1036 p->up_ = nextToken().cat() == catSuper;
1038 parse_into(p->cell(1), FLAG_ITEM, mathmode);
1039 //lyxerr << "read label: " << p->cell(1) << "\n";
1042 cell->push_back(MathAtom(p));
1043 //lyxerr << "read cell: " << cell << "\n";
1047 else if (t.cs().size()) {
1048 latexkeys const * l = in_word_set(t.cs());
1050 if (l->inset == "font") {
1051 lyxerr << "starting font " << t.cs() << "\n";
1052 MathAtom p = createMathInset(t.cs());
1053 bool textmode = (t.cs()[0] == 't');
1054 parse_into(p->cell(0), FLAG_ITEM, !textmode);
1056 //lyxerr << "ending font\n";
1059 else if (l->inset == "oldfont") {
1060 cell->push_back(createMathInset(t.cs()));
1061 parse_into(cell->back()->cell(0), flags, l->extra == "mathmode");
1065 else if (l->inset == "style") {
1066 cell->push_back(createMathInset(t.cs()));
1067 parse_into(cell->back()->cell(0), flags, mathmode);
1071 else if (l->inset == "parbox") {
1072 // read optional positioning and width
1073 MathArray pos, width;
1074 parse_into(pos, FLAG_OPTION, false);
1075 parse_into(width, FLAG_ITEM, false);
1076 cell->push_back(createMathInset(t.cs()));
1077 parse_into(cell->back()->cell(0), FLAG_ITEM, false);
1078 cell->back()->asParboxInset()->setPosition(asString(pos));
1079 cell->back()->asParboxInset()->setWidth(asString(width));
1083 MathAtom p = createMathInset(t.cs());
1084 for (MathInset::idx_type i = 0; i < p->nargs(); ++i)
1085 parse_into(p->cell(i), FLAG_ITEM, l->extra != "forcetext");
1091 MathAtom p = createMathInset(t.cs());
1092 for (MathInset::idx_type i = 0; i < p->nargs(); ++i)
1093 parse_into(p->cell(i), FLAG_ITEM, mathmode);
1099 if (flags & FLAG_LEAVE) {
1100 flags &= ~FLAG_LEAVE;
1108 } // anonymous namespace
1111 void mathed_parse_cell(MathArray & ar, string const & str)
1113 istringstream is(str.c_str());
1114 mathed_parse_cell(ar, is);
1118 void mathed_parse_cell(MathArray & ar, istream & is)
1120 Parser(is).parse_into(ar, 0, true);
1125 bool mathed_parse_macro(string & name, string const & str)
1127 istringstream is(str.c_str());
1128 return Parser(is).parse_macro(name);
1132 bool mathed_parse_macro(string & name, istream & is)
1134 return Parser(is).parse_macro(name);
1138 bool mathed_parse_macro(string & name, LyXLex & lex)
1140 return Parser(lex).parse_macro(name);
1145 bool mathed_parse_normal(MathAtom & t, string const & str)
1147 istringstream is(str.c_str());
1148 return Parser(is).parse_normal(t);
1152 bool mathed_parse_normal(MathAtom & t, istream & is)
1154 return Parser(is).parse_normal(t);
1158 bool mathed_parse_normal(MathAtom & t, LyXLex & lex)
1160 return Parser(lex).parse_normal(t);