Fixed a seg fault when '/' is used as a div operator, which is an error so I also added an error message for this case

git-svn-id: svn://10.0.0.236/trunk@70023 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
kvisco%ziplink.net
2000-05-16 09:34:01 +00:00
parent c96d6b6ad6
commit 2ad6651228
3 changed files with 37 additions and 22 deletions

View File

@@ -29,13 +29,13 @@
* -- 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.3 2000-04-13 18:29:56 nisheeth%netscape.com Exp $
* $Id: ExprLexer.cpp,v 1.4 2000-05-16 09:34:00 kvisco%ziplink.net Exp $
*/
/**
* Lexical analyzer for XPath expressions
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
* @version $Revision: 1.3 $ $Date: 2000-04-13 18:29:56 $
* @version $Revision: 1.4 $ $Date: 2000-05-16 09:34:00 $
**/
#include <iostream.h>
@@ -592,6 +592,11 @@ void ExprLexer::parse(const String& pattern) {
prevToken->type = Token::ANCESTOR_OP;
prevToken->value.append(ch);
}
//-- handle possible error in using /
else if ( prevToken->type == Token::NUMBER ) {
prevToken->type = Token::ERROR;
prevToken->value = "Error in expression, misuse of '/', try 'div' instead.";
}
else matchDelimiter(ch);
break;
case BANG : //-- used as previous...see EQUAL

View File

@@ -21,13 +21,12 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
* $Id: Parser.cpp,v 1.2 2000-04-12 22:33:30 nisheeth%netscape.com Exp $
* $Id: Parser.cpp,v 1.3 2000-05-16 09:34:01 kvisco%ziplink.net Exp $
*/
/**
* Test App for Expressions
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
* @version $Revision: 1.2 $ $Date: 2000-04-12 22:33:30 $
* @version $Revision: 1.3 $ $Date: 2000-05-16 09:34:01 $
**/
#include <iostream.h>
@@ -42,11 +41,14 @@ void main(int argc, char** argv) {
cout <<endl;
//-- old test cases, commented for re-use
//String pattern("element[position()=1]");
//String pattern("*[text()='foo']");
//String pattern("@*|node()");
//String pattern("FSContext/UserList/User[@id=/FSContext/SessionData/@userref]/@priv = 'admin'");
String pattern("FSContext/UserList/User[@id=/FSContext/SessionData/@userref]/@priv = 'admin'");
String pattern("10/3");
cout <<"Lexically Analyzing: "<<pattern<<endl;
cout<<endl;

View File

@@ -1,30 +1,38 @@
CC := g++ -g
ROOT_PATH = ../..
ROOT_PATH = ..
BASE_PATH = $(ROOT_PATH)/base
XML_PATH = $(ROOT_PATH)/xml
DOM_PATH = $(XML_PATH)/dom
XSL_PATH = $(ROOT_PATH)/xsl
XSLUTIL_PATH = $(XSL_PATH)/util
XSLT_PATH = $(ROOT_PATH)/xslt
INCLUDE_PATHS = -I. \
-I$(BASE_PATH) \
-I$(XSLUTIL_PATH) \
-I$(DOM_PATH) \
-I$(XML_PATH) \
-I$(XSL_PATH) \
INCLUDE_PATHS = -I. \
-I$(BASE_PATH) \
-I$(DOM_PATH) \
-I$(XML_PATH) \
-I$(XSLT_PATH) \
-I-
OBJS = *.o \
$(BASE_PATH)/*.o \
$(XSLUTIL_PATH)/*.o \
$(DOM_PATH)/*.o \
$(XML_PATH)/*.o \
$(XSL_PATH)/Names.o
OBJS = *.o \
$(BASE_PATH)/*.o \
$(DOM_PATH)/*.o \
$(XML_PATH)/*.o \
$(XSLT_PATH)/Names.o
target:
$(CC) $(INCLUDE_PATHS) $(OBJS) parser.cpp -o parser.exe
$(CC) $(INCLUDE_PATHS) $(OBJS) Parser.cpp -o parser.exe