]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathParser.cpp
Change the interface to a paragraph's layout. We still store a LayoutPtr, but now...
[lyx.git] / src / mathed / MathParser.cpp
index 84069deb2b2841827b01bdb9b0f4b7a3fb5610b9..e14c925d6ef9e26867ddf932b4e6b6b182dcfbce 100644 (file)
@@ -63,8 +63,8 @@ following hack as starting point to write some macros:
 #include "MathSupport.h"
 
 #include "Lexer.h"
-#include "support/debug.h"
 
+#include "support/debug.h"
 #include "support/convert.h"
 #include "support/docstream.h"
 
@@ -307,7 +307,7 @@ public:
        ///
        Parser(Lexer & lex);
        /// Only use this for reading from .lyx file format, for the reason
-       /// see Parser::tokenize(std::istream &).
+       /// see Parser::tokenize(istream &).
        Parser(istream & is);
        ///
        Parser(docstring const & str);
@@ -894,14 +894,17 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
 
                else if (t.cs() == "def" ||
                        t.cs() == "newcommand" ||
-                       t.cs() == "renewcommand")
+                       t.cs() == "renewcommand" ||
+                       t.cs() == "newlyxcommand")
                {
-                       docstring const type = t.cs();
+                       MacroType type = MacroTypeNewcommand;
+                       if (t.cs() == "def")
+                               type = MacroTypeDef;
                        docstring name;
                        int nargs = 0;
                        int optionals = 0;
-                       std::vector<MathData> optionalValues;
-                       if (t.cs() == "def") {
+                       vector<MathData> optionalValues;
+                       if (type == MacroTypeDef) {
                                // get name
                                name = getToken().cs();
 
@@ -914,7 +917,7 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
                                nargs /= 2;
                                //lyxerr << "read \\def parameter list '" << pars << "'" << endl;
 
-                       } else { // t.cs() == "newcommand" || t.cs() == "renewcommand"
+                       } else {
                                if (getToken().cat() != catBegin) {
                                        error("'{' in \\newcommand expected (1) ");
                                        return;
@@ -1263,7 +1266,7 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
                                               << to_utf8(l->inset) << "'." << endl;
                                        // create generic environment inset
                                        cell->push_back(MathAtom(new InsetMathEnv(name)));
-                                       parse(cell->back().nucleus()->cell(0), FLAG_ITEM, mode);
+                                       parse(cell->back().nucleus()->cell(0), FLAG_END, mode);
                                }
                        }
 
@@ -1273,7 +1276,7 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
                                        << "'" << endl;
                                // create generic environment inset
                                cell->push_back(MathAtom(new InsetMathEnv(name)));
-                               parse(cell->back().nucleus()->cell(0), FLAG_ITEM, mode);
+                               parse(cell->back().nucleus()->cell(0), FLAG_END, mode);
                        }
                }