dleslie 00/02/25 07:17:55
Modified: src/org/apache/xalan/xpath XPathProcessorImpl.java
Log:
javadoc cleanup SPR #DMAN4FYQFS
Revision Changes Path
1.21 +435 -435
xml-xalan/src/org/apache/xalan/xpath/XPathProcessorImpl.java
Index: XPathProcessorImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/XPathProcessorImpl.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- XPathProcessorImpl.java 2000/02/23 08:52:59 1.20
+++ XPathProcessorImpl.java 2000/02/25 15:17:54 1.21
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -10,7 +10,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -18,15 +18,15 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "XSLT4J" and "Apache Software Foundation" must
+ * 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
@@ -65,22 +65,20 @@
import org.apache.xalan.xpath.xml.StringKey;
/**
- * The XPathProcessorImpl class' responsibilities include
- * tokenizing and parsing the XPath expression, and acting
- * as a general interface to XPaths.
+ * Tokenizes and parses XPath expressions; provides a general interface to
XPaths.
*/
public class XPathProcessorImpl implements XPathProcessor,
java.io.Serializable
{
private XPath m_xpath;
transient private XPathSupport m_support;
-
+
/**
* The next token in the pattern.
*/
private String m_token;
-
+
/**
- * The first char in m_token, the theory being that this
+ * The first char in m_token, the theory being that this
* is an optimization because we won't have to do charAt(0) as
* often.
*/
@@ -90,7 +88,7 @@
* The position in the token queue is tracked by m_queueMark.
*/
public int m_queueMark = 0;
-
+
/**
* The parser constructor.
*/
@@ -106,11 +104,11 @@
{
m_support = new XPathSupportDefault();
}
-
+
/* For diagnostics */
Hashtable m_durationsTable = new Hashtable();
-
+
PrefixResolver m_namespaceContext;
/**
@@ -124,7 +122,7 @@
m_durationsTable.put(key, new Date());
}
}
-
+
/**
* Returns the duration since pushTime was called,
* in milliseconds.
@@ -160,9 +158,9 @@
m_durationsTable.remove(key);
}
}
-
+
/**
- * Given an string, make an XPath object, on order that a parse doesn't
+ * Given an string, make an XPath object, on order that a parse doesn't
* have to be done each time the expression is executed.
*/
public void initXPath(XPath pathObj, String expression, PrefixResolver
namespaceContext)
@@ -190,16 +188,16 @@
pathObj.shrink();
doStaticAnalysis(pathObj);
}
-
+
/**
* Analyze the XPath object to give optimization information.
*/
void doStaticAnalysis(XPath pathObj)
{
}
-
+
/**
- * Given an string, make an XPath object, on order that a parse doesn't
+ * Given an string, make an XPath object, on order that a parse doesn't
* have to be done each time the expression is executed.
*/
public void initMatchPattern(XPath pathObj, String expression,
PrefixResolver namespaceContext)
@@ -232,12 +230,12 @@
// Lexical Analysis
private void ___________LEXICAL_ANALYSIS___________(){}
-
+
// ============= TOKENIZATION FUNCTIONS =================
private void ____TOKENIZATION_FUNCTIONS____(){}
-
+
/**
- * Walk through the expression and build a token queue, and a map of the
top-level
+ * Walk through the expression and build a token queue, and a map of the
top-level
* elements.
* @param pat XSLT Expression.
*/
@@ -246,9 +244,9 @@
{
tokenize(pat, null);
}
-
+
/**
- * Walk through the expression and build a token queue, and a map of the
top-level
+ * Walk through the expression and build a token queue, and a map of the
top-level
* elements.
* @param pat XSLT Expression.
* @param targetStrings Vector to hold Strings, may be null.
@@ -265,18 +263,18 @@
boolean isStartOfPat = true;
boolean isAttrName = false;
boolean isNum = false;
-
- // Nesting of '[' so we can know if the given element should be
+
+ // Nesting of '[' so we can know if the given element should be
// counted inside the m_patternMap.
int nesting = 0;
-
+
// char[] chars = pat.toCharArray();
for(int i = 0; i < nChars; i++)
{
char c = pat.charAt(i);
switch(c)
{
- case '\"':
+ case '\"':
{
if(startSubstring != -1)
{
@@ -284,7 +282,7 @@
isStartOfPat = mapPatternElemPos(nesting, isStartOfPat,
isAttrName);
isAttrName = false;
if(-1 != posOfNSSep)
- {
+ {
posOfNSSep = mapNSTokens(pat, startSubstring, posOfNSSep, i);
}
else
@@ -305,7 +303,7 @@
}
}
break;
-
+
case '\'':
if(startSubstring != -1)
{
@@ -313,7 +311,7 @@
isStartOfPat = mapPatternElemPos(nesting, isStartOfPat,
isAttrName);
isAttrName = false;
if(-1 != posOfNSSep)
- {
+ {
posOfNSSep = mapNSTokens(pat, startSubstring, posOfNSSep, i);
}
else
@@ -333,7 +331,7 @@
error(XPATHErrorResources.ER_EXPECTED_SINGLE_QUOTE); //"misquoted
literal... expected single quote!");
}
break;
-
+
case 0x0A:
case 0x0D:
case ' ':
@@ -344,7 +342,7 @@
isStartOfPat = mapPatternElemPos(nesting, isStartOfPat,
isAttrName);
isAttrName = false;
if(-1 != posOfNSSep)
- {
+ {
posOfNSSep = mapNSTokens(pat, startSubstring, posOfNSSep, i);
}
else
@@ -354,11 +352,11 @@
startSubstring = -1;
}
break;
-
+
case '@':
isAttrName = true;
// fall-through on purpose
-
+
case '-':
if('-' == c)
{
@@ -392,7 +390,7 @@
isStartOfPat = mapPatternElemPos(nesting, isStartOfPat,
isAttrName);
isAttrName = false;
if(-1 != posOfNSSep)
- {
+ {
posOfNSSep = mapNSTokens(pat, startSubstring, posOfNSSep, i);
}
else
@@ -410,7 +408,7 @@
isStartOfPat = mapPatternElemPos(nesting, isStartOfPat,
isAttrName);
isAttrName = false;
}
-
+
if(0 == nesting)
{
if('|' == c)
@@ -431,12 +429,12 @@
nesting++;
}
addToTokenQueue(pat.substring(i, i+1));
-
+
break;
-
+
case ':':
if(posOfNSSep == (i-1))
- {
+ {
if(startSubstring != -1)
{
if(startSubstring < (i-1))
@@ -446,7 +444,7 @@
isAttrName = false;
startSubstring = -1;
posOfNSSep = -1;
-
+
addToTokenQueue(pat.substring(i-1, i+1));
break;
}
@@ -455,7 +453,7 @@
posOfNSSep = i;
}
// fall through on purpose
-
+
default:
if(-1 == startSubstring)
{
@@ -473,7 +471,7 @@
isNum = false;
isStartOfPat = mapPatternElemPos(nesting, isStartOfPat, isAttrName);
if(-1 != posOfNSSep)
- {
+ {
posOfNSSep = mapNSTokens(pat, startSubstring, posOfNSSep, nChars);
}
else
@@ -481,7 +479,7 @@
addToTokenQueue(pat.substring(startSubstring, nChars));
}
}
-
+
if(0 == m_xpath.m_tokenQueueSize)
{
error(XPATHErrorResources.ER_EMPTY_EXPRESSION); //"Empty expression!");
@@ -493,10 +491,10 @@
m_queueMark = 0;
}
-
+
/**
- * Record the current position on the token queue as long as
- * this is a top-level element. Must be called before the
+ * Record the current position on the token queue as long as
+ * this is a top-level element. Must be called before the
* next token is added to the m_tokenQueue.
*/
private boolean mapPatternElemPos(int nesting, boolean isStart, boolean
isAttrName)
@@ -507,14 +505,14 @@
{
m_xpath.m_patternMap[m_xpath.m_patternMapSize-1] -= TARGETEXTRA;
}
- m_xpath.m_patternMap[m_xpath.m_patternMapSize]
+ m_xpath.m_patternMap[m_xpath.m_patternMapSize]
= (m_xpath.m_tokenQueueSize - (isAttrName ? 1 : 0)) + TARGETEXTRA;
m_xpath.m_patternMapSize++;
isStart = false;
}
return isStart;
}
-
+
/**
* Record the correct token string in the passed vector.
*/
@@ -574,7 +572,7 @@
}
/**
- * When a seperator token is found, see if there's a element name or
+ * When a seperator token is found, see if there's a element name or
* the like to map.
*/
private int mapNSTokens(String pat, int startSubstring, int posOfNSSep,
int posOfScan)
@@ -589,8 +587,8 @@
uName =
((PrefixResolver)m_namespaceContext).getNamespaceForPrefix(prefix);
else
{
- // Assume last was wildcard. This is not legal according
- // to the draft. Set the below to true to make namespace
+ // Assume last was wildcard. This is not legal according
+ // to the draft. Set the below to true to make namespace
// wildcards work.
if(false)
{
@@ -643,11 +641,11 @@
int pos = m_xpath.m_patternMap[i];
return (pos >= TARGETEXTRA) ? (pos - TARGETEXTRA) : pos;
}
-
+
/**
- * This will return the index above the passed index that
- * is the target element, i.e. it holds a value >= TARGETEXTRA.
- * If there is no next target, it will return -1.
+ * Return the index above the passed index that
+ * is the target element, i.e. >= TARGETEXTRA.
+ * If there is no next target, it return -1.
* Pass -1 in to start testing from zero.
*/
int getNextTargetIndexInMap(int i)
@@ -665,23 +663,23 @@
}
return next;
}
-
+
/**
- * This will return the normalized index into the pattern
+ * Return the normalized index into the pattern
* map above the passed index, or -1 if it is the last pattern.
*/
int getNextIndexInMap(int i)
{
- int next = (m_xpath.m_patternMap[i] >= TARGETEXTRA)
- ? -1 : (((i+1) < m_xpath.m_patternMapSize)
- ? (i+1) : -1);
+ int next = (m_xpath.m_patternMap[i] >= TARGETEXTRA)
+ ? -1 : (((i+1) < m_xpath.m_patternMapSize)
+ ? (i+1) : -1);
return next;
}
-
+
/**
- * This will return the index above the passed index that
+ * Return the index above the passed index that
* is the start if the next subpattern, or -1 if there is none.
- * If there is no next target, it will return -1.
+ * If there is no next target, return -1.
* Pass -1 in to start testing from zero.
*/
int getNextSubpatternStartIndexInMap(int i)
@@ -694,8 +692,8 @@
}
else
{
- // loop to find the next element that is marked
- // as a target element, then go one passed it to
+ // loop to find the next element that is marked
+ // as a target element, then go one passed it to
// return the next subpattern start index in the map.
for(int k = i; k < m_xpath.m_patternMapSize; k++)
{
@@ -714,8 +712,8 @@
}
/**
- * This will return the next index from the passed index,
- * or -1 if it the passed index is the last index of the
+ * Return the next index from the passed index,
+ * or -1 if it the passed index is the last index of the
* subpattern.
*/
int getNextPatternPos(int i)
@@ -737,8 +735,8 @@
/**
- * This will return the previous index from the passed index,
- * or -1 if it the passed index is the first index of the
+ * Return the previous index from the passed index,
+ * or -1 if it the passed index is the first index of the
* subpattern.
*/
int getPrevMapIndex(int i)
@@ -759,9 +757,8 @@
/**
- * Check if m_token==s. If m_token is null, this won't throw
- * an exception, instead it just returns false (or true
- * if s is also null).
+ * Check whether m_token==s. If m_token is null, returns false (or true if
s is also null);
+ * do not throw an exception.
*/
private final boolean tokenIs( String s )
{
@@ -769,20 +766,19 @@
}
/**
- * Check if m_token==s. If m_token is null, this won't throw
- * an exception, instead it just returns false (or true
- * if s is also null).
+ * Check whether m_token==c. If m_token is null, returns false (or true if
c is also null);
+ * do not throw an exception.
*/
private final boolean tokenIs( char c )
{
return ( m_token!=null ) ? (m_tokenChar == c) : false;
}
-
+
/**
- * Lookahead of the current token in order to
+ * Look ahead of the current token in order to
* make a branching decision.
* @param s the string to compare it to.
- * @param n number of tokens to lookahead. Must be
+ * @param n number of tokens to look ahead. Must be
* greater than 1.
*/
private final boolean lookahead( char c, int n )
@@ -802,12 +798,12 @@
}
/**
- * Lookbehind the first character of the current token in order to
+ * Look behind the first character of the current token in order to
* make a branching decision.
* @param c the character to compare it to.
- * @param n number of tokens to lookbehind. Must be
- * greater than 1. Note that the lookbehind terminates
- * at either the beginning of the string or on a '|'
+ * @param n number of tokens to look behind. Must be
+ * greater than 1. Note that the look behind terminates
+ * at either the beginning of the string or on a '|'
* character. Because of this, this method should only
* be used for pattern matching.
*/
@@ -836,14 +832,14 @@
}
/**
- * look behind the current token in order to
+ * look behind the current token in order to
* see if there is a useable token.
- * @param n number of tokens to lookahead. Must be
- * greater than 1. Note that the lookbehind terminates
- * at either the beginning of the string or on a '|'
+ * @param n number of tokens to look behind. Must be
+ * greater than 1. Note that the look behind terminates
+ * at either the beginning of the string or on a '|'
* character. Because of this, this method should only
* be used for pattern matching.
- * @return true if lookbehind has a token, false otherwise.
+ * @return true if look behind has a token, false otherwise.
*/
private final boolean lookbehindHasToken( int n )
{
@@ -862,10 +858,10 @@
}
/**
- * Lookahead of the current token in order to
+ * Look ahead of the current token in order to
* make a branching decision.
* @param s the string to compare it to.
- * @param n number of tokens to lookahead. Must be
+ * @param n number of tokens to lookahead. Must be
* greater than 1.
*/
private final boolean lookahead( String s, int n )
@@ -882,7 +878,7 @@
}
return isToken;
}
-
+
/**
* Retrieve the next token from the command and
* store it in m_token string.
@@ -902,8 +898,8 @@
}
/**
- * Retrieve the next token from the command and
- * store it in m_token string.
+ * Retrieve a token relative to the current token.
+ * @param i Position relative to current token.
*/
private final String getTokenRelative(int i)
{
@@ -921,7 +917,7 @@
}
/**
- * Retrieve the next token from the command and
+ * Retrieve the previous token from the command and
* store it in m_token string.
*/
private final void prevToken()
@@ -940,8 +936,9 @@
}
/**
- * Reset token queue mark and m_token to a
+ * Reset token queue mark and m_token to a
* given position.
+ * @param mark The new position.
*/
private final void resetTokenMark(int mark)
{
@@ -958,9 +955,9 @@
m_tokenChar = 0;
}
}
-
+
/**
- * Consume an expected token, throwing an exception if it
+ * Consume an expected token, throwing an exception if it
* isn't there.
*/
private final void consumeExpected(String expected)
@@ -977,7 +974,7 @@
}
/**
- * Consume an expected token, throwing an exception if it
+ * Consume an expected token, throwing an exception if it
* isn't there.
*/
private final void consumeExpected(char expected)
@@ -992,7 +989,7 @@
error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND, new Object[]
{String.valueOf(expected), m_token}); //"Expected "+expected+", but found:
"+m_token);
}
}
-
+
// ============= DIAGNOSTIC & ERROR HANDLINING =================
private void ____DIAGNOSTICS_AND_ERRORS____(){}
@@ -1000,52 +997,55 @@
* If this is true, extra programmer error checks will be made.
*/
static public final boolean m_debug = false;
-
+
/**
- * If m_trace is set to true, trace strings will be written
- * out to System.out.
+ * If m_trace is set to true, trace strings will be written
+ * to System.out.
*/
static public final boolean m_trace = false;
-
+
private final void trace(String s)
{
System.out.println(s);
}
/**
- * Warn the user of an problem.
+ * Warn the user of a problem.
*/
public void warn(int msg)
throws XPathProcessorException
{
warn(null, msg, null);
}
-
+
+ /**
+ * Warn the user of a problem.
+ */
public void warn(int msg, Object[]args)
throws XPathProcessorException
{
warn(null, msg, args);
}
-
+
/**
- * Warn the user of an problem.
+ * Warn the user of a problem.
*/
public void warn(Node sourceNode, int msg)
throws XPathProcessorException
{
warn(sourceNode, msg, null);
- }
+ }
/**
- * Warn the user of an problem.
+ * Warn the user of a problem.
*/
public void warn(Node sourceNode, int msg, Object[] args)
throws XPathProcessorException
{
- String fmsg = XSLMessages.createXPATHWarning(msg, args);
- boolean shouldThrow =
m_xpath.getProblemListener().problem(ProblemListener.XPATHPARSER,
+ String fmsg = XSLMessages.createXPATHWarning(msg, args);
+ boolean shouldThrow =
m_xpath.getProblemListener().problem(ProblemListener.XPATHPARSER,
ProblemListener.WARNING,
- m_namespaceContext,
+ m_namespaceContext,
sourceNode, fmsg,
null, 0, 0);
if(shouldThrow)
{
@@ -1054,7 +1054,7 @@
}
/**
- * Tell the user of an assertion error, and probably throw an
+ * Notify the user of an assertion error, and probably throw an
* exception.
*/
private void assert(boolean b, String msg)
@@ -1065,7 +1065,7 @@
}
/**
- * Tell the user of an error, and probably throw an
+ * Notify the user of an error, and probably throw an
* exception.
*/
public void error(int msg)
@@ -1075,7 +1075,7 @@
}
/**
- * Tell the user of an error, and probably throw an
+ * Notify the user of an error, and probably throw an
* exception.
*/
public void error(int msg, Object[] args)
@@ -1083,9 +1083,9 @@
{
error(null, msg, args);
}
-
+
/**
- * Tell the user of an error, and probably throw an
+ * Notify the user of an error, and probably throw an
* exception.
*/
public void error(Node sourceNode, int msg)
@@ -1095,30 +1095,30 @@
}
/**
- * Tell the user of an error, and probably throw an
+ * Notify the user of an error, and probably throw an
* exception.
*/
public void error(Node sourceNode, int msg, Object[] args)
throws XPathProcessorException
{
- String fmsg = XSLMessages.createXPATHMessage(msg, args);
- String emsg = ((null != m_xpath.m_currentPattern)
+ String fmsg = XSLMessages.createXPATHMessage(msg, args);
+ String emsg = ((null != m_xpath.m_currentPattern)
? ("pattern = '"+m_xpath.m_currentPattern+"'\n") : "") +
fmsg + dumpRemainingTokenQueue();
- boolean shouldThrow =
m_xpath.getProblemListener().problem(ProblemListener.XPATHPARSER,
+ boolean shouldThrow =
m_xpath.getProblemListener().problem(ProblemListener.XPATHPARSER,
ProblemListener.ERROR,
-
m_namespaceContext,
+
m_namespaceContext,
sourceNode, emsg, null, 0, 0);
if(shouldThrow)
{
throw new XPathProcessorException(emsg);
}
}
-
+
/**
* Dump the remaining token queue.
- * Thanks be to Craig for this.
+ * Thanks to Craig for this.
*/
protected String dumpRemainingTokenQueue()
{
@@ -1127,7 +1127,7 @@
if(q < m_xpath.m_tokenQueueSize)
{
String msg = "\n Remaining tokens: (";
- while (q < m_xpath.m_tokenQueueSize )
+ while (q < m_xpath.m_tokenQueueSize )
{
String t = (String)m_xpath.m_tokenQueue[q++];
msg += (" '" + t + "'");
@@ -1140,13 +1140,13 @@
}
return returnMsg;
}
-
+
/**
- * This value is added to each element name in the TARGETEXTRA
- * that is a 'target', (right-most top level element name).
+ * This value is added to each element name in the TARGETEXTRA
+ * that is a 'target' (right-most top-level element name).
*/
static final int TARGETEXTRA = 10000;
-
+
// These are used mainly for keys in the pattern lookup table,
// for those nodes that don't have unique lookup values
public static final String PSEUDONAME_ANY = "*";
@@ -1174,7 +1174,7 @@
private static final String FROM_PRECEDING_SIBLINGS_STRING =
"preceding-sibling";
private static final String FROM_SELF_STRING = "self";
private static final String FROM_NAMESPACE_STRING = "namespace";
-
+
private static final String FROM_SELF_ABBREVIATED_STRING = ".";
private static final String NODETYPE_COMMENT_STRING = "comment";
private static final String NODETYPE_TEXT_STRING = "text";
@@ -1230,7 +1230,7 @@
// Proprietary, built in functions
private static final String FUNC_DOCLOCATION_STRING = "document-location";
- static
+ static
{
m_axisnames.put(new StringKey(FROM_ANCESTORS_STRING), new
Integer(XPath.FROM_ANCESTORS));
m_axisnames.put(new StringKey(FROM_ANCESTORS_OR_SELF_STRING), new
Integer(XPath.FROM_ANCESTORS_OR_SELF));
@@ -1251,7 +1251,7 @@
m_nodetypes.put(new StringKey(NODETYPE_PI_STRING), new
Integer(XPath.NODETYPE_PI));
m_nodetypes.put(new StringKey(NODETYPE_NODE_STRING), new
Integer(XPath.NODETYPE_NODE));
m_nodetypes.put(new StringKey(NODETYPE_ANYELEMENT_STRING), new
Integer(XPath.NODETYPE_ANYELEMENT));
-
+
m_keywords.put(new StringKey(FROM_SELF_ABBREVIATED_STRING), new
Integer(XPath.FROM_SELF));
// m_keywords.put(new StringKey(FROM_ATTRIBUTE_STRING), new
Integer(XPath.FROM_ATTRIBUTE));
// m_keywords.put(new StringKey(FROM_DOC_STRING), new
Integer(XPath.FROM_DOC));
@@ -1299,18 +1299,18 @@
m_functions.put(new StringKey(FUNC_SUBSTRING_STRING), new
Integer(XPath.FUNC_SUBSTRING));
m_functions.put(new StringKey(FUNC_STRING_LENGTH_STRING), new
Integer(XPath.FUNC_STRING_LENGTH));
m_functions.put(new StringKey(FUNC_UNPARSED_ENTITY_URI_STRING), new
Integer(XPath.FUNC_UNPARSED_ENTITY_URI));
-
+
// These aren't really functions.
m_functions.put(new StringKey(NODETYPE_COMMENT_STRING), new
Integer(XPath.NODETYPE_COMMENT));
m_functions.put(new StringKey(NODETYPE_TEXT_STRING), new
Integer(XPath.NODETYPE_TEXT));
m_functions.put(new StringKey(NODETYPE_PI_STRING), new
Integer(XPath.NODETYPE_PI));
m_functions.put(new StringKey(NODETYPE_NODE_STRING), new
Integer(XPath.NODETYPE_NODE));
-
+
m_functions.put(new StringKey(FUNC_DOCLOCATION_STRING), new
Integer(XPath.FUNC_DOCLOCATION));
}
-
+
/**
- * Given a string, return the corrisponding token.
+ * Given a string, return the corresponding keyword token.
*/
final int getKeywordToken(String key)
{
@@ -1332,7 +1332,7 @@
}
/**
- * Given a string, return the corrisponding token.
+ * Given a string, return the corresponding function token.
*/
final int getFunctionToken(String key)
{
@@ -1351,9 +1351,9 @@
}
return tok;
}
-
+
private void ___________PARSER___________(){}
-
+
/**
* Insert room for operation. This will NOT set
* the length value of the operation, but will update
@@ -1385,27 +1385,27 @@
// ============= EXPRESSIONS FUNCTIONS =================
private void ____EXPRESSIONS____(){}
-
+
/**
- *
- *
--------------------------------------------------------------------------------
- Expr ::= OrExpr
- *
--------------------------------------------------------------------------------
+ *
+ *
+ * Expr ::= OrExpr
+ *
*/
- protected void Expr()
+ protected void Expr()
throws org.xml.sax.SAXException
{
OrExpr();
}
/**
- *
- *
--------------------------------------------------------------------------------
- OrExpr ::= AndExpr
- | OrExpr 'or' AndExpr
- *
--------------------------------------------------------------------------------
+ *
+ *
+ * OrExpr ::= AndExpr
+ * | OrExpr 'or' AndExpr
+ *
*/
- protected void OrExpr()
+ protected void OrExpr()
throws org.xml.sax.SAXException
{
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
@@ -1415,19 +1415,19 @@
nextToken();
insertOp(opPos, 2, m_xpath.OP_OR);
OrExpr();
- m_xpath.m_opMap[opPos + m_xpath.MAPINDEX_LENGTH]
+ m_xpath.m_opMap[opPos + m_xpath.MAPINDEX_LENGTH]
= m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - opPos;
}
}
/**
- *
- *
--------------------------------------------------------------------------------
- AndExpr ::= EqualityExpr
- | AndExpr 'and' EqualityExpr
- *
--------------------------------------------------------------------------------
+ *
+ *
+ * AndExpr ::= EqualityExpr
+ * | AndExpr 'and' EqualityExpr
+ *
*/
- protected void AndExpr()
+ protected void AndExpr()
throws org.xml.sax.SAXException
{
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
@@ -1440,17 +1440,17 @@
m_xpath.m_opMap[opPos + m_xpath.MAPINDEX_LENGTH] =
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - opPos;
}
}
-
+
/**
- * XXXX.
- * @returns an Object which is either a String, a Number, a Boolean, or a
vector
+ *
+ * @returns an Object which is either a String, a Number, a Boolean, or a
vector
* of nodes.
- *
--------------------------------------------------------------------------------
- EqualityExpr ::= RelationalExpr
- | EqualityExpr '=' RelationalExpr
- *
--------------------------------------------------------------------------------
+ *
+ * EqualityExpr ::= RelationalExpr
+ * | EqualityExpr '=' RelationalExpr
+ *
*/
- protected int EqualityExpr(int addPos)
+ protected int EqualityExpr(int addPos)
throws org.xml.sax.SAXException
{
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
@@ -1466,7 +1466,7 @@
insertOp(addPos, 2, m_xpath.OP_NOTEQUALS);
int opPlusLeftHandLen = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] -
addPos;
addPos = EqualityExpr(addPos);
- m_xpath.m_opMap[addPos + m_xpath.MAPINDEX_LENGTH]
+ m_xpath.m_opMap[addPos + m_xpath.MAPINDEX_LENGTH]
= m_xpath.m_opMap[addPos+opPlusLeftHandLen+1] + opPlusLeftHandLen;
addPos+=2;
}
@@ -1476,7 +1476,7 @@
insertOp(addPos, 2, m_xpath.OP_EQUALS);
int opPlusLeftHandLen = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] -
addPos;
addPos = EqualityExpr(addPos);
- m_xpath.m_opMap[addPos + m_xpath.MAPINDEX_LENGTH]
+ m_xpath.m_opMap[addPos + m_xpath.MAPINDEX_LENGTH]
= m_xpath.m_opMap[addPos+opPlusLeftHandLen+1] + opPlusLeftHandLen;
addPos+=2;
}
@@ -1485,18 +1485,18 @@
}
/**
- * XXXX.
- * @returns an Object which is either a String, a Number, a Boolean, or a
vector
+ * .
+ * @returns an Object which is either a String, a Number, a Boolean, or a
vector
* of nodes.
- *
--------------------------------------------------------------------------------
- RelationalExpr ::= AdditiveExpr
- | RelationalExpr '<' AdditiveExpr
- | RelationalExpr '>' AdditiveExpr
- | RelationalExpr '<=' AdditiveExpr
- | RelationalExpr '>=' AdditiveExpr
- *
--------------------------------------------------------------------------------
+ *
+ * RelationalExpr ::= AdditiveExpr
+ * | RelationalExpr '<' AdditiveExpr
+ * | RelationalExpr '>' AdditiveExpr
+ * | RelationalExpr '<=' AdditiveExpr
+ * | RelationalExpr '>=' AdditiveExpr
+ *
*/
- protected int RelationalExpr(int addPos)
+ protected int RelationalExpr(int addPos)
throws org.xml.sax.SAXException
{
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
@@ -1519,7 +1519,7 @@
}
int opPlusLeftHandLen = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] -
addPos;
addPos = RelationalExpr(addPos);
- m_xpath.m_opMap[addPos + m_xpath.MAPINDEX_LENGTH]
+ m_xpath.m_opMap[addPos + m_xpath.MAPINDEX_LENGTH]
= m_xpath.m_opMap[addPos+opPlusLeftHandLen+1] + opPlusLeftHandLen;
addPos+=2;
}
@@ -1537,7 +1537,7 @@
}
int opPlusLeftHandLen = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] -
addPos;
addPos = RelationalExpr(addPos);
- m_xpath.m_opMap[addPos + m_xpath.MAPINDEX_LENGTH]
+ m_xpath.m_opMap[addPos + m_xpath.MAPINDEX_LENGTH]
= m_xpath.m_opMap[addPos+opPlusLeftHandLen+1] + opPlusLeftHandLen;
addPos+=2;
}
@@ -1547,19 +1547,19 @@
/**
* XXXX.
- * @returns an Object which is either a String, a Number, a Boolean, or a
vector
+ * @returns an Object which is either a String, a Number, a Boolean, or a
vector
* of nodes.
- * This has to handle construction of the operations so that they are
evaluated
- * in pre-fix order. So, for 9+7-6, instead of |+|9|-|7|6|, this needs to
be
+ * This has to handle construction of the operations so that they are
evaluated
+ * in pre-fix order. So, for 9+7-6, instead of |+|9|-|7|6|, this needs to
be
* evaluated as |-|+|9|7|6|.
* @param addPos The position where the op should be inserted.
- *
--------------------------------------------------------------------------------
- AdditiveExpr ::= MultiplicativeExpr
- | AdditiveExpr '+' MultiplicativeExpr
- | AdditiveExpr '-' MultiplicativeExpr
- *
--------------------------------------------------------------------------------
+ *
+ * AdditiveExpr ::= MultiplicativeExpr
+ * | AdditiveExpr '+' MultiplicativeExpr
+ * | AdditiveExpr '-' MultiplicativeExpr
+ *
*/
- protected int AdditiveExpr(int addPos)
+ protected int AdditiveExpr(int addPos)
throws org.xml.sax.SAXException
{
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
@@ -1574,7 +1574,7 @@
insertOp(addPos, 2, m_xpath.OP_PLUS);
int opPlusLeftHandLen = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] -
addPos;
addPos = AdditiveExpr(addPos);
- m_xpath.m_opMap[addPos + m_xpath.MAPINDEX_LENGTH]
+ m_xpath.m_opMap[addPos + m_xpath.MAPINDEX_LENGTH]
= m_xpath.m_opMap[addPos+opPlusLeftHandLen+1] + opPlusLeftHandLen;
addPos+=2;
}
@@ -1584,7 +1584,7 @@
insertOp(addPos, 2, m_xpath.OP_MINUS);
int opPlusLeftHandLen = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] -
addPos;
addPos = AdditiveExpr(addPos);
- m_xpath.m_opMap[addPos + m_xpath.MAPINDEX_LENGTH]
+ m_xpath.m_opMap[addPos + m_xpath.MAPINDEX_LENGTH]
= m_xpath.m_opMap[addPos+opPlusLeftHandLen+1] + opPlusLeftHandLen;
addPos+=2;
}
@@ -1594,21 +1594,21 @@
/**
* XXXX.
- * @returns an Object which is either a String, a Number, a Boolean, or a
vector
+ * @returns an Object which is either a String, a Number, a Boolean, or a
vector
* of nodes.
- * This has to handle construction of the operations so that they are
evaluated
- * in pre-fix order. So, for 9+7-6, instead of |+|9|-|7|6|, this needs to
be
+ * This has to handle construction of the operations so that they are
evaluated
+ * in pre-fix order. So, for 9+7-6, instead of |+|9|-|7|6|, this needs to
be
* evaluated as |-|+|9|7|6|.
* @param addPos The position where the op should be inserted.
- *
--------------------------------------------------------------------------------
- MultiplicativeExpr ::= UnaryExpr
- | MultiplicativeExpr MultiplyOperator UnaryExpr
- | MultiplicativeExpr 'div' UnaryExpr
- | MultiplicativeExpr 'mod' UnaryExpr
- | MultiplicativeExpr 'quo' UnaryExpr
- *
--------------------------------------------------------------------------------
+ *
+ * MultiplicativeExpr ::= UnaryExpr
+ * | MultiplicativeExpr MultiplyOperator UnaryExpr
+ * | MultiplicativeExpr 'div' UnaryExpr
+ * | MultiplicativeExpr 'mod' UnaryExpr
+ * | MultiplicativeExpr 'quo' UnaryExpr
+ *
*/
- protected int MultiplicativeExpr(int addPos)
+ protected int MultiplicativeExpr(int addPos)
throws org.xml.sax.SAXException
{
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
@@ -1623,9 +1623,9 @@
insertOp(opPos, 2, m_xpath.OP_MULT);
int opPlusLeftHandLen = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] -
addPos;
addPos = MultiplicativeExpr(addPos);
- m_xpath.m_opMap[addPos + m_xpath.MAPINDEX_LENGTH]
+ m_xpath.m_opMap[addPos + m_xpath.MAPINDEX_LENGTH]
= m_xpath.m_opMap[addPos+opPlusLeftHandLen+1] + opPlusLeftHandLen;
- addPos+=2;
+ addPos+=2;
}
else if(tokenIs("div"))
{
@@ -1633,9 +1633,9 @@
insertOp(opPos, 2, m_xpath.OP_DIV);
int opPlusLeftHandLen = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] -
addPos;
addPos = MultiplicativeExpr(addPos);
- m_xpath.m_opMap[addPos + m_xpath.MAPINDEX_LENGTH]
+ m_xpath.m_opMap[addPos + m_xpath.MAPINDEX_LENGTH]
= m_xpath.m_opMap[addPos+opPlusLeftHandLen+1] + opPlusLeftHandLen;
- addPos+=2;
+ addPos+=2;
}
else if(tokenIs("mod"))
{
@@ -1643,9 +1643,9 @@
insertOp(opPos, 2, m_xpath.OP_MOD);
int opPlusLeftHandLen = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] -
addPos;
addPos = MultiplicativeExpr(addPos);
- m_xpath.m_opMap[addPos + m_xpath.MAPINDEX_LENGTH]
+ m_xpath.m_opMap[addPos + m_xpath.MAPINDEX_LENGTH]
= m_xpath.m_opMap[addPos+opPlusLeftHandLen+1] + opPlusLeftHandLen;
- addPos+=2;
+ addPos+=2;
}
else if(tokenIs("quo"))
{
@@ -1653,9 +1653,9 @@
insertOp(opPos, 2, m_xpath.OP_QUO);
int opPlusLeftHandLen = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] -
addPos;
addPos = MultiplicativeExpr(addPos);
- m_xpath.m_opMap[addPos + m_xpath.MAPINDEX_LENGTH]
+ m_xpath.m_opMap[addPos + m_xpath.MAPINDEX_LENGTH]
= m_xpath.m_opMap[addPos+opPlusLeftHandLen+1] + opPlusLeftHandLen;
- addPos+=2;
+ addPos+=2;
}
}
return addPos;
@@ -1663,14 +1663,14 @@
/**
* XXXX.
- * @returns an Object which is either a String, a Number, a Boolean, or a
vector
+ * @returns an Object which is either a String, a Number, a Boolean, or a
vector
* of nodes.
- *
--------------------------------------------------------------------------------
- UnaryExpr ::= UnionExpr
- | '-' UnaryExpr
- *
--------------------------------------------------------------------------------
+ *
+ * UnaryExpr ::= UnionExpr
+ * | '-' UnaryExpr
+ *
*/
- protected void UnaryExpr()
+ protected void UnaryExpr()
throws org.xml.sax.SAXException
{
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
@@ -1685,11 +1685,11 @@
if(isNeg)
m_xpath.m_opMap[opPos + m_xpath.MAPINDEX_LENGTH] =
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - opPos;
}
-
+
/**
- *
--------------------------------------------------------------------------------
- StringExpr ::= Expr
- *
--------------------------------------------------------------------------------
+ *
+ * StringExpr ::= Expr
+ *
*/
protected void StringExpr()
throws org.xml.sax.SAXException
@@ -1701,12 +1701,12 @@
}
/**
- *
- *
--------------------------------------------------------------------------------
- StringExpr ::= Expr
- *
--------------------------------------------------------------------------------
+ *
+ *
+ * StringExpr ::= Expr
+ *
*/
- protected void BooleanExpr()
+ protected void BooleanExpr()
throws org.xml.sax.SAXException
{
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
@@ -1721,12 +1721,12 @@
}
/**
- *
- *
--------------------------------------------------------------------------------
- NumberExpr ::= Expr
- *
--------------------------------------------------------------------------------
+ *
+ *
+ * NumberExpr ::= Expr
+ *
*/
- protected void NumberExpr()
+ protected void NumberExpr()
throws org.xml.sax.SAXException
{
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
@@ -1734,28 +1734,28 @@
Expr();
m_xpath.m_opMap[opPos + m_xpath.MAPINDEX_LENGTH] =
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - opPos;
}
-
+
/**
- * The context of the right hand side expressions is the context of the
- * left hand side expression. The results of the right hand side
expressions
- * are node sets. The result of the left hand side UnionExpr is the union
+ * The context of the right hand side expressions is the context of the
+ * left hand side expression. The results of the right hand side
expressions
+ * are node sets. The result of the left hand side UnionExpr is the union
* of the results of the right hand side expressions.
- *
- *
--------------------------------------------------------------------------------
- UnionExpr ::= PathExpr
- | UnionExpr '|' PathExpr
- *
--------------------------------------------------------------------------------
+ *
+ *
+ * UnionExpr ::= PathExpr
+ * | UnionExpr '|' PathExpr
+ *
*/
- protected void UnionExpr()
+ protected void UnionExpr()
throws org.xml.sax.SAXException
{
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
boolean continueOrLoop = true;
boolean foundUnion = false;
- do
+ do
{
PathExpr();
-
+
if(tokenIs('|'))
{
if(false == foundUnion)
@@ -1775,9 +1775,9 @@
while(continueOrLoop);
m_xpath.m_opMap[opPos + m_xpath.MAPINDEX_LENGTH] =
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - opPos;
}
-
+
/**
- * Analyze a union pattern and tell if the axes are
+ * Analyze a union pattern and tell if the axes are
* all descendants.
* (Move to XPath?)
*/
@@ -1786,11 +1786,11 @@
if(true)
{
int posOfLastOp = xpath.getNextOpPos(opPos)-1;
-
+
opPos = xpath.getFirstChildPos(opPos);
// step
int stepType = xpath.m_opMap[opPos];
-
+
// make sure all step types are going forwards
switch(stepType)
{
@@ -1803,11 +1803,11 @@
case XPath.FROM_FOLLOWING_SIBLINGS:
if(xpath.m_opMap[xpath.getNextOpPos(opPos)] == xpath.ENDOP)
{
- // Add the length of the step itself, plus the length of the op,
+ // Add the length of the step itself, plus the length of the op,
// and two length arguments, to the op position.
opPos =
(xpath.getArgLengthOfStep(opPos)+xpath.getFirstChildPosOfStep(opPos));
int nextStepType = xpath.m_opMap[opPos];
-
+
if(xpath.OP_PREDICATE == nextStepType)
{
int firstPredPos = opPos+2;
@@ -1837,17 +1837,17 @@
/**
- *
- *
--------------------------------------------------------------------------------
- PathExpr ::= LocationPath
- | FilterExpr
- | FilterExpr '/' RelativeLocationPath
- | FilterExpr '//' RelativeLocationPath
- *
--------------------------------------------------------------------------------
- * @exception XSLProcessorException thrown if the active ProblemListener
and XMLParserLiaison decide
+ *
+ *
+ * PathExpr ::= LocationPath
+ * | FilterExpr
+ * | FilterExpr '/' RelativeLocationPath
+ * | FilterExpr '//' RelativeLocationPath
+ *
+ * @exception XSLProcessorException thrown if the active ProblemListener
and XMLParserLiaison decide
* the error condition is severe enough to halt processing.
*/
- protected void PathExpr()
+ protected void PathExpr()
throws org.xml.sax.SAXException
{
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
@@ -1875,31 +1875,31 @@
}
/**
- *
- *
--------------------------------------------------------------------------------
- FilterExpr ::= PrimaryExpr
- | FilterExpr Predicate
- *
--------------------------------------------------------------------------------
- * @exception XSLProcessorException thrown if the active ProblemListener
and XMLParserLiaison decide
+ *
+ *
+ * FilterExpr ::= PrimaryExpr
+ * | FilterExpr Predicate
+ *
+ * @exception XSLProcessorException thrown if the active ProblemListener
and XMLParserLiaison decide
* the error condition is severe enough to halt processing.
*/
- protected void FilterExpr()
+ protected void FilterExpr()
throws org.xml.sax.SAXException
{
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
// boolean isFunc = lookahead('(', 1);
PrimaryExpr();
-
+
if(tokenIs('['))
{
int locationPathOpPos = opPos;
insertOp(opPos, 2, m_xpath.OP_LOCATIONPATH);
-
+
while(tokenIs('['))
{
Predicate();
}
-
+
if(tokenIs('/'))
{
nextToken();
@@ -1918,24 +1918,24 @@
}
/*
- if(tokenIs('['))
- {
- Predicate();
- m_xpath.m_opMap[opPos + m_xpath.MAPINDEX_LENGTH] =
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - opPos;
- }
- */
+ * if(tokenIs('['))
+ * {
+ * Predicate();
+ * m_xpath.m_opMap[opPos + m_xpath.MAPINDEX_LENGTH] =
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - opPos;
+ * }
+ */
}
-
+
/**
- *
--------------------------------------------------------------------------------
- PrimaryExpr ::= VariableReference
- | '(' Expr ')'
- | Literal
- | Number
- | FunctionCall
- *
--------------------------------------------------------------------------------
+ *
+ * PrimaryExpr ::= VariableReference
+ * | '(' Expr ')'
+ * | Literal
+ * | Number
+ * | FunctionCall
+ *
*/
- protected void PrimaryExpr()
+ protected void PrimaryExpr()
throws org.xml.sax.SAXException
{
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
@@ -1949,7 +1949,7 @@
{
nextToken(); // consume '$'
appendOp(2, m_xpath.OP_VARIABLE);
-
+
NCName();
m_xpath.m_opMap[opPos + m_xpath.MAPINDEX_LENGTH] =
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - opPos;
}
@@ -1961,9 +1961,9 @@
consumeExpected(')');
m_xpath.m_opMap[opPos + m_xpath.MAPINDEX_LENGTH] =
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - opPos;
}
- else if((null != m_token) &&
- ((('.' == m_tokenChar) && (m_token.length() > 1) &&
- Character.isDigit( m_token.charAt(1) ))
+ else if((null != m_token) &&
+ ((('.' == m_tokenChar) && (m_token.length() > 1) &&
+ Character.isDigit( m_token.charAt(1) ))
|| Character.isDigit( m_tokenChar )))
{
appendOp(2, m_xpath.OP_NUMBERLIT);
@@ -1979,13 +1979,13 @@
LocationPath();
}
}
-
+
/**
- *
--------------------------------------------------------------------------------
- Argument ::= Expr
- *
--------------------------------------------------------------------------------
+ *
+ * Argument ::= Expr
+ *
*/
- protected void Argument()
+ protected void Argument()
throws org.xml.sax.SAXException
{
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
@@ -1993,13 +1993,13 @@
Expr();
m_xpath.m_opMap[opPos + m_xpath.MAPINDEX_LENGTH] =
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - opPos;
}
-
+
/**
- *
--------------------------------------------------------------------------------
- FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument)*)? ')'
- *
--------------------------------------------------------------------------------
+ *
+ * FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument)*)?
')'
+ *
*/
- protected void FunctionCall()
+ protected void FunctionCall()
throws org.xml.sax.SAXException
{
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
@@ -2063,18 +2063,18 @@
private void ____LOCATION_PATHS____(){}
/**
- *
--------------------------------------------------------------------------------
- LocationPath ::= RelativeLocationPath
- | AbsoluteLocationPath
- *
--------------------------------------------------------------------------------
+ *
+ * LocationPath ::= RelativeLocationPath
+ * | AbsoluteLocationPath
+ *
*/
- protected void LocationPath()
+ protected void LocationPath()
throws org.xml.sax.SAXException
{
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
int locationPathOpPos = opPos;
appendOp(2, m_xpath.OP_LOCATIONPATH);
-
+
if(tokenIs('/'))
{
appendOp(4, m_xpath.FROM_ROOT);
@@ -2087,26 +2087,26 @@
{
RelativeLocationPath();
}
-
+
// Terminate for safety.
m_xpath.m_opMap[m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH]] =
m_xpath.ENDOP;
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] += 1;
-
+
m_xpath.m_opMap[opPos + m_xpath.MAPINDEX_LENGTH] =
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - opPos;
if(isLocationPathSimpleFollowing(m_xpath, locationPathOpPos))
- {
+ {
m_xpath.m_opMap[locationPathOpPos] = XPath.OP_LOCATIONPATH_EX;
}
}
-
+
/**
- *
--------------------------------------------------------------------------------
- RelativeLocationPath ::= Step
- | RelativeLocationPath '/' Step
- | AbbreviatedRelativeLocationPath
- *
--------------------------------------------------------------------------------
+ *
+ * RelativeLocationPath ::= Step
+ * | RelativeLocationPath '/' Step
+ * | AbbreviatedRelativeLocationPath
+ *
*/
- protected void RelativeLocationPath()
+ protected void RelativeLocationPath()
throws org.xml.sax.SAXException
{
Step();
@@ -2116,18 +2116,18 @@
Step();
}
}
-
-
+
+
/**
- *
--------------------------------------------------------------------------------
- Step ::= Basis Predicate*
- | AbbreviatedStep
+ *
+ * Step ::= Basis Predicate*
+ * | AbbreviatedStep
*/
- protected void Step()
+ protected void Step()
throws org.xml.sax.SAXException
{
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
-
+
if(tokenIs("."))
{
nextToken();
@@ -2149,29 +2149,29 @@
m_xpath.m_opMap[m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - 1] =
m_xpath.NODETYPE_NODE;
}
else
- {
+ {
Basis();
-
+
while(tokenIs('['))
{
Predicate();
}
-
+
// Tell how long the entire step is.
m_xpath.m_opMap[opPos + m_xpath.MAPINDEX_LENGTH] =
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - opPos;
}
}
-
+
/**
- *
--------------------------------------------------------------------------------
- Basis ::= AxisName '::' NodeTest
- | AbbreviatedBasis
+ *
+ * Basis ::= AxisName '::' NodeTest
+ * | AbbreviatedBasis
*/
- protected void Basis()
+ protected void Basis()
throws org.xml.sax.SAXException
{
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
-
+
// The next blocks guarantee that a FROM_XXX will be added.
if(lookahead("::", 1))
{
@@ -2187,10 +2187,10 @@
else if(tokenIs('/'))
{
appendOp(2, m_xpath.FROM_DESCENDANTS_OR_SELF);
-
+
// Have to fix up for patterns such as '//@foo' or '//attribute::foo',
// which translate to 'descendant-or-self::node()/attribute::foo'.
- // notice I leave the '/' on the queue, so the next will be processed
+ // notice I leave the '/' on the queue, so the next will be processed
// by a regular step pattern.
// if(lookahead('@', 1) || lookahead("::", 2))
{
@@ -2202,7 +2202,7 @@
// Tell how long the step is without the predicate
m_xpath.m_opMap[opPos + m_xpath.MAPINDEX_LENGTH + 1] =
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - opPos;
-
+
return; // make a quick exit...
}
// else
@@ -2214,7 +2214,7 @@
{
appendOp(2, m_xpath.FROM_CHILDREN);
}
-
+
// Make room for telling how long the step is without the predicate
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] += 1;
@@ -2223,13 +2223,13 @@
// Tell how long the step is without the predicate
m_xpath.m_opMap[opPos + m_xpath.MAPINDEX_LENGTH + 1] =
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - opPos;
}
-
+
/**
- *
--------------------------------------------------------------------------------
- Basis ::= AxisName '::' NodeTest
- | AbbreviatedBasis
+ *
+ * Basis ::= AxisName '::' NodeTest
+ * | AbbreviatedBasis
*/
- protected void AxisName()
+ protected void AxisName()
throws org.xml.sax.SAXException
{
Object val = m_axisnames.get(m_token);
@@ -2239,15 +2239,15 @@
}
appendOp(2, ((Integer)val).intValue());
}
+
-
/**
- *
--------------------------------------------------------------------------------
- NodeTest ::= WildcardName
- | NodeType '(' ')'
- | 'processing-instruction' '(' Literal ')'
+ *
+ * NodeTest ::= WildcardName
+ * | NodeType '(' ')'
+ * | 'processing-instruction' '(' Literal ')'
*/
- protected void NodeTest()
+ protected void NodeTest()
throws org.xml.sax.SAXException
{
if(lookahead('(', 1))
@@ -2263,7 +2263,7 @@
int nt = ((Integer)nodeTestOp).intValue();
m_xpath.m_opMap[m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH]] = nt;
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] += 1;
-
+
consumeExpected('(');
if(m_xpath.NODETYPE_PI == nt)
{
@@ -2284,7 +2284,7 @@
{
if(tokenIs('*'))
{
- m_xpath.m_opMap[m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH]]
+ m_xpath.m_opMap[m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH]]
= m_xpath.ELEMWILDCARD;
}
else
@@ -2299,7 +2299,7 @@
m_xpath.m_opMap[m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH]] =
m_xpath.EMPTY;
}
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] += 1;
-
+
if(tokenIs('*'))
{
m_xpath.m_opMap[m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH]] =
m_xpath.ELEMWILDCARD;
@@ -2315,25 +2315,25 @@
}
/**
- *
--------------------------------------------------------------------------------
- Predicate ::= '[' PredicateExpr ']'
- *
--------------------------------------------------------------------------------
+ *
+ * Predicate ::= '[' PredicateExpr ']'
+ *
*/
- protected void Predicate()
+ protected void Predicate()
throws org.xml.sax.SAXException
{
if(tokenIs('['))
{
nextToken();
- PredicateExpr();
+ PredicateExpr();
consumeExpected(']');
}
}
/**
-
*--------------------------------------------------------------------------------
- PredicateExpr ::= Expr
-
*--------------------------------------------------------------------------------
+ *
+ * PredicateExpr ::= Expr
+ *
*/
protected void PredicateExpr()
throws org.xml.sax.SAXException
@@ -2341,18 +2341,18 @@
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
appendOp(2, m_xpath.OP_PREDICATE);
Expr();
-
+
// Terminate for safety.
m_xpath.m_opMap[m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH]] =
m_xpath.ENDOP;
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] += 1;
-
+
m_xpath.m_opMap[opPos + m_xpath.MAPINDEX_LENGTH] =
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - opPos;
}
-
+
/**
- * QName ::= (Prefix ':')? LocalPart
- * Prefix ::= NCName
- * LocalPart ::= NCName
+ * QName ::= (Prefix ':')? LocalPart
+ * Prefix ::= NCName
+ * LocalPart ::= NCName
*/
protected void QName()
throws org.xml.sax.SAXException
@@ -2368,7 +2368,7 @@
/**
* NCName ::= (Letter | '_') (NCNameChar)*
- * NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar |
Extender
+ * NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar |
Extender
*/
protected void NCName()
{
@@ -2376,14 +2376,14 @@
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] += 1;
nextToken();
}
-
+
/**
- * The value of the Literal is the sequence of characters inside
+ * The value of the Literal is the sequence of characters inside
* the " or ' characters>.
- *
--------------------------------------------------------------------------------
- Literal ::= '"' [^"]* '"'
- | "'" [^']* "'"
- *
--------------------------------------------------------------------------------
+ *
+ * Literal ::= '"' [^"]* '"'
+ * | "'" [^']* "'"
+ *
*/
protected void Literal()
throws org.xml.sax.SAXException
@@ -2410,11 +2410,11 @@
error(XPATHErrorResources.ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, new
Object[] {m_token}); //"Pattern literal ("+m_token+") needs to be quoted!");
}
}
-
+
/**
- *
--------------------------------------------------------------------------------
+ *
* Number ::= [0-9]+('.'[0-9]+)? | '.'[0-9]+
- *
--------------------------------------------------------------------------------
+ *
*/
protected void Number()
throws org.xml.sax.SAXException
@@ -2433,9 +2433,9 @@
num = 0.0; // to shut up compiler.
error(XPATHErrorResources.ER_COULDNOT_BE_FORMATTED_TO_NUMBER, new
Object[] {m_token}); //m_token+" could not be formatted to a number!");
}
- m_xpath.m_tokenQueue[m_queueMark-1]
+ m_xpath.m_tokenQueue[m_queueMark-1]
= new XNumber(num);
-
+
m_xpath.m_opMap[m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH]] =
m_queueMark - 1;
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] += 1;
nextToken();
@@ -2446,14 +2446,14 @@
private void ____PATTERNS____(){}
/**
- *
--------------------------------------------------------------------------------
- Pattern ::= LocationPathPattern
- | Pattern '|' LocationPathPattern
- *
--------------------------------------------------------------------------------
+ *
+ * Pattern ::= LocationPathPattern
+ * | Pattern '|' LocationPathPattern
+ *
*/
protected void Pattern()
throws org.xml.sax.SAXException
- {
+ {
while(true)
{
LocationPathPattern();
@@ -2468,18 +2468,18 @@
}
}
}
-
+
/**
- *
- *
--------------------------------------------------------------------------------
- LocationPathPattern ::= '/' RelativePathPattern?
- | IdKeyPattern (('/' | '//') RelativePathPattern)?
- | '//'? RelativePathPattern
- *
--------------------------------------------------------------------------------
+ *
+ *
+ * LocationPathPattern ::= '/' RelativePathPattern?
+ * | IdKeyPattern (('/' | '//') RelativePathPattern)?
+ * | '//'? RelativePathPattern
+ *
*/
- protected void LocationPathPattern()
+ protected void LocationPathPattern()
throws org.xml.sax.SAXException
- {
+ {
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
appendOp(2, m_xpath.OP_LOCATIONPATHPATTERN);
@@ -2496,7 +2496,7 @@
}
}
else if(tokenIs('/'))
- {
+ {
if(lookahead('/', 1))
{
appendOp(4, m_xpath.MATCH_ANY_ANCESTOR);
@@ -2510,42 +2510,42 @@
m_xpath.m_opMap[m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - 1] =
m_xpath.NODETYPE_ROOT;
nextToken();
}
-
+
if(!tokenIs('|') && (null != m_token))
{
RelativePathPattern();
}
-
+
// Terminate for safety.
m_xpath.m_opMap[m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH]] =
m_xpath.ENDOP;
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] += 1;
-
+
m_xpath.m_opMap[opPos + m_xpath.MAPINDEX_LENGTH] =
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - opPos;
}
/**
- *
--------------------------------------------------------------------------------
- IdKeyPattern ::= 'id' '(' Literal ')'
- | 'key' '(' Literal ',' Literal ')'
+ *
+ * IdKeyPattern ::= 'id' '(' Literal ')'
+ * | 'key' '(' Literal ',' Literal ')'
* (Also handle doc())
- *
--------------------------------------------------------------------------------
+ *
*/
- protected void IdKeyPattern()
+ protected void IdKeyPattern()
throws org.xml.sax.SAXException
{
FunctionCall();
}
/**
- *
--------------------------------------------------------------------------------
- RelativePathPattern ::= StepPattern
- | RelativePathPattern '/' StepPattern
- | RelativePathPattern '//' StepPattern
- *
--------------------------------------------------------------------------------
+ *
+ * RelativePathPattern ::= StepPattern
+ * | RelativePathPattern '/' StepPattern
+ * | RelativePathPattern '//' StepPattern
+ *
*/
- protected void RelativePathPattern()
+ protected void RelativePathPattern()
throws org.xml.sax.SAXException
- {
+ {
StepPattern();
while(tokenIs('/'))
{
@@ -2555,26 +2555,26 @@
}
/**
- *
--------------------------------------------------------------------------------
- StepPattern ::= AbbreviatedNodeTestStep
- *
--------------------------------------------------------------------------------
+ *
+ * StepPattern ::= AbbreviatedNodeTestStep
+ *
*/
- protected void StepPattern()
+ protected void StepPattern()
throws org.xml.sax.SAXException
{
AbbreviatedNodeTestStep( );
}
/**
- *
--------------------------------------------------------------------------------
- AbbreviatedNodeTestStep ::= '@'? NodeTest Predicate*
- *
--------------------------------------------------------------------------------
+ *
+ * AbbreviatedNodeTestStep ::= '@'? NodeTest Predicate*
+ *
*/
protected void AbbreviatedNodeTestStep()
throws org.xml.sax.SAXException
- {
+ {
int opPos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
-
+
// The next blocks guarantee that a MATCH_XXX will be added.
int matchTypePos = -1;
if(tokenIs('@'))
@@ -2613,10 +2613,10 @@
matchTypePos = m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH];
appendOp(2, m_xpath.MATCH_IMMEDIATE_ANCESTOR);
}
-
+
// Make room for telling how long the step is without the predicate
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] += 1;
-
+
NodeTest();
// Tell how long the step is without the predicate
@@ -2631,7 +2631,7 @@
m_xpath.m_opMap[matchTypePos] = m_xpath.MATCH_ANY_ANCESTOR;
nextToken();
}
-
+
// Tell how long the entire step is.
m_xpath.m_opMap[opPos + m_xpath.MAPINDEX_LENGTH] =
m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - opPos;
}
@@ -2639,9 +2639,9 @@
// ============= GRAMMAR FUNCTIONS =================
private void ____DIAGNOSTIC_FUNCTIONS____(){}
- public static void diagnoseXPathString( String str )
+ public static void diagnoseXPathString( String str )
throws org.xml.sax.SAXException
- {
+ {
XPathSupport callbacks = new XPathSupportDefault();
XPathProcessorImpl processor = new XPathProcessorImpl(callbacks);
XPath xpath = new XPath(callbacks, new
org.apache.xalan.xpath.xml.ProblemListenerDefault());
@@ -2653,11 +2653,11 @@
{
System.out.println(op+" {");
opPos+=2;
-
+
opPos = diagnoseXPath(xpath, opPos, indent+1);
-
+
opPos = diagnoseXPath(xpath, opPos, indent+1);
-
+
indent(indent);
System.out.println("}");
return opPos;
@@ -2689,7 +2689,7 @@
System.out.println("}");
return opPos;
}
-
+
static int diagnoseToken(XPath xpath, int opPos)
{
System.out.print("{");
@@ -3011,7 +3011,7 @@
System.out.print("{NODENAME ");
opPos++;
if(xpath.m_opMap[opPos] < 0)
- {
+ {
System.out.print("{EMPTY}");
opPos++;
}
@@ -3027,7 +3027,7 @@
}
return opPos;
}
-
+
static void indent(int amount)
{
int n = amount * 3;
@@ -3036,7 +3036,7 @@
System.out.print(" ");
}
}
-
+
private static String m_opLabel = "[";
private static String m_lenLabel = "[";
private static String m_arglenLabel = "[";
@@ -3045,9 +3045,9 @@
private static String m_open = "[";
private static String m_close = "]";
- public static void diagnoseXPathString2( String str )
+ public static void diagnoseXPathString2( String str )
throws org.xml.sax.SAXException
- {
+ {
XPathSupport callbacks = new XPathSupportDefault();
XPathProcessorImpl processor = new XPathProcessorImpl(callbacks);
XPath xpath = new XPath(callbacks, new
org.apache.xalan.xpath.xml.ProblemListenerDefault());
@@ -3055,9 +3055,9 @@
processor.diagnoseXPath2(xpath, 0, 0);
}
- public static void diagnoseXPathString3( String str )
+ public static void diagnoseXPathString3( String str )
throws org.xml.sax.SAXException
- {
+ {
XPathSupport callbacks = new XPathSupportDefault();
XPathProcessorImpl processor = new XPathProcessorImpl(callbacks);
XPath xpath = new XPath(callbacks, new
org.apache.xalan.xpath.xml.ProblemListenerDefault());
@@ -3102,11 +3102,11 @@
{
diagnoseOp2(op, xpath, opPos);
opPos+=2;
-
+
opPos = diagnoseXPath2(xpath, opPos, indent+1);
-
+
opPos = diagnoseXPath2(xpath, opPos, indent+1);
-
+
return opPos;
}
@@ -3128,11 +3128,11 @@
}
return opPos;
}
-
+
static int diagnoseToken2(XPath xpath, int opPos)
{
int tokenPos = xpath.m_opMap[opPos];
- String token = (tokenPos >= 0) ? xpath.m_tokenQueue[tokenPos].toString()
:
+ String token = (tokenPos >= 0) ? xpath.m_tokenQueue[tokenPos].toString()
:
(tokenPos == xpath.ELEMWILDCARD) ?
"*" : (tokenPos == xpath.EMPTY) ?
"EMPTY" : "UNKNOWN";
@@ -3168,7 +3168,7 @@
}
return opPos;
}
-
+
static int diagnoseXPath2(XPath xpath, int opPos, int indent)
{
indent(indent);
@@ -3457,7 +3457,7 @@
diagnoseNodeTest2(opPos, "NODENAME");
opPos++;
if(xpath.m_opMap[opPos] < 0)
- {
+ {
System.out.print(m_noLabel+"EMPTY"+m_close);
opPos++;
}