added Olivier's fix, as well as removed some debug code

This commit is contained in:
kvisco%ziplink.net 2000-03-29 08:56:07 +00:00
Родитель 84d3de487b
Коммит 96db65b3d8
1 изменённых файлов: 17 добавлений и 5 удалений

Просмотреть файл

@ -20,8 +20,11 @@
* Contributor(s):
* Keith Visco, kvisco@ziplink.net
* -- original author.
* Olivier Gerardin, ogerardin@vo.lu
* -- fixed a bug in CreateExpr (@xxx=/yyy was parsed as
* @xxx=@xxx/yyy)
*
* $Id: ExprParser.cpp,v 1.4 2000/03/19 08:00:01 kvisco%ziplink.net Exp $
* $Id: ExprParser.cpp,v 1.5 2000/03/29 08:56:07 kvisco%ziplink.net Exp $
*/
/**
@ -29,7 +32,7 @@
* This class is used to parse XSL Expressions
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
* @see ExprLexer
* @version $Revision: 1.4 $ $Date: 2000/03/19 08:00:01 $
* @version $Revision: 1.5 $ $Date: 2000/03/29 08:56:07 $
**/
#include "ExprParser.h"
@ -307,6 +310,7 @@ Expr* ExprParser::createExpr(ExprLexer& lexer) {
}
exprs.push(expr);
ops.push(tok);
expr = 0; // OG, prevent reuse of expr
break;
}
default:
@ -316,9 +320,14 @@ Expr* ExprParser::createExpr(ExprLexer& lexer) {
}
}
// make sure expr != 0, will this happen?
if (( expr == 0 ) && (!exprs.empty()))
expr = (Expr*) exprs.pop();
while (!exprs.empty() ) {
expr = createBinaryExpr((Expr*)exprs.pop(), expr, (Token*)ops.pop());
}
return expr;
} //-- createExpr
@ -559,9 +568,12 @@ LocationStep* ExprParser::createLocationStep(ExprLexer& lexer) {
parsePredicates(lstep, lexer);
String foo;
lstep->toString(foo);
//cout << "returning LocationStep: "<< foo <<endl;
//<debug>
//String tmp;
//lstep->toString(tmp);
//cout << "returning LocationStep: "<< tmp <<endl;
//</debug>
return lstep;
} //-- createLocationPath