From d808073f4204011b07b2f2c01389f79072206745 Mon Sep 17 00:00:00 2001 From: "kvisco%ziplink.net" Date: Thu, 13 Apr 2000 09:13:22 +0000 Subject: [PATCH] added patches from Marina M. to fix predicate parsing, and make sure we look for Axis Identifier wild cards --- .../transformiix/source/xpath/ExprLexer.cpp | 12 ++++++++-- .../transformiix/source/xpath/ExprParser.cpp | 23 +++++++++++++++---- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/extensions/transformiix/source/xpath/ExprLexer.cpp b/extensions/transformiix/source/xpath/ExprLexer.cpp index 932a3c76518..351850d68a2 100644 --- a/extensions/transformiix/source/xpath/ExprLexer.cpp +++ b/extensions/transformiix/source/xpath/ExprLexer.cpp @@ -25,13 +25,17 @@ * Bob Miller, Oblix Inc., kbob@oblix.com * -- fixed bug with single quotes inside double quotes * - * $Id: ExprLexer.cpp,v 1.1 2000-04-06 07:45:26 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: ExprLexer.cpp,v 1.2 2000-04-13 09:13:14 kvisco%ziplink.net Exp $ */ /** * Lexical analyzer for XPath expressions * @author Keith Visco - * @version $Revision: 1.1 $ $Date: 2000-04-06 07:45:26 $ + * @version $Revision: 1.2 $ $Date: 2000-04-13 09:13:14 $ **/ #include @@ -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 : diff --git a/extensions/transformiix/source/xpath/ExprParser.cpp b/extensions/transformiix/source/xpath/ExprParser.cpp index f320078532c..6cbfc7e8d7e 100644 --- a/extensions/transformiix/source/xpath/ExprParser.cpp +++ b/extensions/transformiix/source/xpath/ExprParser.cpp @@ -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: ExprParser.cpp,v 1.1 2000-04-06 07:45:29 kvisco%ziplink.net Exp $ + * $Id: ExprParser.cpp,v 1.2 2000-04-13 09:13:22 kvisco%ziplink.net Exp $ */ /** @@ -32,7 +34,7 @@ * This class is used to parse XSL Expressions * @author Keith Visco * @see ExprLexer - * @version $Revision: 1.1 $ $Date: 2000-04-06 07:45:29 $ + * @version $Revision: 1.2 $ $Date: 2000-04-13 09:13:22 $ **/ #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); }