[EMAIL PROTECTED] wrote:
Author: sts
Date: Wed Dec 19 23:57:22 2007
New Revision: 22214
URL: http://www.lyx.org/trac/changeset/22214
Log:
* at least return a valid template on parse error, but:
FIXME: The macro template does not make sense after this.
The whole parsing should not be in a constructor which
has no chance to report failure.
Modified:
lyx-devel/trunk/src/mathed/MathMacroTemplate.cpp
Modified: lyx-devel/trunk/src/mathed/MathMacroTemplate.cpp
URL:
http://www.lyx.org/trac/file/lyx-devel/trunk/src/mathed/MathMacroTemplate.cpp?rev=22214
==============================================================================
--- lyx-devel/trunk/src/mathed/MathMacroTemplate.cpp (original)
+++ lyx-devel/trunk/src/mathed/MathMacroTemplate.cpp Wed Dec 19 23:57:22 2007
@@ -119,7 +119,8 @@
MathMacroTemplate::MathMacroTemplate(docstring const & str)
- : InsetMathNest(3), numargs_(0)
+ : InsetMathNest(3), numargs_(0), optionals_(0),
+ type_(MacroTypeNewcommand)
{
initMath();
@@ -127,6 +128,10 @@
mathed_parse_cell(ar, str);
if (ar.size() != 1 || !ar[0]->asMacroTemplate()) {
lyxerr << "Cannot read macro from '" << ar << "'" << endl;
+ asArray(from_ascii("invalidmacro"), cell(0));
+ // FIXME: The macro template does not make sense after this.
+ // The whole parsing should not be in a constructor which
+ // has no chance to report failure.
Failure report could be done with ExceptionMessage. Those are caught in
createInset() in the factory.
Abdel.