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:
parent
2ed4eee7d9
commit
a404c48189
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue