added patches from Marina M. to fix predicate parsing, and make sure we look for Axis Identifier wild cards

This commit is contained in:
kvisco%ziplink.net 2005-11-02 07:34:19 +00:00
parent 2866af1c71
commit d0463c32f3
2 changed files with 28 additions and 7 deletions

View File

@ -25,13 +25,17 @@
* Bob Miller, Oblix Inc., kbob@oblix.com
* -- fixed bug with single quotes inside double quotes
*
* $Id: txExprLexer.cpp,v 1.1 2005/11/02 07:33:40 kvisco%ziplink.net Exp $
* Marina Mechtcheriakova, mmarina@mindspring.com
* -- Fixed bug in parse method so that we make sure we check for
* axis identifier wild cards, such as ancestor::*
*
* $Id: txExprLexer.cpp,v 1.2 2005/11/02 07:33:41 kvisco%ziplink.net Exp $
*/
/**
* Lexical analyzer for XPath expressions
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
* @version $Revision: 1.1 $ $Date: 2005/11/02 07:33:40 $
* @version $Revision: 1.2 $ $Date: 2005/11/02 07:33:41 $
**/
#include <iostream.h>
@ -640,6 +644,10 @@ void ExprLexer::parse(const String& pattern) {
case ASTERIX:
matchToken(tokenBuffer, ch);
switch ( prevToken->type ) {
//-- Fix: make sure check for axis identifier wild cards, such as
//-- ancestor::* - Marina M.
case Token::AXIS_IDENTIFIER :
//-- End Fix
case Token::PARENT_OP :
case Token::ANCESTOR_OP:
case Token::AT_SIGN :

View File

@ -21,10 +21,12 @@
* 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)
* -- fixed a bug in CreateExpr (@xxx=/yyy was parsed as @xxx=@xxx/yyy)
* Marina Mechtcheriakova
* -- fixed bug in ::parsePredicates,
* made sure we continue looking for more predicates.
*
* $Id: txExprParser.cpp,v 1.1 2005/11/02 07:33:25 kvisco%ziplink.net Exp $
* $Id: txExprParser.cpp,v 1.2 2005/11/02 07:33:26 kvisco%ziplink.net Exp $
*/
/**
@ -32,7 +34,7 @@
* This class is used to parse XSL Expressions
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
* @see ExprLexer
* @version $Revision: 1.1 $ $Date: 2005/11/02 07:33:25 $
* @version $Revision: 1.2 $ $Date: 2005/11/02 07:33:26 $
**/
#include "ExprParser.h"
@ -811,8 +813,19 @@ String* ExprParser::parsePredicates(PredicateList* predicateList, ExprLexer& lex
}
if ( tok->type == Token::R_BRACKET) {
lexer.nextToken(); //-- eat ']'
break;
//-- Fix: look ahead at next token for mulitple predicates - Marina M.
tok = lexer.peek();
if ((!tok) || ( tok->type != Token::L_BRACKET )) break;
//-- /Fix
}
//-- Fix: handle multiple predicates - Marina M.
if (tok->type == Token::L_BRACKET)
lexer.nextToken(); //-- swallow '['
//-- /Fix
Expr* expr = createExpr(lexer);
predicateList->add(expr);
}