Fixed parsing of if ... else blocks.

Improved debugging of expression parser.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5061 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2012-05-15 13:57:05 +00:00
parent 2ed4eee7d9
commit a404c48189
2 changed files with 7 additions and 1 deletions

View File

@ -492,7 +492,9 @@ bool ExpEvaluator::runCompile(const char*& expr, char stop, Opcode nested)
} StackedOpcode;
StackedOpcode stack[10];
unsigned int stackPos = 0;
DDebug(this,DebugInfo,"runCompile '%s' '%1s'",expr,&stop);
#ifdef DEBUG
Debugger debug(DebugInfo,"runCompile()"," '%s' '%1s'",expr,&stop);
#endif
if (skipComments(expr) == ')')
return false;
m_inError = false;

View File

@ -538,12 +538,16 @@ bool JsCode::getInstruction(const char*& expr, Opcode nested)
ExpOperation* cond = addOpcode((Opcode)OpcJumpFalse,++m_label);
if (!runCompile(++expr,';'))
return false;
if (skipComments(expr) == ';')
expr++;
const char* save = expr;
if ((JsOpcode)ExpEvaluator::getOperator(expr,s_instr) == OpcElse) {
ExpOperation* jump = addOpcode((Opcode)OpcJump,++m_label);
addOpcode(OpcLabel,cond->number());
if (!runCompile(++expr))
return false;
if (skipComments(expr) == ';')
expr++;
addOpcode(OpcLabel,jump->number());
}
else {