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_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"
88 bool stared(string const & s)
90 string::size_type const n = s.size();
91 return n && s[n - 1] == '*';
95 // These are TeX's catcodes
97 catEscape, // 0 backslash
107 catSpace, // 10 space
108 catLetter, // 11 a-zA-Z
109 catOther, // 12 none of the above
112 catInvalid // 15 <delete>
115 CatCode theCatcode[256];
118 inline CatCode catcode(unsigned char c)
120 return theCatcode[c];
125 FLAG_BRACE_LAST = 1 << 1, // last closing brace ends the parsing
126 FLAG_RIGHT = 1 << 2, // next \\right ends the parsing process
127 FLAG_END = 1 << 3, // next \\end ends the parsing process
128 FLAG_BRACK_LAST = 1 << 4, // next closing bracket ends the parsing
129 FLAG_TEXTMODE = 1 << 5, // we are in a box
130 FLAG_ITEM = 1 << 6, // read a (possibly braced token)
131 FLAG_LEAVE = 1 << 7, // leave the loop at the end
132 FLAG_SIMPLE = 1 << 8, // next $ leaves the loop
133 FLAG_EQUATION = 1 << 9, // next \] leaves the loop
134 FLAG_SIMPLE2 = 1 << 10, // next \) leaves the loop
135 FLAG_OPTION = 1 << 11 // read [...] style option
141 fill(theCatcode, theCatcode + 256, catOther);
142 fill(theCatcode + 'a', theCatcode + 'z' + 1, catLetter);
143 fill(theCatcode + 'A', theCatcode + 'Z' + 1, catLetter);
145 theCatcode['\\'] = catEscape;
146 theCatcode['{'] = catBegin;
147 theCatcode['}'] = catEnd;
148 theCatcode['$'] = catMath;
149 theCatcode['&'] = catAlign;
150 theCatcode['\n'] = catNewline;
151 theCatcode['#'] = catParameter;
152 theCatcode['^'] = catSuper;
153 theCatcode['_'] = catSub;
154 theCatcode['
\7f'] = catIgnore;
155 theCatcode[' '] = catSpace;
156 theCatcode['\t'] = catSpace;
157 theCatcode['\r'] = catNewline;
158 theCatcode['~'] = catActive;
159 theCatcode['%'] = catComment;
165 // Helper class for parsing
171 Token() : cs_(), char_(0), cat_(catIgnore) {}
173 Token(char c, CatCode cat) : cs_(), char_(c), cat_(cat) {}
175 Token(string const & cs) : cs_(cs), char_(0), cat_(catIgnore) {}
178 string const & cs() const { return cs_; }
180 CatCode cat() const { return cat_; }
182 char character() const { return char_; }
184 string asString() const;
195 string Token::asString() const
197 return cs_.size() ? cs_ : string(1, char_);
200 ostream & operator<<(ostream & os, Token const & t)
203 os << "\\" << t.cs();
205 os << "[" << t.character() << "," << t.cat() << "]";
214 Parser(LyXLex & lex);
216 Parser(istream & is);
219 bool parse(MathAtom & at);
221 void parse(MathArray & array, unsigned flags, bool mathmode);
223 int lineno() const { return lineno_; }
229 void parse1(MathGridInset & grid, unsigned flags, bool mathmode, bool numbered);
231 void parse2(MathAtom & at, unsigned flags, bool mathmode, bool numbered);
232 /// get arg delimited by 'left' and 'right'
233 string getArg(char left, char right);
237 void error(string const & msg);
238 /// dump contents to screen
241 void tokenize(istream & is);
243 void tokenize(string const & s);
245 void skipSpaceTokens(istream & is, char c);
247 void push_back(Token const & t);
251 Token const & prevToken() const;
253 Token const & nextToken() const;
255 Token const & getToken();
256 /// skips spaces if any
259 void lex(string const & s);
266 vector<Token> tokens_;
272 Parser::Parser(LyXLex & lexer)
273 : lineno_(lexer.getLineNo()), pos_(0)
275 tokenize(lexer.getStream());
280 Parser::Parser(istream & is)
281 : lineno_(0), pos_(0)
287 void Parser::push_back(Token const & t)
289 tokens_.push_back(t);
293 void Parser::pop_back()
299 Token const & Parser::prevToken() const
301 static const Token dummy;
302 return pos_ > 0 ? tokens_[pos_ - 1] : dummy;
306 Token const & Parser::nextToken() const
308 static const Token dummy;
309 return good() ? tokens_[pos_] : dummy;
313 Token const & Parser::getToken()
315 static const Token dummy;
316 //lyxerr << "looking at token " << tokens_[pos_] << " pos: " << pos_ << '\n';
317 return good() ? tokens_[pos_++] : dummy;
321 void Parser::skipSpaces()
323 while (nextToken().cat() == catSpace || nextToken().cat() == catNewline)
328 void Parser::putback()
334 bool Parser::good() const
336 return pos_ < tokens_.size();
340 char Parser::getChar()
343 error("The input stream is not well...");
344 return tokens_[pos_++].character();
348 string Parser::getArg(char left, char right)
358 while ((c = getChar()) != right && good())
365 void Parser::skipSpaceTokens(istream & is, char c)
367 // skip trailing spaces
368 while (catcode(c) == catSpace || catcode(c) == catNewline)
371 //lyxerr << "putting back: " << c << "\n";
376 void Parser::tokenize(istream & is)
378 // eat everything up to the next \end_inset or end of stream
379 // and store it in s for further tokenization
384 if (s.size() >= 10 && s.substr(s.size() - 10) == "\\end_inset") {
385 s = s.substr(0, s.size() - 10);
395 void Parser::tokenize(string const & buffer)
397 static bool init_done = false;
404 istringstream is(buffer.c_str(), ios::in | ios::binary);
408 //lyxerr << "reading c: " << c << "\n";
410 switch (catcode(c)) {
414 if (catcode(c) == catNewline)
415 ; //push_back(Token("par"));
417 push_back(Token('\n', catNewline));
424 while (is.get(c) && catcode(c) != catNewline)
433 error("unexpected end of input");
436 if (catcode(c) == catLetter) {
438 while (is.get(c) && catcode(c) == catLetter)
440 skipSpaceTokens(is, c);
449 push_back(Token(c, catcode(c)));
451 skipSpaceTokens(is, c);
456 lyxerr << "ignoring a char: " << int(c) << "\n";
461 push_back(Token(c, catcode(c)));
471 void Parser::dump() const
473 lyxerr << "\nTokens: ";
474 for (unsigned i = 0; i < tokens_.size(); ++i) {
477 lyxerr << tokens_[i];
479 lyxerr << " pos: " << pos_ << "\n";
483 void Parser::error(string const & msg)
485 lyxerr << "Line ~" << lineno_ << ": Math parse error: " << msg << endl;
491 bool Parser::parse(MathAtom & at)
495 parse(ar, false, false);
496 if (ar.size() != 1 || ar.front()->getType() == "none") {
497 lyxerr << "unusual contents found: " << ar << endl;
498 at.reset(new MathParInset);
502 lyxerr << "unusual contents found: " << ar << endl;
510 void Parser::parse(MathArray & array, unsigned flags, bool mathmode)
512 MathGridInset grid(1, 1);
513 parse1(grid, flags, mathmode, false);
514 array = grid.cell(0);
518 void Parser::parse2(MathAtom & at, unsigned flags,
519 bool mathmode, bool numbered)
521 parse1(*(at->asGridInset()), flags, mathmode, numbered);
525 void Parser::parse1(MathGridInset & grid, unsigned flags,
526 bool mathmode, bool numbered)
529 MathGridInset::row_type cellrow = 0;
530 MathGridInset::col_type cellcol = 0;
531 MathArray * cell = &grid.cell(grid.index(cellrow, cellcol));
533 if (grid.asHullInset())
534 grid.asHullInset()->numbered(cellrow, numbered);
537 //lyxerr << "grid: " << grid << endl;
540 Token const & t = getToken();
543 lyxerr << "t: " << t << " flags: " << flags << "\n";
548 if (flags & FLAG_ITEM) {
549 if (t.cat() == catSpace)
553 if (t.cat() == catBegin) {
554 // skip the brace and collect everything to the next matching
556 flags |= FLAG_BRACE_LAST;
560 // handle only this single token, leave the loop if done
565 if (flags & FLAG_OPTION) {
566 if (t.cat() == catOther && t.character() == '[') {
568 parse(ar, FLAG_BRACK_LAST, mathmode);
571 // no option found, put back token and we are done
580 if (t.cat() == catMath) {
582 // we are inside some text mode thingy, so opening new math is allowed
583 Token const & n = getToken();
584 if (n.cat() == catMath) {
585 // TeX's $$...$$ syntax for displayed math
586 cell->push_back(MathAtom(new MathHullInset("equation")));
587 parse2(cell->back(), FLAG_SIMPLE, true, false);
588 getToken(); // skip the second '$' token
590 // simple $...$ stuff
592 cell->push_back(MathAtom(new MathHullInset("simple")));
593 parse2(cell->back(), FLAG_SIMPLE, true, false);
597 else if (flags & FLAG_SIMPLE) {
598 // this is the end of the formula
603 error("something strange in the parser\n");
608 else if (t.cat() == catLetter)
609 cell->push_back(MathAtom(new MathCharInset(t.character())));
611 else if (t.cat() == catSpace && !mathmode)
612 cell->push_back(MathAtom(new MathCharInset(t.character())));
614 else if (t.cat() == catNewline && !mathmode)
615 cell->push_back(MathAtom(new MathCharInset(t.character())));
617 else if (t.cat() == catParameter) {
618 Token const & n = getToken();
619 cell->push_back(MathAtom(new MathMacroArgument(n.character()-'0')));
622 else if (t.cat() == catActive)
623 cell->push_back(MathAtom(new MathCharInset(t.character())));
625 else if (t.cat() == catBegin) {
627 parse(ar, FLAG_BRACE_LAST, mathmode);
628 // do not create a BraceInset if they were written by LyX
629 // this helps to keep the annoyance of "a choose b" to a minimum
630 if (ar.size() == 1 && ar[0]->extraBraces())
633 cell->push_back(MathAtom(new MathBraceInset(ar)));
636 else if (t.cat() == catEnd) {
637 if (flags & FLAG_BRACE_LAST)
639 error("found '}' unexpectedly");
641 //add(cell, '}', LM_TC_TEX);
644 else if (t.cat() == catAlign) {
646 //lyxerr << " column now " << cellcol << " max: " << grid.ncols() << "\n";
647 if (cellcol == grid.ncols()) {
648 lyxerr << "adding column " << cellcol << "\n";
649 grid.addCol(cellcol - 1);
651 cell = &grid.cell(grid.index(cellrow, cellcol));
654 else if (t.cat() == catSuper || t.cat() == catSub) {
655 bool up = (t.cat() == catSuper);
656 // we need no new script inset if the last thing was a scriptinset,
657 // which has that script already not the same script already
659 cell->push_back(MathAtom(new MathScriptInset(up)));
660 else if (cell->back()->asScriptInset() &&
661 !cell->back()->asScriptInset()->has(up))
662 cell->back()->asScriptInset()->ensure(up);
663 else if (cell->back()->asScriptInset())
664 cell->push_back(MathAtom(new MathScriptInset(up)));
666 cell->back() = MathAtom(new MathScriptInset(cell->back(), up));
667 MathScriptInset * p = cell->back()->asScriptInset();
668 parse(p->cell(up), FLAG_ITEM, mathmode);
671 // special handling of {}-bases
672 // is this always correct?
673 if (p->nuc().size() == 1 && p->nuc().back()->asNestInset() &&
674 p->nuc().back()->extraBraces())
675 p->nuc() = p->nuc().back()->asNestInset()->cell(0);
678 else if (t.character() == ']' && (flags & FLAG_BRACK_LAST)) {
679 lyxerr << "finished reading option\n";
683 else if (t.cat() == catOther)
684 cell->push_back(MathAtom(new MathCharInset(t.character())));
690 else if (t.cs() == "lyxlock") {
692 cell->back()->lock(true);
695 else if (t.cs() == "def" || t.cs() == "newcommand") {
698 if (t.cs() == "def") {
700 name = getToken().cs();
704 while (good() && nextToken().cat() != catBegin) {
705 pars += getToken().cs();
709 //lyxerr << "read \\def parameter list '" << pars << "'\n";
711 } else { // t.cs() == "newcommand"
713 if (getToken().cat() != catBegin) {
714 error("'{' in \\newcommand expected (1) \n");
718 name = getToken().cs();
720 if (getToken().cat() != catEnd) {
721 error("'}' in \\newcommand expected\n");
725 string arg = getArg('[', ']');
727 nargs = atoi(arg.c_str());
732 parse(ar1, FLAG_ITEM, true);
734 // we cannot handle recursive stuff at all
736 //test.push_back(createMathInset(name));
737 //if (ar1.contains(test)) {
738 // error("we cannot handle recursive macros at all.\n");
742 // is a version for display attached?
745 if (nextToken().cat() == catBegin) {
746 parse(ar2, FLAG_ITEM, true);
749 cell->push_back(MathAtom(new MathMacroTemplate(name, nargs, ar1, ar2)));
752 else if (t.cs() == "(") {
753 cell->push_back(MathAtom(new MathHullInset("simple")));
754 parse2(cell->back(), FLAG_SIMPLE2, true, false);
757 else if (t.cs() == "[") {
758 cell->push_back(MathAtom(new MathHullInset("equation")));
759 parse2(cell->back(), FLAG_EQUATION, true, false);
762 else if (t.cs() == "protect")
763 // ignore \\protect, will hopefully be re-added during output
766 else if (t.cs() == "end") {
767 if (flags & FLAG_END) {
768 // eat environment name
769 //string const name =
771 // FIXME: check that we ended the correct environment
774 error("found 'end' unexpectedly");
777 else if (t.cs() == ")") {
778 if (flags & FLAG_SIMPLE2)
780 error("found '\\)' unexpectedly");
783 else if (t.cs() == "]") {
784 if (flags & FLAG_EQUATION)
786 error("found '\\]' unexpectedly");
789 else if (t.cs() == "\\") {
790 grid.vcrskip(LyXLength(getArg('[', ']')), cellrow);
793 if (cellrow == grid.nrows())
794 grid.addRow(cellrow - 1);
795 if (grid.asHullInset())
796 grid.asHullInset()->numbered(cellrow, numbered);
797 cell = &grid.cell(grid.index(cellrow, cellcol));
801 else if (t.cs() == "multicolumn") {
802 // extract column count and insert dummy cells
804 parse(count, FLAG_ITEM, mathmode);
806 if (!extractNumber(count, cols)) {
807 lyxerr << " can't extract number of cells from " << count << "\n";
809 // resize the table if necessary
810 for (int i = 0; i < cols; ++i) {
812 if (cellcol == grid.ncols()) {
813 lyxerr << "adding column " << cellcol << "\n";
814 grid.addCol(cellcol - 1);
816 cell = &grid.cell(grid.index(cellrow, cellcol));
817 // mark this as dummy
818 grid.cellinfo(grid.index(cellrow, cellcol)).dummy_ = true;
820 // the last cell is the real thng, not a dummy
821 grid.cellinfo(grid.index(cellrow, cellcol)).dummy_ = false;
823 // read special alignment
825 parse(align, FLAG_ITEM, mathmode);
826 //grid.cellinfo(grid.index(cellrow, cellcol)).align_ = extractString(align);
828 // parse the remaining contents into the "real" cell
829 parse(*cell, FLAG_ITEM, mathmode);
833 else if (t.cs() == "limits")
836 else if (t.cs() == "nolimits")
839 else if (t.cs() == "nonumber") {
840 if (grid.asHullInset())
841 grid.asHullInset()->numbered(cellrow, false);
844 else if (t.cs() == "number") {
845 if (grid.asHullInset())
846 grid.asHullInset()->numbered(cellrow, true);
849 else if (t.cs() == "hline") {
850 if (grid.asHullInset())
851 grid.asHullInset()->rowinfo(cellrow + 1);
854 else if (t.cs() == "sqrt") {
856 parse(ar, FLAG_OPTION, mathmode);
858 cell->push_back(MathAtom(new MathRootInset));
859 cell->back()->cell(0) = ar;
860 parse(cell->back()->cell(1), FLAG_ITEM, mathmode);
862 cell->push_back(MathAtom(new MathSqrtInset));
863 parse(cell->back()->cell(0), FLAG_ITEM, mathmode);
867 else if (t.cs() == "ref") {
868 cell->push_back(MathAtom(new RefInset));
869 parse(cell->back()->cell(1), FLAG_OPTION, mathmode);
870 parse(cell->back()->cell(0), FLAG_ITEM, mathmode);
873 else if (t.cs() == "left") {
874 string l = getToken().asString();
876 parse(ar, FLAG_RIGHT, mathmode);
877 string r = getToken().asString();
878 cell->push_back(MathAtom(new MathDelimInset(l, r, ar)));
881 else if (t.cs() == "right") {
882 if (flags & FLAG_RIGHT)
884 //lyxerr << "got so far: '" << cell << "'\n";
885 error("Unmatched right delimiter");
889 else if (t.cs() == "begin") {
890 string const name = getArg('{', '}');
891 if (name == "array" || name == "subarray") {
892 string const valign = getArg('[', ']') + 'c';
893 string const halign = getArg('{', '}');
894 cell->push_back(MathAtom(new MathArrayInset(name, valign[0], halign)));
895 parse2(cell->back(), FLAG_END, mathmode, false);
898 else if (name == "split" || name == "cases" ||
899 name == "gathered" || name == "aligned") {
900 cell->push_back(createMathInset(name));
901 parse2(cell->back(), FLAG_END, mathmode, false);
904 else if (name == "math") {
905 cell->push_back(MathAtom(new MathHullInset("simple")));
906 parse2(cell->back(), FLAG_END, true, true);
909 else if (name == "equation" || name == "equation*"
910 || name == "displaymath") {
911 cell->push_back(MathAtom(new MathHullInset("equation")));
912 parse2(cell->back(), FLAG_END, true, (name == "equation"));
915 else if (name == "eqnarray" || name == "eqnarray*") {
916 cell->push_back(MathAtom(new MathHullInset("eqnarray")));
917 parse2(cell->back(), FLAG_END, true, !stared(name));
920 else if (name == "align" || name == "align*") {
921 cell->push_back(MathAtom(new MathHullInset("align")));
922 parse2(cell->back(), FLAG_END, true, !stared(name));
925 else if (name == "alignat" || name == "alignat*") {
926 // ignore this for a while
928 cell->push_back(MathAtom(new MathHullInset("alignat")));
929 parse2(cell->back(), FLAG_END, true, !stared(name));
932 else if (name == "xalignat" || name == "xalignat*") {
933 // ignore this for a while
935 cell->push_back(MathAtom(new MathHullInset("xalignat")));
936 parse2(cell->back(), FLAG_END, true, !stared(name));
939 else if (name == "xxalignat") {
940 // ignore this for a while
942 cell->push_back(MathAtom(new MathHullInset("xxalignat")));
943 parse2(cell->back(), FLAG_END, true, !stared(name));
946 else if (name == "multline" || name == "multline*") {
947 cell->push_back(MathAtom(new MathHullInset("multline")));
948 parse2(cell->back(), FLAG_END, true, !stared(name));
951 else if (name == "gather" || name == "gather*") {
952 cell->push_back(MathAtom(new MathHullInset("gather")));
953 parse2(cell->back(), FLAG_END, true, !stared(name));
956 else if (latexkeys const * l = in_word_set(name)) {
957 if (l->inset == "matrix") {
958 cell->push_back(createMathInset(name));
959 parse2(cell->back(), FLAG_END, mathmode, false);
964 // lyxerr << "unknow math inset begin '" << name << "'\n";
965 // create generic environment inset
966 cell->push_back(MathAtom(new MathEnvInset(name)));
967 parse(cell->back()->cell(0), FLAG_END, mathmode);
971 else if (t.cs() == "kern") {
977 Token const & t = getToken();
983 if (isValidLength(s))
986 cell->push_back(MathAtom(new MathKernInset(s)));
989 else if (t.cs() == "label") {
991 parse(ar, FLAG_ITEM, false);
992 if (grid.asHullInset()) {
993 grid.asHullInset()->label(cellrow, asString(ar));
995 cell->push_back(createMathInset(t.cs()));
996 cell->push_back(MathAtom(new MathBraceInset(ar)));
1000 else if (t.cs() == "choose" || t.cs() == "over" || t.cs() == "atop") {
1001 MathAtom p = createMathInset(t.cs());
1004 parse(p->cell(1), flags, mathmode);
1009 else if (t.cs() == "substack") {
1010 cell->push_back(createMathInset(t.cs()));
1011 parse2(cell->back(), FLAG_ITEM, mathmode, false);
1014 else if (t.cs() == "xymatrix") {
1015 cell->push_back(createMathInset(t.cs()));
1016 parse2(cell->back(), FLAG_ITEM, mathmode, false);
1021 else if (1 && t.cs() == "ar") {
1022 MathXYArrowInset * p = new MathXYArrowInset;
1023 // try to read target
1024 parse(p->cell(0), FLAG_OTPTION, mathmode);
1025 // try to read label
1026 if (nextToken().cat() == catSuper || nextToken().cat() == catSub) {
1027 p->up_ = nextToken().cat() == catSuper;
1029 parse(p->cell(1), FLAG_ITEM, mathmode);
1030 //lyxerr << "read label: " << p->cell(1) << "\n";
1033 cell->push_back(MathAtom(p));
1034 //lyxerr << "read cell: " << cell << "\n";
1038 else if (t.cs().size()) {
1039 latexkeys const * l = in_word_set(t.cs());
1041 if (l->inset == "font") {
1042 cell->push_back(createMathInset(t.cs()));
1043 parse(cell->back()->cell(0), FLAG_ITEM, l->extra == "mathmode");
1046 else if (l->inset == "oldfont") {
1047 cell->push_back(createMathInset(t.cs()));
1048 parse(cell->back()->cell(0), flags, l->extra == "mathmode");
1052 else if (l->inset == "style") {
1053 cell->push_back(createMathInset(t.cs()));
1054 parse(cell->back()->cell(0), flags, mathmode);
1058 else if (l->inset == "parbox") {
1059 // read optional positioning and width
1060 MathArray pos, width;
1061 parse(pos, FLAG_OPTION, false);
1062 parse(width, FLAG_ITEM, false);
1063 cell->push_back(createMathInset(t.cs()));
1064 parse(cell->back()->cell(0), FLAG_ITEM, false);
1065 cell->back()->asParboxInset()->setPosition(asString(pos));
1066 cell->back()->asParboxInset()->setWidth(asString(width));
1070 MathAtom p = createMathInset(t.cs());
1071 for (MathInset::idx_type i = 0; i < p->nargs(); ++i)
1072 parse(p->cell(i), FLAG_ITEM, l->extra != "forcetext");
1078 MathAtom p = createMathInset(t.cs());
1079 bool mode = mathmode;
1080 if (mathmode && p->currentMode() == MathInset::TEXT_MODE)
1082 if (!mathmode && p->currentMode() == MathInset::MATH_MODE)
1084 for (MathInset::idx_type i = 0; i < p->nargs(); ++i)
1085 parse(p->cell(i), FLAG_ITEM, mode);
1091 if (flags & FLAG_LEAVE) {
1092 flags &= ~FLAG_LEAVE;
1100 } // anonymous namespace
1103 void mathed_parse_cell(MathArray & ar, string const & str)
1105 istringstream is(str.c_str());
1106 mathed_parse_cell(ar, is);
1110 void mathed_parse_cell(MathArray & ar, istream & is)
1112 Parser(is).parse(ar, 0, true);
1116 bool mathed_parse_normal(MathAtom & t, string const & str)
1118 istringstream is(str.c_str());
1119 return Parser(is).parse(t);
1123 bool mathed_parse_normal(MathAtom & t, istream & is)
1125 return Parser(is).parse(t);
1129 bool mathed_parse_normal(MathAtom & t, LyXLex & lex)
1131 return Parser(lex).parse(t);