#include "math_inset.h"
#include "math_macro.h"
#include "math_root.h"
-#include "error.h"
+#include "debug.h"
enum {
FLAG_BRACE = 1, // A { needed
static short mathed_env = LM_EN_INTEXT;
-char *mathed_label = NULL;
+char *mathed_label = 0;
char const *latex_mathenv[] = {
"math",
static void mathPrintError(char const *msg)
{
- fprintf(stderr, "Line ~%d: Math parse error: %s\n", yylineno, msg);
+ lyxerr << "Line ~" << yylineno << ": Math parse error: "
+ << msg << endl;
}
if (c>' ') {
if (!lf) lf = c; else
if (c!=lf)
- fprintf(stderr, "Math parse error: unexpected '%c'\n", c);
+ lyxerr << "Math parse error: unexpected '"
+ << c << "'" << endl;
break;
}
}
rg = (lf=='{') ? '}': ((lf=='[') ? ']': ((lf=='(') ? ')': 0));
if (!rg) {
- fprintf(stderr, "Math parse error: unknown bracket '%c'\n", lf);
+ lyxerr << "Math parse error: unknown bracket '"
+ << lf << "'" << endl;
return '\0';
}
do {
int brace = 0;
int acc_brace = 0;
int acc_braces[8];
- MathParInset *mt = (mtx) ? *mtx: 0;//(MathParInset*)NULL;
+ MathParInset *mt = (mtx) ? *mtx: 0;//(MathParInset*)0;
MathedRowSt *crow = (mt) ? mt->getRowSt(): 0;
plevel++;
case '^':
{
MathParInset *p = new MathParInset(size, "", LM_OT_SCRIPT);
- LyxArrayBase * ar = mathed_parse(FLAG_BRACE_OPT|FLAG_BRACE_LAST, NULL);
+ LyxArrayBase * ar = mathed_parse(FLAG_BRACE_OPT|FLAG_BRACE_LAST, 0);
p->SetData(ar);
-// fprintf(stderr, "UP[%d]", p->GetStyle());
+// lyxerr << "UP[" << p->GetStyle() << "]" << endl;
data.Insert (p, LM_TC_UP);
break;
}
case '_':
{
MathParInset *p = new MathParInset(size, "", LM_OT_SCRIPT);
- LyxArrayBase * ar = mathed_parse(FLAG_BRACE_OPT|FLAG_BRACE_LAST, NULL);
+ LyxArrayBase * ar = mathed_parse(FLAG_BRACE_OPT|FLAG_BRACE_LAST, 0);
p->SetData(ar);
data.Insert (p, LM_TC_DOWN);
break;
{
if (binset) {
binset->SetLimits((bool)(yylval.l->id));
- binset = NULL;
+ binset = 0;
}
break;
}
} else
mathPrintError("Unexpected tab");
// debug info. [made that conditional -JMarc]
- if (lyxerr.debugging(Error::MATHED))
- fprintf(stderr, "%d %d\n", data.getCol(), mt->GetColumns());
+ if (lyxerr.debugging(Debug::MATHED))
+ lyxerr << data.getCol() << " " << mt->GetColumns() << endl;
break;
}
case LM_TK_NEWLINE:
lfd=yylex();
if (lfd==LM_TK_SYM || lfd==LM_TK_STR || lfd==LM_TK_BOP|| lfd==LM_TK_SPECIAL)
lfd = (lfd==LM_TK_SYM) ? yylval.l->id: yylval.i;
-// fprintf(stderr, "L[%d %c]", lfd, lfd);
+// lyxerr << "L[" << lfd << " " << lfd << "]";
LyxArrayBase* a = mathed_parse(FLAG_RIGHT);
rgd=yylex();
-// fprintf(stderr, "R[%d]", rgd);
+// lyxerr << "R[" << rgd << "]";
if (rgd==LM_TK_SYM || rgd==LM_TK_STR || rgd==LM_TK_BOP || rgd==LM_TK_SPECIAL)
rgd = (rgd==LM_TK_SYM) ? yylval.l->id: yylval.i;
MathDelimInset *dl = new MathDelimInset(lfd, rgd);
dl->SetData(a);
data.Insert(dl, LM_TC_ACTIVE_INSET);
-// fprintf(stderr, "RL[%d %d]", lfd, rgd);
+// lyxerr << "RL[" << lfd << " " << rgd << "]";
break;
}
case LM_TK_RIGHT:
if (mathed_env != yylval.i && yylval.i!=LM_EN_ARRAY)
mathPrintError("Unmatched environment");
// debug info [made that conditional -JMarc]
- if (lyxerr.debugging(Error::MATHED))
- fprintf(stderr, "[%d]\n", yylval.i);
+ if (lyxerr.debugging(Debug::MATHED))
+ lyxerr << "[" << yylval.i << "]" << endl;
plevel--;
if (mt) { // && (flags & FLAG_END)) {
mt->SetData(array);
- array = NULL;
+ array = 0;
}
return array;
}
break;
}
if (!mt) {
- mathPrintError("NULL paragraph.");
+ mathPrintError("0 paragraph.");
panic = true;
}
}
#ifdef DEBUG
- fprintf(stderr, "MATH BEGIN[%d]\n", mathed_env);
+ lyxerr << "MATH BEGIN[" << mathed_env << "]" << endl;
#endif
} else {
-// fprintf(stderr, "MATHCRO[%s]",yytext);
+// lyxerr << "MATHCRO[" << yytext << "]";
MathMacro* p =
MathMacroTable::mathMTable.getMacro(yytext);
if (p) {
if (rg != '}') {
mathPrintError("Expected '{'");
// debug info
- fprintf(stderr, "[%s]\n", yytext); fflush(stderr);
+ lyxerr << "[" << yytext << "]" << endl;
panic = true;
break;
}
mathed_label = strnew(yytext);
}
#ifdef DEBUG
- fprintf(stderr, "Label[%d]\n", mathed_label);
+ lyxerr << "Label[" << mathed_label << "]" << endl;
#endif
break;
}
default:
mathPrintError("Unrecognized token");
// debug info
- fprintf(stderr, "[%d %s]\n", t, yytext);
+ lyxerr << "[" << t << " " << yytext << "]" << endl;
break;
}
tprev = t;
if (panic) {
- fprintf(stderr, " Math Panic, expect problems!\n");
+ lyxerr << " Math Panic, expect problems!" << endl;
// Search for the end command.
do t = yylex (); while (t != LM_TK_END && t);
} else